A Holistic View of the Trace
Will Healy September 2026
Introduction
I wanted to write this piece on the trace to complement the essay I wrote on the determinant. While the simplest interpretation of the trace is easier to understand than the simplest interpretation of the determinant, I’d argue that understanding the trace in depth is actually more complicated. However, I think that along with this depth comes some very interesting results. I hope you enjoy.
Definition of the Trace
The trace of a square matrix A is defined as:
\[Tr(A) = \sum_i^na_{ii}\]That is it. It is the sum of the diagonal entries of a matrix. This is where the deception of simplicity catches most people. You should immediately be questioning the significance of this result. Why are the diagonal entries important? Why not sum the elements along the border of the matrix or the elements which define a cross on the matrix?
The simplest explanation as to the significance of the diagonal entries comes from considering how a matrix transforms the basis vectors of $R^n$. For a basis vector $e_i$, the diagonal entry $a_{ii}$ tells us how $e_i$ transformed by a matrix $A$ is projected back onto itself. It tells us:
\[a_{ii} = \langle e_i, Ae_i \rangle = e_i^TAe_i\]So, we can rewrite the definition of the trace of $A$ as:
\[Tr(A) = \sum_i^n e_i^TAe_i\]Trace as a Linear Function
One nice thing about the simplest definition of the trace:
\[Tr(A) = \sum_i^na_{ii}\]is that it clearly shows the linear property of trace. That is:
\[Tr(A + B) = Tr(A) + Tr(B)\]Since the i’th entry on the diagonal of a sum of matrices is equal to sum of the i’th element of the diagonal of the first summand plus the i’th element of the diagonal on the second summand.
It is also trivial that:
\[Tr(cA) = cTr(A)\]where c is a constant since all the diagonal entries of $cA$ are simply equal to the diagonal entries of $A$ times $c$.
Hopefully both of these properties are excruciatingly obvious. It is still worth stating explicitly, though, since as we introduce other definitions of the trace these properties will not fall out as obviously. It is also worth taking a moment to compare this value to the determinant, where neither of these linear properties hold.
Trace of a Rotation
Equipped with the definition of a trace, let’s consider the trace of a rotation matrix. A rotation matrix will affect all basis vectors in the same way. It will rotate them by some amount over some set of axes. Thus, the projection of each transformed basis vector back onto itself should be the same for each basis vector. For a 90 degree rotation, each basis vector gets transformed to become a vector orthogonal to itself. Since the projection of a vector onto an orthogonal vector has length $0$, this means that the the trace, which we’ve defined as the sum of these projections, will be:
\[\sum_i^n e_i^TAe_i = \sum_i^n 0 = 0\]For a rotation of 180 degrees, each projection will be -1. Thus, in this case the trace would be:
\[\sum_i^n e_i^TAe_i = \sum_i^n -1 = -n\]The identity matrix can also be thought of as a rotation matrix for a 0 degree rotation. Here, the proejction of each basis vector onto itself is 1 and thus:
\[Tr(I) = \sum_i^n e_i^TAe_i = \sum_i^n 1 = n\]Cyclicity Property of Trace
The trace has an interesting property when you scramble the order of matrices in a product in its input. Matrix multiplication is not commutative. That is, $AB$ does not have to equal $BA$. However, the trace of $AB$ does equal the trace $BA$, even though these two matrices may have different dimensions. This result leads to a more general property called cyclicity. This section will prove this cyclicity result in two parts.
Showing $Tr(AB) = Tr(BA)$
Let’s show that:
\[Tr(AB) = Tr(BA)\]To see this, note that:
\[Tr(AB) = \sum_i^n(AB)_{ii}\]and that since \((AB)_{ii}\) is the dot product of the i’th column of $B$ with the i’th row of $A$, it can also be written as:
\[(AB)_{ii} = \sum_j^nA_{ij}B_{ji}\]Substituting this equation for $(AB)_{ii}$ back into our definition of $Tr(AB)$ we get that:
\[Tr(AB) = \sum_i^n\sum_j^nA_{ij}B_{ji}\]Now, expanding $Tr(BA)$ the same way we have that:
\[\begin{aligned} Tr(BA) &= \sum_j^n(AB)_{jj} \\ &= \sum_j^n\sum_i^nB_{ji}A_{ij} \\ &= \sum_j^n\sum_i^nA_{ij}B_{ji} \\ &= Tr(AB) \end{aligned}\]Showing $Tr(ABC) = Tr(CAB) = Tr(BCA)$
From the fact that $Tr(AB) = Tr(BA)$, it follows that for products of more matrices we can define a cyclicity equivalence. This means that for a product of matrices, we can re-arrange the order of the matrices in a way which retains their cyclical ordering without changing the trace. The easiest way to think about this is by thinking of a product of matrices as a circle where the first and last element in the product are connected. Then, this circle has the same determinant no matter where you start and end the product.
To see this, note that:
\[(ABC) = ((AB)C) = (A(BC))\]and so,
\[\begin{aligned} \color{red}{Tr(ABC)} &= Tr((AB)C) \\ &= Tr(C(AB)) \\ &= \color{red}{Tr(CAB)} \\ &= Tr((CA)B) \\ &= Tr(B(CA)) \\ &= \color{red}{Tr(BCA)} \end{aligned}\]This cyclical equivalence property is a direct result of the fact that $Tr(AB) = Tr(BA)$
Connection to Eigenvalues
Using this cyclicity property, we can now relate the trace to eigenvalues. The relationship between the trace of a matrix $A$ and its eigenvalues is clearest for diagnolizable matrices, so let’s start there.
Assume we have a matrix $A$ that is diagnolizable. That is:
\[A = PDP^{-1}\]where $D$ is a diagonal matrix containing the eigenvalues of $A$. By the cyclicity property we just showed, it follows that:
\[\begin{aligned} Tr(A) &= Tr(PDP^{-1}) \\ &= Tr(P^{-1}PD) \\ &= Tr(ID) \\ &= Tr(D) \\ &= \sum_i^n D_{ii} \\ &= \sum_i^n \lambda_i \end{aligned}\]where $\lambda_i$ is the i’th eigenvalue of A.
This shows an incredible result: for diagonalizable matrices the trace is equal to the sum of the eigenvalues. What is even more amazing is the fact that this statement holds even if A is not diagonalizable. Let’s now show this result holds for any matrix A.
Any matrix $A$ is triangulizable, meaning that A can be written as:
\[A = PTP^{-1}\]where $T$ is an upper triangular matrix. Additionally, for any upper triangular matrix the eigenvalues are equal to the diagonal entries of the matrix. So, an almost identical proof gives that for any square matrix $A$:
\[\begin{aligned} Tr(A) &= Tr(PTP^{-1}) \\ &= Tr(P^{-1}PT) \\ &= Tr(IT) \\ &= Tr(T) \\ &= \sum_i^n T_{ii} \\ &= \sum_i^n \lambda_i \end{aligned}\]This provides us with another definition of the trace. The trace of a matrix is the sum of matrix’s eigenvalues.
Connection to Determinant
In this piece I discussed the determinant, where we showed that the determinant is equal to:
\[\prod_i \lambda_i\]Since we just showed that the trace can be expressed as:
\[\sum_i \lambda_i\]it may be intuitive that there is a relationship between these two values. There are many ways to see the relationship between these two values, but I think the following is the cleanest, especially if attempting to tie this back to geometry.
Let’s first consider the matrix $I + \epsilon A$ for some matrix A and a small constant $\epsilon$. When a vector $x$ gets multiplied by this matrix, the result is:
\[(I + \epsilon A)x = x + \epsilon Ax\]which essentially nudges $x$ in the direction of $Ax$. The size of the nudge is determined by $\epsilon$.
Let’s consider the determinant of the matrix:
\[(I + \epsilon A)\]Recall our definition of the determinant:
\[\sum_{\sigma \in S_n} \prod_i^na_{\sigma(i)i} \operatorname{sgn}(\sigma)\]For any permutation $\sigma$ except for [1, 2, … n], the product:
\[\prod_i^na_{\sigma(i)i}\]will yield an order at least as small as $\epsilon^2$. This is because if one term is off the diagonal then at least two terms must be off the diagonal. Since each off diagonal term is of the form $\epsilon a_{ij}$, the resulting product will contain two $\epsilon$ terms. Thus, a first order estimate of the determinant of:
\[(I + \epsilon A)\]can be found by taking the first order terms of only the permutation consisting of diagonal elements. The product of this diagonal permutation for $I + \epsilon A$ is equal to:
\[\prod_i^n (1 + \epsilon a_{ii})\]The first order terms in this product simplify to:
\[\begin{aligned} \prod_i^n (1 + \epsilon a_{ii}) &\approx 1 + \sum_i^n \epsilon a_{ii} \\ &= 1 + \epsilon \sum_i^n a_{ii} \\ &= 1 + \epsilon Tr(A) \end{aligned}\]So, we’ve shown the following result:
\[Det(I + \epsilon A) \approx 1 + \epsilon Tr(A)\]for small $\epsilon$.
Now, note that if we differentiate the determinant of $(I + \epsilon A)$ with respect to $\epsilon$, the result is $Tr(A)$:
\[\frac{dDet(I + \epsilon(A))}{d\epsilon} \approx Tr(A)\]Geometrically, this is quite illuminating. Recall that for a closed set $S$, the magnitude of the determinant of A is equal to the ratio of the volume of the transformed set
\[S' = \{As | s \in S\}\]to the volume of $S$. With the result that we just showed, this means that for small nudges to $S$ in the direction of A, the ratio $\frac{\operatorname{vol}(S’)}{\operatorname{vol}(S)}$ changes by $\epsilon Tr(A)$, where $\epsilon$ is the size of the nudge.
So, $Tr(A)$ is a first order approximation of the rate of fractional change in the volume of a set transformed in the direction $A$.
Concluding Thoughts
There is much more to say about the trace. However, I think that the provided results give a complete breadth-first understanding of the operation. To recap, we first defined the trace as the sum of diagonal entries. We then showed two properties of the trace: linearity and cyclicity. We then used these results to show the trace’s relationship to eigenvalues, which provided an alternative definition to the trace. Finally, we discussed an interesting relationship between the trace and determinant, using our existing knowledge of the determinant to build a geometric intuition for the trace.
I hope you enjoyed this piece. If you have any questions or suggestions or think that I made a mistake, feel free to reach out at [email protected]