0
$\begingroup$

Dear Matrix Calculus Experts,

What is the derivative of $\mbox{tr}\left\{ X^T A X^{-1} B\right\}$ with respect to matrix $X$ for a given $A$ and $B$ matrices?


I came across http://www.matrixcalculus.org/, which can compute it for me (not sure either whether it is correct), i.e., \begin{align} \nabla_{X} \ \mbox{tr}\left\{ X^T A X^{-1} B\right\} = AX^{-1}B - X^{-T}A^TXB^TX^{-T}. \end{align}

However, I would be happy to know the derivation steps. Could you experts please help me how to derive this?

Thank you so much in advance,

$\endgroup$
1
  • $\begingroup$ How is your matrix derivative defined? Assuming that it boils down to the ordinary derivative in the case of $1\times1$ matrices, the result cannot be true. $\endgroup$
    – user431008
    May 21 '18 at 15:09
1
$\begingroup$

If we denote the trace/Frobenius product with a colon, i.e. $$A:B = {\rm tr}(A^TB)$$ then the function can be written as $$\phi = X:AX^{-1}B$$ The differential of the matrix inverse can be calculated from first principles $$\eqalign{ I &= X^{-1}X \cr 0 &= dX^{-1}\,X+X^{-1}\,dX \cr dX^{-1} &= -X^{-1}\,dX\,X^{-1} \cr }$$ and this can be used to find the differential and gradient of the function $$\eqalign{ d\phi &= dX:AX^{-1}B + X:A\,dX^{-1}B \cr &= AX^{-1}B:dX - A^TXB^T:X^{-1}\,dX\,X^{-1} \cr &= \Big(AX^{-1}B - X^{-T}A^TXB^TX^{-T}\Big):dX \cr \frac{\partial\phi}{\partial X} &= AX^{-1}B - X^{-T}A^TXB^TX^{-T} \cr }$$ This differs from the result you quoted in the sign of the second term.

$\endgroup$
1
  • $\begingroup$ Thank you so much. Sorry, there was a typo. So, apparently, it does match. $\endgroup$
    – user550103
    May 21 '18 at 19:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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