# How to calculate correctly the gradient of log det $\psi(x)$ matrix?

I have a function: $$\psi(t) = \frac{1}{2} \ln det\left(-\frac{\Omega(t)^{-1}}{2}\right)$$ where $$\Omega(t)$$ is a symmetric matrix semi-definite positive of size $$k$$. When I want to calculate the gradient, I have three different solutions, so I would like to know what mistakes I have made, what is the correct solution (for me case(1))

To calculate the gradient $$[\ln det(X)]$$ where $$X$$ is a matrix, I used , where $$[\nabla \ln det(X)] = X^{-1}$$

Case (1): Using the fact that $$det(a\Sigma) = a^k det(\Sigma)$$ where $$a$$ is a constant and $$\Sigma$$ a matrix of size $$k \times k$$, and : \begin{align} \psi(t) &= \frac{1}{2} \left[ \ln \frac{1}{(-2)^k} - \ln det(\Omega(t)) \right]\\ \nabla_t \psi(t) &= - \frac{\Omega(t)^{-1}}{2}\\ \end{align}

Case (2): Using the fact that $$det(A^{-1}) = det(A)^{-1}$$, $$\ln det(A)^{-1} = -\ln det(A)$$ and : \begin{align} \psi(t) &= -\frac{1}{2} \ln det(-2\Omega(t))\\ \nabla_t \psi(t) &= \frac{\Omega(t)^{-1}}{4}\\ \end{align}

Case(3): Using the fact that $$\Xi(t) = (-2\Omega(t))^{-1}$$ and : \begin{align} \psi(t) &= \frac{1}{2} \ln det(\Xi(t))\\ \nabla_t \psi(t) &= \frac{1}{2} \Xi(t)^{-1} = -\Omega(t) \\ \end{align}

• All of your cases attempt to calculate $\frac{\partial\psi}{\partial\Omega}$ but your question (and nabla notation) suggest that you actually wanted to calculate $$\nabla_t\phi=\frac{d\psi}{dt} = -\tfrac{1}{2}{\rm Tr}\big(\Omega^{-1}\tfrac{\partial\Omega}{\partial t}\big)$$ – greg Mar 11 at 19:13

Another way to solve this is by a change of variables.

You already know that for symmetric matrices

$$d \operatorname{logdet}(X) = X^{-1} : dX$$

Let $$U = -\frac{1}{2}\Omega^{-1}; \quad U^{-1}=-2\Omega$$

then $$dU = \frac{1}{2}{\Omega^{-1} d\Omega \Omega^{-1}}$$

We have that

\eqalign{ \phi &= \frac{1}{2} \operatorname{logdet}U \\ d\phi &= \frac{1}{2}U^{-1} : dU \\ &=-\Omega : \frac{1}{2}\Omega^{-1}d\Omega\Omega^{-1} \\ &=-\frac{1}{2}\Omega^{-1} : d\Omega }

Thus $$\frac{\partial \phi}{\partial \Omega}= -\frac{1}{2}\Omega^{-1}$$