Advertisement

Matrix trace calculator

Choose the matrix size and enter every entry row by row. The trace adds the entries on the main diagonal, from the top left corner to the bottom right corner.

Calculator

Trace
5.00000000
Main diagonal entries
1, 4
Mean diagonal entry
2.50000000

Advertisement

How this calculator works

The main diagonal of a square matrix runs from the top left entry to the bottom right entry. The trace is the sum of those entries. Only square matrices have a trace, and the result is a single number, not a matrix. The trace equals the sum of the eigenvalues counted with algebraic multiplicity, even when some eigenvalues are complex.

Formula

tr(A) = a11 + a22 + ... + ann for an n by n matrix A.

Worked example

For the 2 by 2 matrix with rows 1, 2 and 3, 4, the diagonal entries are 1 and 4. The trace is 1 + 4 = 5 and the mean diagonal entry is 2.5. For a 3 by 3 matrix with rows 1, 2, 3; 4, 5, 6; 7, 8, 9, the trace is 1 + 5 + 9 = 15.

Advertisement

Frequently asked questions

Can I take the trace of a rectangular matrix?

No. The trace is defined only for square matrices, because it compares positions with the same row and column index.

Is the trace affected by row order?

Reordering rows changes which entries lie on the diagonal, so the trace can change. The trace is unchanged by a cyclic permutation of rows and the matching columns.

How is the trace related to eigenvalues?

For a square matrix over the complex numbers, the trace is the sum of its eigenvalues, including repeats. The determinant is their product.

Sources

Advertisement