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

• please write up the pieces of your proof and some one will make it solid... good luck! – user87543 Jan 30 '14 at 6:35
• rearrange terms. Both are the same expression. – voldemort Jan 30 '14 at 7:03
• @b00n, re-read your formula. – Martín-Blas Pérez Pinilla Jan 30 '14 at 8:52
• Thank you @Martín-BlasPérezPinilla! How naive of mine – b00n heT Jan 30 '14 at 8:55
• Well, was true! :-) – Martín-Blas Pérez Pinilla Jan 30 '14 at 8:57

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.

• Thank you, I have working for hours on hours so I sort of derped out and over looked the obvious. – e2DAeyePi Jan 30 '14 at 7:10
• @e2DAeyePi To make it a little more concrete, try writing each expression as a double sum in $\Sigma$ notation. If you're consistent with how you form the sums, you should get the same for each expression except that the order of summation is swapped. – G. H. Faust Jan 30 '14 at 7:18

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

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