# Differentiation Involving Determinant.

I have to compute the following differentiation :

$$\frac{\partial}{\partial\sigma^2}\det[\mathbf X_{p\times n}'(\sigma^2 \mathbf I_{n}+\mathbf Z_{n\times q}\mathbf G_{q\times q}\mathbf Z_{q\times n}')^{-1}\mathbf X_{n\times p}],$$

where $\sigma^2$ is a scalar, $\det$ denotes determinant, $\mathbf I_{n}$ is a $n\times n$ identity matrix. Note that, $\mathbf X$, $\mathbf Z$, and $\mathbf G$ do NOT involve $\sigma^2$.

How can I do that?

We assume that $p\leq n$ and $rank(X)=p$.
Let $U=X^T(\sigma^2 \mathbf I_{n}+\mathbf Z_{n\times q}\mathbf G_{q\times q}\mathbf Z_{q\times n}^T)^{-1}X$ and $f(\sigma^2)=\det(U)$.
Then $\dfrac{\partial f}{\partial\sigma^2}=tr(\dfrac{\partial U}{\partial\sigma^2}adj(U))$ where
$\dfrac{\partial U}{\partial\sigma^2}=-X^T(\sigma^2 \mathbf I_{n}+\mathbf Z_{n\times q}\mathbf G_{q\times q}\mathbf Z_{q\times n}^T)^{-2}X$.