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

Some basic question about matrix calculus. Let $X$, $A$, $B$ be real matrices. Let $\operatorname{Tr}$ denote trace. Is \begin{equation} \frac{d }{dX} \operatorname{Tr}(X^T A XB) \end{equation} equal $(A+ A^T)XB$?

If not, How to compute it?

share|cite|improve this question
What exactly do you mean? Are you looking for the differenial $d_{X_0}\phi$ of the map $\phi:M_n(\mathbb R)\rightarrow \mathbb R,~X\mapsto \mathrm{Tr}(X^tAXB)$ at some point (i.e. matrix) $X_0$? If so, the answer will be a linear map from the matrices to the real numbers, not a matrix. You should proceed by steps. What is the differential of the matrix product inside the trace? What is the differential of the trace function? Then combine the two using the chain rule. – Olivier Bégassat Jul 7 '12 at 2:26
$\frac{d}{dX}$ is not notation that would universally make sense to mathematicians when $X$ is a matrix. That notation is only universally understood when $X$ takes numerical values. One reason for this is that $dX$ conceptually needs to be something "very small" that you could divide by; you cannot divide by matrices. – alex.jordan Jul 7 '12 at 7:21
I would disagree. The notation is fairly standard. – copper.hat Jul 7 '12 at 7:33

The derivative of $F:X\mapsto X^T A X B =: F(X)$ is $$D_V F (X) = V^TAXB+ X^TAVB$$ while the derivative of $Y\mapsto Tr(Y)$ is simply

$$D_V Tr(X)= Tr (V)$$ Hence the derivative of your function is $$D_V (Tr\circ F)(X) =DTr(F(X))D_VF(X) = Tr(V^TAXB+ X^TAVB)$$

share|cite|improve this answer
Using the various trace identities, you could also write $\mathbb{tr}(V^TAXB+ X^TAVB) = \mathbb{tr}((AXB+A^T X B^T)^T V)$, which shows that the 'gradient' is $AXB+A^T X B^T$. – copper.hat Jul 7 '12 at 7:53

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.