# Derivative of the inverse of a matrix

In a scientific paper, I’ve seen the following

$$δK−1δp=−K−1δKδpK−1\frac{\delta K^{-1}}{\delta p} = -K^{-1}\frac{\delta K}{\delta p}K^{-1}$$

where $$KK$$ is a $$n×nn \times n$$ matrix that depends on $$pp$$. In my calculations I would have done the following

$$δK−1δp=−K−2δKδp=−K−TK−1δKδp\frac{\delta K^{-1}}{\delta p} = -K^{-2}\frac{\delta K}{\delta p}=-K^{-T}K^{-1}\frac{\delta K}{\delta p}$$

Is my calculation wrong?

Note: I think $$KK$$ is symmetric.

The major trouble in matrix calculus is that the things are no longer commuting, but one tends to use formulae from the scalar function calculus like $(x(t)^{-1})'=-x(t)^{-2}x'(t)$ replacing $x$ with the matrix $K$. One has to be more careful here and pay attention to the order. The easiest way to get the derivative of the inverse is to derivate the identity $I=KK^{-1}$ respecting the order
Solving this equation with respect to $(K^{-1})'$ (again paying attention to the order (!)) will give