I think the question is close to Derivative of trace of inverse of a matrix function
I have a function:
$f(X) = trace(X^TAX)$
And I am trying to derive $df/dX$
Update: I know that, for function $g(X) = X^TAX$
$\frac{dg}{dX} = (A+A^T)X$
Then now I need to calculate $f(g(X))$.
I tried to apply chain-rule:
$\frac{df}{dX} = \frac{df}{dg} * \frac{dg}{dX}$
And we already know $\frac{dg}{dX}$. But what is $\frac{df}{dg}$?
Best Answer
The Frobenius product (:) is a convenient notation for the trace, i.e. $$A:B={\rm tr}(A^TB)$$ Write the function, then find its differential and gradient $$\eqalign{ f &= {\rm tr}(A^TXA) = A:XA = X:AA^T \cr df &= X:(A\,dA^T+dA\,A^T) = (X^TA+XA):dA \cr \frac{\partial f}{\partial A} &= (X^T+X)A \cr }$$ where the cyclic property of the trace were used to rearrange terms in the Frobenius products.