# Matrix derivative [closed]

I am confused with some matrix derivative. For instance, I would like to differentiate a'Xa with respect to X where a is nx1 vector and X is nxn matrix. Is there any known results for such derivative?

• This question may be off-topic here. Perhaps you can find a good explanation on math.stackexchange.com. Dec 3 '16 at 9:21

There is. Note that $a'Xa=tr(a'Xa)$ since the expression is scalar. This implies, using the properties of the trace:
$$\frac{\partial a'Xa}{\partial X} = \frac{\partial tr(a'Xa)}{\partial X} = \frac{\partial tr(Xaa')}{\partial X}$$
Now since $tr(XB)=\sum_{i=1}^n\sum_{j=1}^nx_{ij}b_{ji}$, you can see that the $i,j$-th directional derivative of $tr(XA)$ is $b_{ji}$. Since all directional derivatives exist and are continuous, $\frac{\partial tr(Xaa')}{\partial X}$ exists and equals $aa'$.