# Reference for a derivative formula for matrices

I found the following identity:

$$\frac{\partial( \det (X^T A X ))}{\partial X} = 2\det(X^TAX)AX(X^TAX)^{-1}$$

on the matrix cookbook. It is equation 47 on page 8. Note that $X$ is an $n \times m$ matrix and $A$ is a symmetric $n \times n$ matrix.

I could not find the identity in their cited references. Does anyone know of a textbook or paper that has this identity?

NOTE: I asked this question on Mathoverflow and was advised to repost it here.

-
This may help: psi.toronto.edu/matrix/calculus.html, also this one psi.toronto.edu/matrix/calculus.html –  chaohuang Aug 29 '12 at 16:30
Thanks, I was looking for a textbook or paper so I can cite it, but I E-mailed Mike Brooks -- the author of the page you recommended -- for a (citable) reference –  dblazevski Aug 29 '12 at 16:36
You can also cite online links. –  chaohuang Aug 29 '12 at 16:38
True, but I'd prefer to have a more standard reference that has been through a review process, one that may even include a derivation. –  dblazevski Aug 29 '12 at 16:40
I looked in vain for a similar result back in 1997, and ended up writing it up for myself. (But this was for teaching, not research.) My formula can be written as $(d/dt)\ln\det\Phi(t)=\operatorname{tr}(\Phi(t)^{-1}\dot\Phi(t)$, where $\Phi$ is a matrix valued function of a single variable and the dot denotes a derivative. Your result should be derivable from that, with $\Phi=X^TAX$ and $t$ being the various components of $X$ in turn. –  Harald Hanche-Olsen Aug 29 '12 at 18:24

Of course we must assume $X^T A X$ is invertible for this equation to make sense.
Take $\tilde{X} = X + t Y$. Then \eqalign{\tilde{X}^T A \tilde{X} &= X^T A X + t (Y^T A X + X^T A Y) + O(t^2)\cr &= \left(I + t (Y^T A X + X^T A Y)(X^T A X)^{-1}\right) X^T A X + O(t^2)\cr} so $\det(\tilde{X}^T A \tilde{X}) = \det(I + tM) \det(X^T A X) + O(t^2)$ where $M = (Y^T A X + X^T A Y)(X^T A X)^{-1}$. Now $\det(I+tM) = \det(\exp(tM)) + O(t^2) = \exp(\text{tr}(tM)) + O(t^2) = 1 + t\; \text{tr}(M) + O(t^2)$. We have \eqalign{\text{tr}(M) &= \text{tr}(Y^T A X (X^T A X)^{-1} + X^T A Y (X^T A X)^{-1})\cr &= \text{tr}(Y^T A X (X^T A X)^{-1}) + \text{tr}((X^T A X)^{-1} X^T A Y)\cr &= 2 \text{tr}(Y^T A X (X^T A X)^{-1})} Taking $Y = E_{ij}$, the matrix with $1$ in entry $(i,j)$ and $0$ everywhere else, this says $$\frac{\partial}{\partial X_{ij}} \det(X^T A X) = 2 \text{tr}(E_{ji} A X (X^TAX)^{-1}) \det(X^T A X) = 2 \det(X^T A X) (A X (X^T A X)^{-1})_{ij}$$ which is the meaning of $$\frac{\partial}{\partial X} \det(X^T A X) = 2 \det(X^T A X) A X (X^T A X)^{-1}$$
Thank you very much! I tried using the chain rule (applied to $D_x (det(x)) = det(x) x^{-T}$ and index notation, but was left with headache. –  dblazevski Aug 29 '12 at 18:30
The requested formula is absolutely incorrect. Let $\phi:X\rightarrow X^TAX=U\rightarrow \det(X^TAX)$. The hypothesis $X^TAX$ invertible is useless. $U'_X:H\rightarrow 2X^TAH$ and $\phi'(X):H\rightarrow tr(adj(U)U'(H))$ (where $adj(U)$ is the classical adjoint of $U$). Finally $\phi'(X)(H)=2tr(adj(X^TAX)X^TAH)$. In particular $\phi'(X)=0$ iff $adj(X^TAX)X^TA=0$.