11

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?

MPW
  • 44,860
  • 2
  • 36
  • 83
Myshkin
  • 36,898
  • 28
  • 168
  • 346

3 Answers3

38

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

abel
  • 29,612
17

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

Ivo Terek
  • 80,301
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)$.

MathNewbie
  • 1,583
  • 14
  • 29