# How to calculate the following $\frac{\partial}{\partial x} \log (\det X(x))$?

How to calculate the following

$$\frac{\partial}{\partial x} \log (\det X(x))$$

where $X$ is a matrix in $\mathbb{R}^{n\times n}$ which is a function of $x\in \mathbb{R}^d$?

• Do you know how to express a determinant as a sum? It will be a step in the right direction (Jacobi's formula). Also know that "inner times outer" applies here as well. – Michael Paris Jul 23 '18 at 6:26
• @MichaelParis, no, I don't know. Would you please explain a little? – user85361 Jul 23 '18 at 6:53
• en.m.wikipedia.org/wiki/Jacobi%27s_formula. The determinant of a matrix has a couple of useful representations as a sum, one of which can be used to simplify your expression – Michael Paris Jul 23 '18 at 6:57

$$\frac{\partial}{\partial x}log(det(X(x))) = \frac{1}{det(X(x))} tr\left(adj(X(x)) dX(x)\right)$$ Edit:

"d" implies the gradient operator in the covariant form, which acts on the provided (1,1)-tensor in the usual way, making it a (2,1)-tensor.

• Do we have $X(x) \frac{\partial}{\partial x}log(det(X(x)))= tr(\frac{\partial}{\partial x}X(x))$ – user85361 Jul 23 '18 at 7:17
• Is the result a vector or a matrix? What is the dimension of the result? – user85361 Jul 23 '18 at 7:29
• It's just in \mathrm{R} – Michael Paris Jul 23 '18 at 7:34
• $\mathrm{R}$? How it is possible that a derivative with respect to a vector becomes only in $\mathrm{R}$.? – user85361 Jul 23 '18 at 7:39
• Oh, my bad. Should be in R^d then. Didn't notice that x \in R^d. – Michael Paris Jul 23 '18 at 7:41

The gradient of $\log \det X$ with respect to the entries of $X$ is $X^{-1}$, so the total derivative with respect to $x$ is $\sum_i \sum_j (X^{-1}(x))_{ij} (X'_{ij}(x))$. Here, $X_{ij}(x)$ denotes the $i,j$-entry of $X(x)$, and $X'_{ij}$ denotes the derivative of this entry with respect to $x$. $X^{-1}(x)$ denotes the matrix inverse of $X(x)$.

• Thank you. Although it must be very easy, I'm a little confused. Could you please show it in matrix notation form? – user85361 Jul 23 '18 at 6:52