Derivative of $(uA+C)^{-1}\mathbf{b}$ w.r.t. $u\in\mathbb{R}$

Given that $$(uA+C)\mathbf{x}=\mathbf{b}$$ where only $$u\in \mathbb{R}$$ and $$\mathbf{x}\in\mathbb{R}^n$$ are unknowns, and where $$(uA+C)\in\mathbb{R}^{n\times n}$$ is an invertible matrix, how can I determine $$\frac{d\mathbf{x}}{du}$$?

I rewrite the equation to $$\mathbf{x}=(uA+C)^{-1}\mathbf{b}$$

and wonder whether there is any way to find/simplify

$$\frac{d}{du}(uA+C)^{-1}\mathbf{b}$$

Background

In my particular case $$(uA+C)\mathbf{x} = \mathbf{b}$$ comes from

$$\begin{bmatrix} -x_1 & -y_1 & -1 & 0 & 0 & 0 & x_1x_1' & y_1x_1' & x_1' \\ 0 & 0 & 0 & -x_1 & -y_1 & -1 & x_1y_1' & y_1y_1' & y_1' \\ -x_2 & -y_2 & -1 & 0 & 0 & 0 & x_2x_2' & y_2x_2' & x_2' \\ 0 & 0 & 0 & -x_2 & -y_2 & -1 & x_2y_2' & y_2y_2' & y_2' \\ -x_3 & -y_3 & -1 & 0 & 0 & 0 & x_3x_3' & y_3x_3' & x_3' \\ 0 & 0 & 0 & -x_3 & -y_3 & -1 & x_3y_3' & y_3y_3' & y_3' \\ -x_4 & -y_4 & -1 & 0 & 0 & 0 & x_4x_4' & y_4x_4' & x_4' \\ 0 & 0 & 0 & -x_4 & -y_4 & -1 & x_4y_4' & y_4y_4' & y_4' \\ 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 1\\ \end{bmatrix} \begin{bmatrix}h1 \\ h2 \\ h3 \\ h4 \\ h5 \\ h6 \\ h7 \\ h8 \\h9 \end{bmatrix} = \begin{bmatrix}0 \\ 0 \\ 0 \\ 0 \\ 0 \\ 0 \\ 0 \\ 0 \\1 \end{bmatrix}$$

(which comes from here)

where $$u$$ is one of $$x_1'$$, $$y_1'$$, $$x_2'$$, $$y_2'$$, $$x_3'$$, $$y_3'$$, $$x_4'$$, $$y_4'$$. For example, for $$u\equiv x_1'$$ we have

$$A = \begin{bmatrix} 0 & 0 & 0 & 0 & 0 & 0 & x_1 & y_1 & 1 \\ 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ \end{bmatrix}$$

Edit

I vaguely remember a technique called implicit differentiation which I feel may be useful:

$$\frac{d}{du}(uA+C)\mathbf{x}=\frac{d}{du}\mathbf{b}$$ $$\frac{d}{du}uA\mathbf{x}+\frac{d}{du}C\mathbf{x}=\mathbf{0}$$ $$A\frac{d}{du}u\mathbf{x}+C\frac{d\mathbf{x}}{du}=\mathbf{0}$$ $$A(\mathbf{x}+u\frac{d\mathbf{x}}{du})+C\frac{d\mathbf{x}}{du}=\mathbf{0}$$ $$A\mathbf{x}+(uA+C)\frac{d\mathbf{x}}{du}=\mathbf{0}$$ $$\frac{d\mathbf{x}}{du}=-(uA+C)^{-1}A\mathbf{x}$$

... did I just solve it; is this correct?

• Yes, you just solved it! – Robert Lewis Apr 26 '20 at 0:20

Define $$\,M=(C+uA)\,$$ then the given equation becomes $$\,Mx=b$$

Differentiate the equation (with respect to $$u)\,$$ then solve for $$\dot x=\left(\frac{dx}{du}\right)$$ \eqalign{ \dot Mx + M\dot x = \dot b \\ Ax + M\dot x = 0 \\ \dot x = -M^{-1}Ax \\ } This is indeed the implicit differentiation technique that you remembered.

Hint Since $$b$$ does not depend on $$u$$, $$\frac{d}{du}[(u A + C)^{-1} {\bf b}] = \frac{d}{du}[(u A + C)^{-1}] {\bf b} ,$$ and so it suffices to know how to compute the derivative $$\frac{d}{du} [P(u)^{-1}]$$ inverse of a matrix function $$P : \Bbb R \to M_n (\Bbb R)$$ (wherever that inverse is defined).

We we can find $$\frac{d}{du}(P(u)^{-1})$$ in terms of $$P$$ and $$\frac{d P}{dt}$$ by differentiating both sides of $$P(u) P(u)^{-1} = I$$ and isolating $$\frac{d}{du}[P(u)^{-1}]$$.

Suppressing the argument $$u$$, we have $$\frac{dP}{du} P^{-1} + P \frac{d}{du} (P^{-1}) ,$$ so $$\frac{d}{du} (P^{-1}) = - P^{-1} \frac{dP}{du} P^{-1} .$$

$$(uA + C)\mathbf x = \mathbf b; \tag 1$$

since $$(uA + C)$$ is invertible we may directly write

$$\mathbf x = (uA + C)^{-1} \mathbf b \tag 2$$

which expresses $$\mathbf x$$ as a function of $$u$$; then

$$\mathbf x' = ((uA + C)^{-1})' \mathbf b; \tag 3$$

we may compute $$((uA + C)^{-1})'$$ as follows: for any parametrized invertible matrix $$Y(u)$$ we write

$$YY^{-1} = I, \tag 4$$

and differentiate:

$$Y'Y^{-1} + Y(Y^{-1})'= 0, \tag 5$$

or

$$Y'Y^{-1} = -Y(Y^{-1})', \tag 6$$

from which we immediately obtain

$$(Y^{-1})' = -Y^{-1}Y'Y^{-1}; \tag 7$$

taking

$$Y(u) = uA + C \tag 8$$

we arrive at

$$((uA + C)^{-1})' = (uA + C)^{-1}A(uA + C)^{-1}, \tag 9$$

whence from (3)

$$\mathbf x' = (uA + C)^{-1} A (uA + C)^{-1} \mathbf b, \tag{10}$$

and in light of (2),

$$\mathbf x' = (uA + C)^{-1} A \mathbf x. \tag{11}$$

There is in fact a much shorter route to this result if one accepts that $$\mathbf x(u)$$ is differentiable, as has indeed been proved in the above; in that event we may simply differentiate (1) and find

$$(uA + C)'\mathbf x + (uA + C)\mathbf x' = 0, \tag{12}$$

whence we directly write

$$\mathbf x' = -(uA + C)^{-1}A \mathbf x, \tag{13}$$

and via (1),

$$\mathbf x' = -(uA + C)^{-1}A (uA + C)^{-1} \mathbf b. \tag{14}$$