= Matrix trace
{title2=$\operatorname{tr}A=\sum_{i=1}^n a_{ii}$}
{wiki=Trace (linear algebra)}
= Trace
{synonym}
For an $n$-by-$n$ <square matrix> $A=(a_{ij})$ over a <field>, its matrix trace is the sum of its diagonal entries:
$$
\operatorname{tr}A=\sum_{i=1}^n a_{ii}.
$$
For example, $A=\begin{pmatrix}2&1\\1&1\end{pmatrix}$ has <trace> $2+1=3$. Adding corresponding diagonal entries immediately proves <linearity>:
$$
\operatorname{tr}(\alpha A+\beta B)=\alpha\operatorname{tr}A+\beta\operatorname{tr}B.
$$
Thus <matrix trace> is a <linear functional> on the <vector space> of $n$-by-$n$ <matrices>.<Linear Algebra Done Right by Sheldon Axler (4th edition)>[Axler, Linear Algebra Done Right, fourth edition, §8D, definition 8.47 and result 8.56]{ref}
The surprising point is that the sum is intrinsic to a <linear operator>, even though individual diagonal entries depend on the <basis>. The <cyclic property of the trace> gives, for any <invertible matrix> $P$,
$$
\operatorname{tr}(P^{-1}AP)=\operatorname{tr}(APP^{-1})=\operatorname{tr}A.
$$
Hence <matrix similarity> preserves <trace>. For the example above, choose the <change-of-basis matrix> $P=\begin{pmatrix}1&1\\0&1\end{pmatrix}$. Then
$$
P^{-1}AP=\begin{pmatrix}1&1\\1&2\end{pmatrix}:
\qquad 1+2=2+1=3.
$$
The diagonal entries have changed but their sum has not. This makes <trace> useful for extracting a feature of the underlying <linear operator> without finding a preferred <basis>.
Over the <complex numbers>, or over the <real numbers> after allowing complex <eigenvalues>, the <trace> equals their sum with <algebraic multiplicity>:
$$
\operatorname{tr}A=\lambda_1+\cdots+\lambda_n.
$$
No <diagonalizable matrix> hypothesis is needed.<Linear Algebra Done Right by Sheldon Axler (4th edition)>[Axler, Linear Algebra Done Right, fourth edition, §8D, results 8.50–8.52]{ref} To see why, use <triangularization over an algebraically closed field>: an <upper triangular matrix> similar to $A$ has the <eigenvalues> on its diagonal, counted with <algebraic multiplicity>, because its <characteristic polynomial> is $\prod_i(z-\lambda_i)$. <Similarity> preserves <trace>, so summing that diagonal proves the formula.
For instance,
$$
J=\begin{pmatrix}2&1\\0&2\end{pmatrix},\qquad
\det(zI-J)=(z-2)^2,\qquad\operatorname{tr}J=2+2=4.
$$
There is only one independent <eigenvector>, since $(J-2I)(x,y)^T=(y,0)^T$, so $J$ is not a <diagonalizable matrix>. Nevertheless its repeated <eigenvalue> contributes twice. For our earlier $A$, the <characteristic polynomial> is $z^2-3z+1$, its <eigenvalues> are $(3+\sqrt5)/2$ and $(3-\sqrt5)/2$, and their sum is $3$. An inexpensive diagonal sum therefore gives spectral information before solving the <characteristic polynomial>.
The <trace> of a real <matrix> does not give that <linear map>'s <volume> factor: that factor is the <absolute value> of its <determinant>. For example, $2I_2$ has <trace> $4$ and <area> factor $4$, but $2I_3$ has <trace> $6$ and <volume> factor $8$. Their occasional numerical agreement in two dimensions is a coincidence. The connection between <trace and local volume change> gives a geometric interpretation near the <identity matrix>, and describes the <volume> rate of a <flow map> generated by a <linear system of differential equations>.
Back to article page