= Cyclic property of the trace
{title2=$\operatorname{tr}(AB)=\operatorname{tr}(BA)$}
If $A$ is an $m$-by-$n$ <matrix> and $B$ is an $n$-by-$m$ <matrix> over the same <field>, both products are <square matrices> and
$$
\operatorname{tr}(AB)=\sum_{i=1}^m\sum_{j=1}^n a_{ij}b_{ji}
=\sum_{j=1}^n\sum_{i=1}^m b_{ji}a_{ij}=\operatorname{tr}(BA).
$$
The products can even have different sizes: for $A=(1\ \ 2)$ and $B=(3\ \ 4)^T$, $AB=(11)$ and $BA=\begin{pmatrix}3&6\\4&8\end{pmatrix}$, but both have <trace> $11$.<Linear Algebra Done Right by Sheldon Axler (4th edition)>[Axler, Linear Algebra Done Right, fourth edition, §8D, result 8.49]{ref}
Grouping all but one factor proves that $\operatorname{tr}(A_1A_2\cdots A_k)$ is unchanged by a cyclic permutation whenever the cyclic products are defined and square. In particular, every <commutator> has <trace> zero, since $\operatorname{tr}(AB-BA)=0$ by <linearity>.
Cyclic rotation does not allow arbitrary reordering. For
$$
A=\begin{pmatrix}1&0\\0&0\end{pmatrix},\quad
B=\begin{pmatrix}0&1\\0&0\end{pmatrix},\quad
C=\begin{pmatrix}0&0\\1&0\end{pmatrix},
$$
one has $ABC=A$, so $\operatorname{tr}(ABC)=1$, but $AC=0$, so $\operatorname{tr}(ACB)=0$. Rotating $ABC$ to $BCA$ or $CAB$ preserves its <trace>; swapping just $B$ and $C$ need not.
Back to article page