[Math] find the gradient of trace of the matrix

derivativeslinear algebramatrices

Prove that $\nabla_A Tr(AA^T) = 2A$, where A is any square matrix

I did simple derivative with product rule,but i don't know where i messed up,

I started with
$\frac{\partial}{\partial A} Tr(AA^T)=Tr(\frac {\partial A}{\partial A}A^T+A\frac {\partial A^T}{\partial A})$
Thanks in Advance..

Best Answer

I'm going to work with square matrices, but it should be easy enough to change the dimensions as you please. Write $A = [\vec x_1 | \cdots | \vec x_n ]$ where each $\vec x_i = [x_{1i}, \ldots, x_{ni}]$. Notice then that the $i^{th}$ diagonal element of $AA^T$ is just $\vec x_i \cdot \vec x_i = x_{1i}^2 + \cdots + x_{ni}^2$. Thus the trace of $AA^T$ is the sum of every element of $A$; namely $$ \operatorname{Tr}(AA^T) = \sum_{i=1}^n \sum_{j=1}^n x_{ij}^2.$$ Now taking $\nabla_A$ will give the desired result.

Related Question