Euler Hall — free maths guides

Sum the diagonal entries

Compute the trace of a small square matrix from its diagonal. The idea in plain words, a worked example, and a check with the answers shown — part of the free Linear Algebra guides.

The trace, in one line

For a square matrixAA:

tr⁡A=a11+a22+⋯+ann.\operatorname{tr}A=a_{11}+a_{22}+\cdots+a_{nn}.

That is the whole definition. It readsnn entries out ofn2n^2, and everything off the diagonal is irrelevant.

Two facts make it more than bookkeeping:

  • -tr⁡A\operatorname{tr}A equals the sum of the eigenvalues ofAA;
  • -tr⁡(AB)=tr⁡(BA)\operatorname{tr}(AB)=\operatorname{tr}(BA) for any shapes that allow both products.

The first is why it appears in every eigenvalue check. The second is the subject of the next skill.

A rectangular matrix has no trace. The definition needsa11,a22,…a_{11},a_{22},\dots and one of the two indices runs out, so there is no main diagonal at all.

Why the trace equals the sum of the eigenvalues

WriteAA's characteristic polynomial asdet⁡(A−λI)\det(A-\lambda I). Expanded, it starts

det⁡(A−λI)=(−λ)n+tr⁡A (−λ)n−1+⋯+det⁡A.\det(A-\lambda I)=(-\lambda)^n+\operatorname{tr}A\,(-\lambda)^{n-1}+\cdots+\det A.

The middle coefficient is the trace: when you expand the determinant along permutations, the only terms that contribute to the second-highest power ofλ\lambda are the ones keeping every diagonal factor, and those are exactlya11,a22,…,anna_{11},a_{22},\dots,a_{nn}.

On the other side, the characteristic polynomial factors as(λ1−λ)⋯(λn−λ)(\lambda_1-\lambda)\cdots(\lambda_n-\lambda), and the coefficient ofλn−1\lambda^{n-1} there is the sum of the eigenvalues. Two expressions for one polynomial means those coefficients are equal, so the trace is the eigenvalue sum.

For a2×22\times2 this reduces to something you can use in one line:tr⁡A=λ1+λ2\operatorname{tr}A=\lambda_1+\lambda_2 anddet⁡A=λ1λ2\det A=\lambda_1\lambda_2.

Trace and determinant, side by side

A=[3412].A=\begin{bmatrix}3&4\\1&2\end{bmatrix}.

tr⁡A=3+2=5\operatorname{tr}A=3+2=5.det⁡A=6−4=2\det A=6-4=2.

The eigenvalues satisfyλ2−5λ+2=0\lambda^2-5\lambda+2=0, so they are5±172\tfrac{5\pm\sqrt{17}}{2}. Both are irrational and neither is an entry — which is the point: the trace and the determinant are combinations of the entries, not entries.

Now use the trace to find a missing eigenvalue:

B=[1234],tr⁡B=5,det⁡B=−2.B=\begin{bmatrix}1&2\\3&4\end{bmatrix},\qquad \operatorname{tr}B=5,\qquad \det B=-2.

If one eigenvalue is66, the other must be5−6=−15-6=-1. Check it:λ1λ2=6⋅(−1)=−6\lambda_1\lambda_2=6\cdot(-1)=-6, butdet⁡B=−2\det B=-2, so66 was not an eigenvalue. The trace step is a consequence of the eigenvalues being right, never a way to fix a wrong one.

By the end you can
  • Compute the trace of a small square matrix from its diagonal
  • Explain why a rectangular matrix has no trace
  • Use the trace with the determinant to recover the second eigenvalue of a 2x2
Check yourself

AA is4×44\times4 withtr⁡A=3\operatorname{tr}A=3 and eigenvalues−1-1,22,22, and one more. What is the fourth eigenvalue? And what istr⁡(A2)\operatorname{tr}(A^2)?

Answers

The four eigenvalues sum to33, and−1+2+2=3-1+2+2=3, so the fourth eigenvalue is00.

tr⁡(A2)\operatorname{tr}(A^2) is the sum of the squared eigenvalues:1+4+4+0=91+4+4+0=9. The trace of a power is the power of the eigenvalues summed, not the square of the trace —32=93^2=9 agrees here only because the eigenvalues happen to give the same number, which is a coincidence worth not relying on.

Work out where to start — free, no accountAnswer six real questions — free, no account