Recently i have some derivatives with matrix to work with. For Example:
$$\det \pmb{XA}$$ And i need to find the derivative with respect to $\mathbf{X}$.
From Matrix cookbook i have $$\frac{\partial\ \det (\mathbf{Y})} {\partial x}= \det (\mathbf{Y}) Tr \left[ \mathbf{Y}^{-1} \frac{\partial\ \mathbf{Y}} {\partial x}\right]$$
So if: $$\mathbf{Y} = \mathbf{XA}$$
$$\frac{\partial\ \mathbf{Y}} {\partial x}=\frac{\partial\ \mathbf{X}} {\partial x} \mathbf{A}$$
Then $$\frac{\partial\ \det (\mathbf{XA})} {\partial x}= \det (\mathbf{XA}) Tr \left[ (\mathbf{XA})^{-1} \frac{\partial\ \mathbf{X}} {\partial x} \mathbf{A} \right]$$
From cyclic property of trace: $$\frac{\partial\ \det (\mathbf{XA})} {\partial x}= \det (\mathbf{XA}) Tr \left[ \mathbf{A} (\mathbf{XA})^{-1} \frac{\partial\ \mathbf{X}} {\partial x} \right]$$
How can i proced with the $\frac{\partial\ \mathbf{X}} {\partial x} ?$ If i want relative to $\mathbf{X}$ can i do $\frac{\partial\ \mathbf{X}} {\partial \mathbf{X}}= \mathbf{I}$ ? So that :
$$\frac{\partial\ \det (\mathbf{XA})} {\partial \mathbf{X}}= \det (\mathbf{XA}) Tr \left[ \mathbf{A} (\mathbf{XA})^{-1} \right] ?$$
I ask this because i see some other questions here and them just trow the Trace operator away like:
$$\frac{\partial\ \det (\mathbf{XA})} {\partial \mathbf{X}}= \det (\mathbf{XA}) \mathbf{A} (\mathbf{XA})^{-1} $$
How is that possible?
Any help is apreciated also books recomendations of the subject!
Let $M = XA$ and $f = \det(M)$ (assuming $M$ is invertible).
Utilizing Jacobi's formula, the differential of $f$ is \begin{align} df = d \det(M) = {\rm tr} \left( {\rm adj} \left(M \right) dM\right) = \det \left( M \right) {\rm tr} \left( M^{-1} dM\right) . \end{align}
And, $dM = dX A$.
Moreover, we will utilize the following the identities as well
We compute the differential of $f$ first and then the gradient.
So, \begin{align} df &= d \det \left( M \right) \\ &= \det(M) {\rm tr} \left( M^{-1} dM \right) \\ &= \det(M) \left[ M^{-T} \ : \ dM \right]\hspace{8mm} \text{note: utilized trace and Frobenius relation} \\ &= \det(M) \left[ M^{-T} \ : \ dX A \right] \\ &= \det(M) \left[ M^{-T} A^T \ : \ dX \right] \hspace{8mm} \text{note: utilized cyclic property of Frobenius product} \\ \end{align}
Hence, the gradient is \begin{align} \frac{\partial}{\partial X} f = \frac{\partial}{\partial X} \det \left( XA \right) &= \det(M) M^{-T} A^T = \det\left( X A\right) \left( X A \right)^{-T} A^T.\\ \end{align}
Also, following the above procedure, one could show that \begin{align} \frac{\partial}{\partial X} f &= \frac{\partial}{\partial X} \det \left( XA \right) \\ &= \det\left( X A\right) \left( X A \right)^{-T} A^T \\ &= {\rm adj}\left( XA \right)^T A^T . \end{align}