trAB=trBA

For A,B such that AB is square, trAB = trBA,

\[A \in R^{m×n}, B \in R^{n×m}\] \[\operatorname{tr}(A B)=\sum_{i=1}^{m}(A B)_{i i}=\sum_{i=1}^{m} \sum_{j=1}^{n} a_{i j} b_{j i}=\sum_{i=1}^{m} \sum_{j=1}^{n} b_{j i} a_{i j}=\sum_{i=1}^{n}(B A)_{i i}=\operatorname{tr}(B A)\]