0

Let $A$ and $X$ be two symmetric (semi)positive definite matrices, I was wondering how to calculate the gradient with respect to $X$ of

$$ X \mapsto \log\det(A+X),$$

where $\det$ is the determinant of a matrix.

In the second order case, let $X\in \mathbb{R}^{m\times n}$ ($m>n$) be a rectangle matrix, $A$ and $B$ are $m\times m$ and $n\times n$ symmetric (semi)positive definite matrices. Then, what is the gradient of

$$ X \mapsto \log \det \left( X B X^\top + A \right) $$

with respect to $X$?

1 Answers1

3

Define a new (symmetric) matrix $$\eqalign{ Y &= (X+A) \implies dY = dX \cr }$$ Write the function in terms of this new variable. Then find its differential and gradient. $$\eqalign{ \phi &= \log\big(\det(Y)\big) \cr d\phi &= d\log(\det(Y)) = d\,{\rm tr}(\log(Y)) = Y^{-1}:dY \cr &= (X+A)^{-1}:dX \cr \frac{\partial\phi}{\partial X} &= (X+A)^{-1} \cr }$$ For the second problem let $$\eqalign{ Y &= (XBX^T+A) \cr dY &= (dX\,BX^T + XB\,dX^T) = 2\,{\rm sym}(dX\,BX^T) \cr }$$ Then $$\eqalign{ \phi &= \log\big(\det(Y)\big) \cr d\phi &= Y^{-1}:dY \cr &= Y^{-1}:2\,{\rm sym}(dX\,BX^T) \cr &= 2Y^{-1}:dX\,BX^T \cr &= 2Y^{-1}XB:dX \cr &= 2(XBX^T+A)^{-1}XB:dX \cr \frac{\partial\phi}{\partial X} &= 2(XBX^T+A)^{-1}XB \cr \cr }$$ In some of the steps above, a colon was used to represent the trace/Frobenius product $$A:B = {\rm tr}(A^TB)$$ and sym to represent the function $${\rm sym}(A) = \frac{1}{2}(A+A^T)$$

frank
  • 541
  • 1
    Thanks a lot for the help! Is there any (introductory-level) textbook I can read to learn matrix calculus? – user3138073 Apr 08 '18 at 23:59
  • Hello @frank, I really find your solutions similar to the other like greg's in https://math.stackexchange.com/questions/1217908/matrix-derivatives-of-determinant-and-inverse-related-to-mathbfx-mathbfx quite fascinating. Is there a textbook that teaches you this general procedure of yours? – venrey Mar 31 '19 at 07:45