What is the derivative of the $(m,n)^{th}$ element of the inverse, $X^{-1}$, with respect to the $(i,j)^{th}$ element of $X$?
i.e. what is;
$$\frac{\partial X^{-1}_{mn}}{\partial X_{ij}}$$
Is it true that;
$$\frac{\partial A^{-1}_{mn}}{\partial A_{ij}}=-\sum_k \sum_l A^{-1}_{mk} \frac{\partial A_{kl}}{\partial A_{ij}} A^{-1}_{ln}=-A^{-1}_{mi}A^{-1}_{jn}$$