If \(A\) and \(B\) are \(n \times n\) matrices over the field \(F\), show that \(\operatorname{trace}(AB) = \operatorname{trace}(BA)\). Now show that similar matrices have the same trace.
Solution
Write \(A=(a_{ij})\) and \(B=(b_{ij})\). Then \[ \operatorname{tr}(AB) =\sum_i(AB)_{ii} =\sum_{i,j}a_{ij}b_{ji}. \] Interchanging the dummy indices \(i,j\) gives \[ \sum_{i,j}a_{ij}b_{ji} =\sum_{i,j}b_{ij}a_{ji} =\operatorname{tr}(BA). \] Thus \(\operatorname{tr}(AB)=\operatorname{tr}(BA)\).
If \(B=P^{-1}AP\) is similar to \(A\), then \[ \operatorname{tr}(B) =\operatorname{tr}(P^{-1}AP) =\operatorname{tr}(APP^{-1}) =\operatorname{tr}(A). \] Therefore similar matrices have the same trace.