Trace is one of 5 matrices formulas in the linear algebra section of this library, and it is used at university level.
Why trace works
Adding the diagonal entries looks arbitrary until you notice it equals the sum of the eigenvalues. Expanding the characteristic polynomial shows the coefficient beside λ to the power n − 1 is that same diagonal sum, so the trace survives any change of basis and reports something about the transformation, not about the chosen coordinates.
What each symbol means
$a_{ii}$ are diagonal entries.
Trace: when it holds
$A$ must be square; trace is unchanged by a cyclic reordering such as $\operatorname{tr}(AB)=\operatorname{tr}(BA)$.
When it stops applying
The trace is undefined for a non-square matrix, since a 2 by 3 array has no full main diagonal to sum. It also cannot tell matrices apart on its own, as [[1, 0], [0, 4]] and [[2, 7], [0, 3]] both have trace 5 while behaving very differently.
Trace: a worked example
For diagonal entries $2,3,5$, the trace is $10$.
The mistake to avoid
What people do: Students add every entry in the matrix, or run along the other diagonal from top right to bottom left.
Why it goes wrong: Only the main diagonal, from top left to bottom right, counts. For [[1, 2], [3, 4]] the trace is 1 + 4 = 5, while all four entries sum to 10 and the opposite diagonal gives 5 for a different reason entirely.
Do this instead: Run one finger from the top-left corner straight down to the bottom-right corner and add only what it touches. As a check, that total should equal the sum of the eigenvalues, here about −0.372 and 5.372.
Trace: step by step
- Name the unknown, and the unit the answer has to come out in.
- Match the symbols to your values. $a_{ii}$ are diagonal entries.
- Check the conditions before substituting. $A$ must be square; trace is unchanged by a cyclic reordering such as $\operatorname{tr}(AB)=\operatorname{tr}(BA)$.
- Substitute, keep exact values to the last line, then test the sign, size, and unit against a rough estimate — the check that catches most linear algebra slips.
Where this formula fits
- Subject
- Linear Algebra formulas — 17 entries in this library
- Topic
- Matrices
- Level
- University
Formulas are easiest to keep when they sit inside a method rather than on a list. Use the links below to see where trace comes from, to check a calculation against a tool, and to practise it until you can recall it without looking.
- Matrix Operations — the lesson behind this formula: add, scale, and multiply matrices with attention to dimensions.
- Linear Algebra Calculator — check your substitution and the value it produces.
- Study linear algebra — the subject guide that explains the ideas these formulas compress.
- Linear Algebra Practice — questions that make you retrieve the formula instead of recognising it.
- All 17 linear algebra formulas — the full grouped reference, or the complete formula library.
Questions about trace
Does the trace really equal the sum of the eigenvalues?
Yes, for every square matrix, counting repeats and complex values. It gives you a free check on eigenvalue work: if your answers do not add up to the diagonal sum, something went wrong.
Is tr(AB) equal to tr(A) times tr(B)?
No. Take A and B both equal to the 2 by 2 identity: tr(AB) is 2, while the product of the traces is 4. The trace adds nicely but does not multiply nicely.
Why is tr(AB) equal to tr(BA) when AB and BA differ?
Because both totals expand into the same double sum of aᵢₖbₖᵢ, just gathered in a different order. The two product matrices really are different, yet their diagonals happen to sum to the same value.
What does the trace mean geometrically?
For a small transformation it measures the rate at which volume changes, which is why it appears in the divergence of a vector field and in the stability analysis of differential equations.