# Formula for Nth Derivative of Matrix Inverse

I was looking for an equation for the nth derivative of a matrix inverse, ie

$\frac{d^n \bf{A}^{-1}}{dx^n}$

I know that the first derivative

$\frac{\text{d} \bf{A}^{-1}}{\text{d}x} = -\bf{A}^{-1} \frac{\text{d} \bf{A}}{\text{d} x} \bf{A}^{-1}$

But is there some sort of generalization of this without having to chain/product rule it?

-

Assuming $A: \mathbb{R} \rightarrow \mathbb{R}^{ n \times n}$ is smooth and $A$ is invertible near the point of differentiation. We have $AA^{-1}=I$ hence $$\frac{dA}{dx}A^{-1}+A\frac{dA^{-1}}{dx} = 0$$ from which we deduce $$\frac{dA^{-1}}{dx} = -A^{-1}\frac{dA}{dx}A^{-1}$$ Differentiating once again, (I know, I'm not doing what you want... but I want to understand not just say the answer) \begin{align} \frac{d^2A^{-1}}{dx^2} &= -\frac{dA^{-1}}{dx}\frac{dA}{dx}A^{-1}+ -A^{-1}\frac{d^2A}{dx^2}A^{-1}-A^{-1}\frac{dA}{dx}\frac{dA^{-1}}{dx} \\ &= A^{-1}\frac{dA}{dx}A^{-1}\frac{dA}{dx}A^{-1} -A^{-1}\frac{d^2A}{dx^2}A^{-1}+A^{-1}\frac{dA}{dx}A^{-1}\frac{dA}{dx}A^{-1} \\ &= 2A^{-1}\frac{dA}{dx}A^{-1}\frac{dA}{dx}A^{-1} -A^{-1}\frac{d^2A}{dx^2}A^{-1} \ \ \ \star \end{align} In contrast, we could have differentiated $AA^{-1}=I$ twice $$\frac{d^2A}{dx^2}A^{-1}+2\frac{dA}{dx}\frac{dA^{-1}}{dx}+A\frac{d^2A^{-1}}{dx^2} = 0 \ \ \ \star^2$$ So, we again find $\star$. Differentiate $\star^2$ once more: $$\frac{d^3A}{dx^3}A^{-1}+3\frac{d^2A}{dx^2}\frac{dA^{-1}}{dx}+3\frac{dA}{dx}\frac{d^2A^{-1}}{dx^2}+A\frac{d^3A^{-1}}{dx^3} = 0 \ \ \ \star^3$$ So, solve for $\frac{d^3A^{-1}}{dx^3}$, \begin{align} \frac{d^3A^{-1}}{dx^3} &= -A^{-1}\frac{d^3A}{dx^3}A^{-1}-3A^{-1}\frac{d^2A}{dx^2}\frac{dA^{-1}}{dx}-3A^{-1}\frac{dA}{dx}\frac{d^2A^{-1}}{dx^2} \\ &=-A^{-1}\frac{d^3A}{dx^3}A^{-1}-3A^{-1}\frac{d^2A}{dx^2}\left[-A^{-1}\frac{dA}{dx}A^{-1} \right] \\ & \ \ \ -3A^{-1}\frac{dA}{dx}\left[ 2A^{-1}\frac{dA}{dx}A^{-1}\frac{dA}{dx}A^{-1} -A^{-1}\frac{d^2A}{dx^2}A^{-1} \right] \\ &= -A^{-1}\frac{d^3A}{dx^3}A^{-1} + 3A^{-1}\frac{d^2A}{dx^2}A^{-1}\frac{dA}{dx}A^{-1} \\ & \ \ \ \qquad \qquad \qquad + 3A^{-1}\frac{dA}{dx} A^{-1}\frac{d^2A}{dx^2}A^{-1} \\ & \ \ \ \qquad \qquad \qquad - 6A^{-1}\frac{dA}{dx}A^{-1}\frac{dA}{dx}A^{-1}\frac{dA}{dx}A^{-1} \end{align} I think you might start to see a pattern here? I'd rather not write it in general. But, the result is perhaps clear now? $$\frac{d^nA^{-1}}{dx^n} = -A^{-1}\frac{d^nA}{dx^n}A^{-1}+ \cdots + (-1)^n \, n!\underbrace{A^{-1}\frac{dA}{dx}A^{-1} \cdots \frac{dA}{dx}A^{-1}}_{2n+1 \ factors}$$ where of the $2n+1$ factors we have $n$ copies of $\frac{dA}{dx}$ and $n+1$ copies of $A^{-1}$.

-

Let $A(t)$ be any matrix valued function which is invertible and both it and its inverse are real analytic on a neighbor of $t = 0$. For small $t$, we have:

\begin{align} A^{-1}(t) = A(t)^{-1} = & \left[ A(0) + \sum_{c=1}^{\infty} \frac{A^{(c)}(0)}{c!} t^c \right]^{-1}\\ = & \left[ \left( I + \sum_{c=1}^{\infty} \frac{A^{(c)}(0) A^{-1}(0)}{c!} t^c \right) A(0) \right]^{-1}\\ = & A^{-1}(0) + A^{-1}(0) \sum_{s=1}^{\infty}(-1)^s \left( \prod_{i=1}^{s} \frac{A^{(c_i)}(0) A^{-1}(0)}{c_i!}\right) t^{\sum_{i=1}^s c_i} \end{align} For simplicity of further discussion, we will use $A, A^{-1}$ and $A^{(c)}$ as a short hand for their value evaluated at $0$. If one compare above expansion with the regular taylor series expansion of $A^{-1}(t)$ at $t = 0$, we find for $n \ge 1$, $$\frac{d^n A^{-1}}{dt^n} = n!\sum_{s=1}^n (-1)^s\!\!\!\!\sum_{\stackrel{1 \le c_1,\ldots,c_s \le n}{c_1+\cdots+c_s=n}} \left\{A^{-1} \prod_{i=1}^{s} \left( \frac{A^{(c_s)}}{c_s!} A^{-1}\right)\right\}$$ Or expanding everyting out, \begin{align} \frac{d^n A^{-1}}{dx^n} = - A^{-1}A^{(n)}A^{-1} & + \;\;\sum_{\stackrel{1 \le c_1, c_2 < n}{c_1+c_2 = n}}\frac{n!}{c_1!c_2!}A^{-1}A^{(c_1)} A^{-1} A^{(c_2)} A^{-1}\\ & - \sum_{\stackrel{1 \le c_1, c_2, c_3 < n}{c_1+c_2+c_3=n}}\frac{n!}{c_1!c_2!c_3!}A^{-1}A^{(c_1)} A^{-1} A^{(c_2)}A^{-1} A^{(c_3)} A^{-1}\\ & \;\;\vdots \end{align} The recipe is you find all possible ways of writing $n$ as a sum of positive integers $c_1, c_2, \ldots, c_s$, calculate corresponding derivatives $A^{(c_1)}, A^{(c_2)}, \ldots$, sandwiching and join them by a bunch of $A^{-1}$. Multiply each factor by $\displaystyle (-1)^s \frac{n!}{\prod_{i=1}^{s}c_s!}$ and sum the resulting mess.

Please note that when $A(t)$ is not real analytic, above derivation of course no longer works. However, the above recipe of writing down the expansion continues to work. You can derive them the hard way by repeat application of chain rule.

-
How do you remove the inverse going from the second to the third equality? I'd like to understand your calculation. –  James S. Cook Sep 1 '13 at 18:03
@JamesS.Cook Aside from the issues of convergence, one has: $$((I+B)A)^{-1} = A^{-1}(I+B)^{-1} = A^{-1}(I - B + B^2 - B^3 + \cdots )\\ =A^{-1} + A^{-1}\sum_{s=1}^{\infty}(-1)^sB^s$$ When $B$ itself is $\displaystyle \sum_{i=1} C_i$, we can expand $\displaystyle B^s = \left(\sum_{i=1} C_i \right)^s = \sum_{1\le c_1, c_2\ldots c_s}\prod_{i=1}^s C_{c_i}$. –  achille hui Sep 1 '13 at 18:18
Thanks! So basically, it's a formal geometric series and Cauchy product. –  James S. Cook Sep 1 '13 at 19:08
@JamesS.Cook Yup. The only purpose of it is to provide a way to figure out the correct factor $\frac{n!}{c_1!c_2!\cdots c_s!}$ in front of those products of $A^{c_i}$ and $A^{-1}$. –  achille hui Sep 1 '13 at 19:18