Prove ${\rm tr}\ (AA^T)={\rm tr}\ (A^TA)$ for any Matrix $A$ Prove ${\rm tr}\ (AA^T)={\rm tr}\ (A^TA)$ for any Matrix $A$
I know that each are always well defined and I have proved that, but I am struggling to write up a solid proof to equate them. I know they're equal.
I tried to show that the main diagonal elements were the same but if I say that $A$ is $n\times m$ then 
$$(AA^T)_{ii} = (a_{11}^2+\dots +a_{1m}^2) + \dots + (a_{n1}^2+\dots +a_{nm}^2)$$
and
$$(A^TA)_{ii} = (a_{11}^2+\dots +a_{n1}^2) + \dots + (a_{1m}^2+\dots +a_{nm}^2)$$
 A: By $(AA^T)_{ii}$ you seem to mean the $i$-th term on the diagonal of $AA^T$. But instead what you've writen is already $\mathrm{tr}(AA^T)$. Which is ok. Now, you just have to realize that both sums are the same, up to the order of the addends -which doesn't matter.
For instance: you have $a_{11}^2$ on both sums, haven't you?
Also $a_{1m}^2$ appears on both sums. Also $a_{n1}^2$...
Write a few more terms on both sums. Or write all terms in the particular case $2\times 3$ and you'll see it.
A: To give you an idea of how to properly write these sort of proofs down, here's the proof.
For a matrix $X$, let $[X]_{ij}$ denote the $(i,j)$ entry of $X$. Let $A$ be $m\times n$ and $B$ be $n\times m$. Then
\begin{align*}
\mathrm{tr}\,(AB)
&= \sum_{i=1}^n[AB]_{ii} \\
&= \sum_{i=1}^n\sum_{k=1}^m[A]_{ik}\cdot[B]_{ki} \\
&= \sum_{k=1}^m\sum_{i=1}^n[B]_{ki}\cdot[A]_{ik} \\
&= \sum_{k=1}^m[BA]_{kk} \\
&= \mathrm{tr}\,(BA)
\end{align*}
Your question is a special version of this result with $B=A^\top$.
A: All approaches to the question made so far are pretty good. I just want to add a small observation that will make the proof solid.
trace($AA^T$) or trace($A^TA$) is sum of squares of all elements of the matrix $A$ (which is the same as the sum of squares of all elements of the matrix $A^T$).
