Matrix Trace Calculator

Enter your square matrix values and the Matrix Trace Calculator computes the trace — the sum of all main diagonal elements (a₁₁ + a₂₂ + ... + aₙₙ). Choose a matrix size from 2×2 up to 5×5, fill in the matrix entries, and get the trace value along with the diagonal elements used in the calculation. Also try the Matrix Multiplication Calculator.

Select the size of your square matrix

Results

Matrix Trace

--

Diagonal Elements

--

Matrix Size

--

Results Table

Frequently Asked Questions

What is the trace of a matrix?

The trace of a matrix is the sum of all elements on its main diagonal — that is, elements where the row index equals the column index (a₁₁, a₂₂, a₃₃, …). The matrix must be square (same number of rows and columns) for the trace to be defined. See also our calculate Matrix Rank.

How do I calculate the trace of a matrix?

To find the trace, identify all diagonal entries aᵢᵢ of the square matrix and add them together. For a 3×3 matrix with diagonal values -2, 6, and 5, the trace would be -2 + 6 + 5 = 9. This calculator automates that sum for matrices up to 5×5.

What is the cyclicity of the trace?

The trace is cyclic, meaning tr(ABC) = tr(BCA) = tr(CAB) for any matrices A, B, C where the products are defined. This is a fundamental property that makes the trace invariant under cyclic permutations of a matrix product, though it does not hold for arbitrary reorderings.

Is the trace of a matrix a linear transformation?

Yes, the trace is a linear transformation from the space of square matrices to the real numbers. This means tr(A + B) = tr(A) + tr(B) and tr(cA) = c·tr(A) for any scalar c and square matrices A and B of the same size. You might also find our calculate Gauss-Jordan Elimination useful.

What is the trace of a projection matrix?

The trace of a projection matrix equals the rank of the matrix, which is also the dimension of the subspace it projects onto. For an orthogonal projection matrix P, the eigenvalues are all 0 or 1, so the trace simply counts how many eigenvalues equal 1.

How are the trace and eigenvalues of a matrix related?

The trace of a matrix equals the sum of all its eigenvalues (counted with multiplicity). For a 2×2 matrix with eigenvalues λ₁ and λ₂, the trace = λ₁ + λ₂. This relationship is useful in characteristic polynomial analysis and stability studies.

How do I calculate the eigenvalues of a 2×2 matrix given trace and determinant?

For a 2×2 matrix, the eigenvalues satisfy λ² - tr(A)·λ + det(A) = 0. Using the quadratic formula: λ = [tr(A) ± √(tr(A)² - 4·det(A))] / 2. So knowing the trace and determinant is sufficient to find both eigenvalues without fully expanding the characteristic polynomial.

Does the trace change under matrix similarity transformations?

No — the trace is invariant under similarity transformations. If B = P⁻¹AP for any invertible matrix P, then tr(B) = tr(A). This makes the trace an intrinsic property of the linear transformation represented by the matrix, independent of the chosen basis.