The trace is the sum of the entries on the main diagonal — the ones where the row index equals the column index. Press tr(A) for the value. It is the simplest number you can extract from a matrix, and considerably more useful than its definition suggests.
Why such a simple sum is useful
The trace equals the sum of the eigenvalues, counted with multiplicity. That single fact turns it into a free check: compute the eigenvalues, add them, and compare with the diagonal sum. If they disagree, something went wrong. Paired with the determinant — which equals the product of the eigenvalues — the trace pins down both eigenvalues of any 2×2 matrix without solving anything.
It also has a property multiplication almost never offers: tr(A·B) = tr(B·A), even though A·B and B·A are usually different matrices. And unlike the determinant, the trace is linear — tr(A + B) = tr(A) + tr(B) and tr(k·A) = k·tr(A) — which is why it appears throughout statistics and physics wherever an average over a system is needed.
Worked example
| 2 | 7 | 1 |
| 0 | 3 | 5 |
| 4 | 9 | 4 |
Only the highlighted diagonal contributes; every other entry is ignored. For a triangular matrix the eigenvalues sit on that same diagonal, so the trace and the eigenvalue sum are visibly the same number.
Common mistakes
- Summing the anti-diagonal. The trace runs top-left to bottom-right, always.
- Taking the trace of a rectangular matrix. It is defined for square matrices only.
- Expecting tr(A·B) = tr(A)·tr(B). False in general. The trace is linear over addition, not multiplication.
- Confusing it with the determinant. The trace adds the eigenvalues; the determinant multiplies them. A zero trace says nothing about invertibility.