Explanation/ Intuition for part of Trace Proof.

45 Views Asked by At

Given that $A \in R^{n \times m}$ and $B \in R^{m \times n}$

The following holds true about their traces.

\begin{align*} \mathrm{tr}(AB) &= \sum_{i=1}^n (AB)_{ii}\\ &=\sum_{i=1}^n \sum_{j=1}^m A_{ij}B_{ji}\\ &= \sum_{j=1}^m \sum_{i=1}^n B_{ji}A_{ij}\\ &= \sum_{j=1}^m (BA)_{jj}\\ &= \mathrm{tr}(BA) \end{align*}

Can someone explain / provide intuition why $\sum_{i=1}^n (AB)_{ii}$ splits into $\sum_{i=1}^n \sum_{j=1}^m A_{ij}B_{ji}$?

Maybe an example matrix would help me understand.

1

There are 1 best solutions below

0
On BEST ANSWER

By the definition of matrix multiplication, the $i,k$ entry of $AB$ is given by $$ (AB)_{ik} = \sum_{j=1}^m A_{ij} B_{jk}. $$ Thus, taking $k = i$ in the above, we can write $$ \begin{align*} \mathrm{tr}(AB) &= \sum_{i=1}^n (AB)_{ii} =\sum_{i=1}^n \left(\sum_{j=1}^m A_{ij}B_{ji}\right) = \sum_{i=1}^n \sum_{j=1}^m A_{ij}B_{ji}. \\ \end{align*} $$


As for an example: I recommend that you look at this in detail the case that $m = 1$ and $n$ is any value ($n = 3$ for instance).