Trace of AB = Trace of BA [duplicate]

Solution 1:

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). $$

Solution 2:

Let's write the trace in a more convenient way. We have: $$Ae_i = \begin{bmatrix}a_{11}&\cdots & a_{1n} \\ \vdots & \ddots & \vdots \\ a_{n1} & \cdots & a_{nn} \end{bmatrix} \begin{bmatrix} 0 \\ \vdots \\ 1 \\ \vdots \\ 0\end{bmatrix} = \begin{bmatrix} a_{i1} \\ \vdots \\ a_{in}\end{bmatrix},$$ where the $1$ is in the $i$-th entry. This way: $$ \langle e_i, Ae_i \rangle = e_i^tAe_i = a_{ii}.$$ So ${\rm tr}(A) = \sum_ia_{ii}$. Now: $(AB)_{ij} = \sum_k a_{ik}b_{kj}$, and: $${\rm tr}(AB) = \sum_i \sum_k a_{ik}b_{ki}.$$On the other hand, $(BA)_{ij} = \sum_k b_{ik}a_{kj}$. So: $${\rm tr}(BA) = \sum_i \sum_kb_{ik}a_{ki}.$$They are the same quantity, up to renaming indices ($i \leftrightarrow k$)

Solution 3:

Though this isn't the approach you might want to see as how you stated the question, I thought I would throw this in as well.

$\mathrm{Tr}(AB) = \sum_{i=1}^n (AB)_{ii} = \sum_{j=1}^n\sum_{k=1}^n A_{jk}B_{kj}$

Now you can manipulate that expression to show that it equals $\mathrm{Tr}(BA)$.