← Module 03 / Understanding matrices

Lesson 03.2 · §3.7

Which changes leave the diagonal sum alone?

Use trace linearity and cyclic invariance without assuming arbitrary reordering.

In this lesson 3 ideas
  1. Add the diagonal
  2. A cycle is not a shuffle
  3. Transfer

Source scope: §3.7. Worked numerical examples, experiments, and practice are teaching supplements unless identified as source results.

Add the diagonal

For A=[270−1]A=\begin{bmatrix}2&7\\0&-1\end{bmatrix}, the trace is 2+(−1)=12+(-1)=1. The off-diagonal seven contributes nothing directly:

tr⁡(A)=∑i=1nAii.\operatorname{tr}(A)=\sum_{i=1}^n A_{ii}.

The source lists four rules for compatible square sums and square cyclic products:

tr⁡(A+B)=tr⁡(A)+tr⁡(B),tr⁡(αA)=αtr⁡(A),tr⁡(AT)=tr⁡(A),\operatorname{tr}(A+B)=\operatorname{tr}(A)+\operatorname{tr}(B),\qquad \operatorname{tr}(\alpha A)=\alpha\operatorname{tr}(A),\qquad \operatorname{tr}(A^T)=\operatorname{tr}(A), tr⁡(ABCD)=tr⁡(BCDA)=tr⁡(CDAB)=tr⁡(DABC).\operatorname{tr}(ABCD)=\operatorname{tr}(BCDA)=\operatorname{tr}(CDAB)=\operatorname{tr}(DABC).

The first three follow by summing diagonal entries. The last is cyclic invariance; it applies to any number of factors, not only four. A teaching derivation of the basic step is

tr⁡(AB)=∑i,jAijBji=∑j,iBjiAij=tr⁡(BA).\operatorname{tr}(AB)=\sum_{i,j}A_{ij}B_{ji}=\sum_{j,i}B_{ji}A_{ij}=\operatorname{tr}(BA).

This also works for rectangular A∈Rm×nA\in\mathbb R^{m\times n} and B∈Rn×mB\in\mathbb R^{n\times m} because both products are square, though their sizes differ. Group a longer product into two factors to move its first factor to the end.

A cycle is not a shuffle

Let A=[1000]A=\begin{bmatrix}1&0\\0&0\end{bmatrix}, B=[0100]B=\begin{bmatrix}0&1\\0&0\end{bmatrix}, and C=[0010]C=\begin{bmatrix}0&0\\1&0\end{bmatrix}. Then BC=ABC=A, so tr⁡(ABC)=1\operatorname{tr}(ABC)=1. But BA=0BA=0, so tr⁡(BAC)=0\operatorname{tr}(BAC)=0. Arbitrary swaps fail. Taking a fourth factor D=ID=I gives the source’s four-factor warning.

The trace also equals the sum of eigenvalues, counted with algebraic multiplicity:

tr⁡(A)=∑iλi(A).\operatorname{tr}(A)=\sum_i\lambda_i(A).

The source states this identity without proof. A general real matrix can have complex eigenvalues; the sum still equals its real trace. For symmetric matrices all eigenvalues are real, as the spectral theorem will establish.

Transfer

Must tr⁡(ABC)\operatorname{tr}(ABC) equal tr⁡(CAB)\operatorname{tr}(CAB)? Must it equal tr⁡(ACB)\operatorname{tr}(ACB)?

Preserve the cyclic order

The first equality holds whenever the cyclic products are defined and square. The second need not hold: it swaps two factors instead of cycling them.