# Derivative of determinant of symmetric matrix wrt a scalar

For a given square symmetric invertible matrix $\mathbf{X}$ and scalar $\alpha$ (such that the entries of $\mathbf{X}$ depend on $\alpha$), I would like to use the following well-known expression for the derivative of the determinant wrt a scalar (e.g. see wikipedia):

$$\frac{\partial}{\partial \alpha} \det(\mathbf{X}) = \det(\mathbf{X}) \operatorname{tr} \left( \mathbf{X}^{-1} \frac{\partial \mathbf{X}}{\partial \alpha} \right)$$

However, I am concerned that this expression may not apply when there exists any kind of special "structure" in the matrix (e.g. an $n \times n$ symmetric matrix contains fewer than $n^2$ independent entries).

Consider for a moment another situation, where such structure matters: differentiating the determinant wrt the matrix entries (instead of a scalar). First, let $\mathbf{Y}$ be a square invertible "unstructured" matrix (i.e. all elements are independent). It is well-known (e.g. see The Matrix Cookbook section 2.1.2, or wikipedia) that, in this case:

$$\frac{\partial}{\partial \mathbf{Y}} \det(\mathbf{Y}) = \det(\mathbf{Y}) \, (\mathbf{Y}^{-1})^T$$

Now consider $\mathbf{X}$ again, a square symmetric matrix. In this case, the entries are no longer independent (as described in The Matrix Cookbook, beginning of section 2.8), so we have instead (see section 2.8.2 for the symmetric case):

$$\frac{\partial}{\partial \mathbf{X}} \det(\mathbf{X}) = \det(\mathbf{X}) \, (2 \mathbf{X}^{-1} - (\mathbf{X}^{-1} \circ \mathbf{I}))$$

So, when differentiating the determinant wrt matrix entries, the matrix structure clearly matters.

Here is my question: when differentiating a matrix determinant wrt a scalar, does the matrix structure matter? And if so, what is the correct expression for $\frac{\partial}{\partial \alpha} \det(\mathbf{X})$ for the specific case where $\mathbf{X}$ is symmetric?

## 1 Answer

Let's look at what happens when derivative of the determinant of an invertible matrix $A$ with respect to itself. Apparently, the result is a matrix, say $D$, then we have $$D^q_p=\left(\frac{\partial\det A}{\partial A}\right)^q_p=\frac{\partial(\epsilon_{i_1\ldots i_n}a^{i_1}_1\cdots a^{i_n}_n)}{\partial a^p_q}$$ where $\epsilon$ is Levi-Civita symbol and Einstein notation is used. If $A$ has no special structure that each of $n^2$ components are seen as independent, we can proceed to $$D^q_p=\epsilon_{i_1\ldots i_n}a_1^{i_1}\cdots\frac{\partial a^{i_p}_q}{\partial a^p_q}\cdots a_n^{i_n}$$ However when $A=A^T$ is symmetric, each product has 2 terms that depend on $a^p_q$, hence $$D^q_p=\epsilon_{i_1\ldots i_n}\left(a_1^{i_1}\cdots\frac{\partial a^{i_p}_p}{\partial a^p_q}\cdots a^{i_q}_q\cdots a_n^{i_n}+a_1^{i_1}\cdots a^{i_p}_p\cdots\frac{\partial a^{i_q}_q}{\partial a^p_q}\cdots a_n^{i_n}\right)$$ This leads to different forms of derivative. Yet it is now clear that the derivative of an invertible matrix w.r.t a scalar doesn't depend on its structure.