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

I've been poking through SEE's Machine learning notes and am having difficulty proving the relationship:

Gradient, $\nabla$, of the trace $\operatorname{tr}(A \cdot B \cdot A^{T} \cdot C$) with respect to $A = C \cdot A \cdot B$ + $C^{T} \cdot A \cdot B^{T}$

I tried writing the gradient of the trace as a bunch of nested sums but am having difficulty doing it with 4 matrices. I was wondering if there is an easier approach to proving the relationship.

Thanks! S.

share|cite|improve this question
Thanks Robert Israel, I feel dumb now :). Also thanks Amzoti for fixing my ugly notation, will try better next time. – Sasho Jan 16 '13 at 6:15
up vote 2 down vote accepted

Note that $\text{tr}(AB) = \sum_i \sum_j A_{ij} B_{ji}$ so $\dfrac{\partial}{\partial A_{ij}} \text{tr}(AB) = B_{ji}$, i.e. $\text{grad}_A \text{tr}(AB) = B'$. Thus $ \text{grad}_A \text{tr}(ABDC) = (BDC)'=C'D'B'$, while $\text{grad}_A \text{tr}(DBA'C) = \text{grad}_A \text{tr}(CDBA') = \text{grad}_A \text{tr}(AB'D'C') = (B'D'C')' = CDB$. So (substituting $A'$ for $D$ in the first and $A$ for $D$ in the second), $\text{grad}_A \text{tr}(ABA'C) = C'AB' + CAB$.

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.