TITLE: Trace of AB = Trace of BA
QUESTION [8 upvotes]: We can define trace if $A =\sum_{i} \langle e_i, Ae_i\rangle$ where $e_i$'s are standard column vectors, and $\langle x, y\rangle =x^t y$ for suitable column vectors $x, y$. With this set up, I want to prove trace of AB and BA are same, so it's enough to prove that $$\sum_{i} \langle e_i, ABe_i\rangle =\sum_{i} \langle e_i, BAe_i\rangle$$ but how to conclude that?

REPLY [24 votes]: by definition $$\begin{align}trace(AB) &= (AB)_{11}+(AB)_{22}+\cdots+(AB)_{nn}\\
&=a_{11}b_{11}+a_{12}b_{21}+\cdots + a_{1k}b_{k1} \\
&+ a_{21}b_{12}+a_{22}b_{22}+\cdots + a_{2k}b_{k2}\\
&+\vdots  \\
&+a_{n1}b_{1n}+a_{n2}b_{2n}+\cdots + a_{nk}b_{kn}\end{align}$$ if you view the sum according to the columns, then you see that it is the $trace(BA).$  therefore, $$trace(AB) = trace(BA). $$