Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How to prove that

$$\frac{\partial \mathrm{Trace}(ABA^T)}{\partial A}= AB+AB^T$$

if $A$,$B$ are square matrices. Can I write the following:

Let $C=BA^T$. Then,

$$\frac {\partial \mathrm{Trace}(AC)}{\partial A}+A\frac {\partial \mathrm{Trace}(C)}{\partial A} = C^T + AB = AB^T + AB$$

and what is the answer of $\frac{\partial \mathrm{Trace}(A^TBA)}{\partial A}$?

Thank you~

share|cite|improve this question
Hint: write out the definitions of matrix product, trace and partial differentiation in full. The rest is straightforward calculation. – Marek Jun 18 '11 at 14:13
Your notation being highly non standard, you should explain the definition of the object $\partial\varphi(A)/\partial A$ for $\varphi:M_{n\times n}(\mathbb{R})\to\mathbb{R}$ and $A$ in $M_{n\times n}(\mathbb{R})$. Or read this:… – Did Jun 18 '11 at 17:53
up vote 2 down vote accepted

Just add the indices. In the formulae above, the doubly repeated indices are automatically summed over, using the Einstein sum rule. Note that ${\rm Tr} M = M_{ii}$ and $(MN)_{ij} = M_{ik}N_{kj}$.

The first derivative of the trace is $$ \frac{\partial A_{ab}B_{bc}A^T_{ca} }{\partial A_{ij}} = \frac{\partial A_{ab}B_{bc}A_{ac} }{\partial A_{ij}} =$$ $$= \delta_{ai}\delta_{bj} B_{bc} A_{ac} + A_{ab} B_{bc} \delta_{ai}\delta_{cj} = B_{jc}A_{ic} + A_{ib}B_{bj} = (AB^T)_{ij} + (AB)_{ij} $$ so by removing the indices $ij$ again, you see that the "matrix derivative" is $AB^T+AB$. Similarly, $$ \frac{\partial A^T_{ab}B_{bc}A_{ca} }{\partial A_{ij}} = \frac{\partial A_{ba}B_{bc}A_{ca} }{\partial A_{ij}} = \delta_{bi}\delta_{aj} B_{bc} A_{ca} + A_{ba} B_{bc} \delta_{ci}\delta_{aj} =$$ $$ = B_{ic}A_{cj} + A_{bj}B_{bi} = (BA)_{ij} + (B^T A)_{ij} $$ so the second result is $BA+B^TA$.

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.