To compute the gradient of the expression ( s = (J^\top J + k I)^{-1} J^\top e ) with respect to the parameter vector ( x ), where ( e ) and ( J ) are functions of ( x ), we need to apply matrix calculus, considering the dependencies of ( e ) and ( J ) on ( x ).
Here’s a step-by-step derivation:
Step 1: Recognize Dependencies
First, note that:
- ( s ) is a function of ( x ) through ( J(x) ) and ( e(x) ).
- ( J ) is the Jacobian matrix where ( J_{pi} = \frac{\partial e_p}{\partial x_i} ).
- ( e ) is the vector of residuals, depending on ( x ).
Step 2: Set Up the Gradient Calculation
We can express the gradient ( \nabla_x s ) as:
[
\nabla_x s = -A^{-1} (\nabla_x A) A^{-1} B + A^{-1} (\nabla_x B)
]
where:
- ( A = J^\top J + k I ), so ( \nabla_x A = \nabla_x (J^\top J) ) (since ( k I ) does not depend on ( x )).
- ( B = J^\top e ), so ( \nabla_x B ) must be calculated considering the dependencies of both ( J ) and ( e ) on ( x ).
Step 3: Compute ( \nabla_x A ) and ( \nabla_x B )
For ( \nabla_x A ):
[
\frac{\partial A_{ij}}{\partial x_l} = \frac{\partial}{\partial x_l} (J^\top J){ij} = \sum_p \left( \frac{\partial J{pi}}{\partial x_l} J_{pj} + J_{pi} \frac{\partial J_{pj}}{\partial x_l} \right)
]
Similarly, for ( \nabla_x B ):
[
\frac{\partial B_i}{\partial x_l} = \frac{\partial}{\partial x_l} (J^\top e)i = \sum_p \left( \frac{\partial J{pi}}{\partial x_l} e_p + J_{pi} \frac{\partial e_p}{\partial x_l} \right)
]
Given that:
- ( \frac{\partial J_{pi}}{\partial x_l} = \frac{\partial^2 e_p}{\partial x_l \partial x_i} = H_{p i l} ), where ( H_{p i l} ) is the Hessian of ( e_p ) with respect to ( x_i ) and ( x_l ).
- ( \frac{\partial e_p}{\partial x_l} = J_{pl} ).
Substituting back:
[
\frac{\partial A_{ij}}{\partial x_l} = \sum_p \left( H_{p i l} J_{p j} + J_{p i} H_{p j l} \right)
]
[
\frac{\partial B_i}{\partial x_l} = \sum_p \left( H_{p i l} e_p + J_{p i} J_{p l} \right)
]
Step 4: Assemble the Gradient
Substituting ( \nabla_x A ) and ( \nabla_x B ) back into the expression for ( \nabla_x s ):
[
\nabla_x s = -A^{-1} (\nabla_x A) A^{-1} B + A^{-1} (\nabla_x B)
]
This gives the explicit form of the gradient, accounting for all dependencies on ( x ):
[
\boxed{\nabla_x [ (J^\top J + k I )^{-1} J^\top e ] = - (J^\top J + k I )^{-1} [\nabla_x ( J^\top J ) ] (J^\top J + k I )^{-1} J^\top e + (J^\top J + k I )^{-1} \nabla_x ( J^\top e )}
]
Note: This gradient involves higher-order derivatives (the Hessian of ( e )) due to the dependence of ( J ) and ( e ) on ( x ). This expression fully encapsulates the required computations for the gradient of the given expression.
Final Answer:
An explicit expression:
[ \nabla_x \left[, (J^{\top}J + kI)^{-1} J^{\top} e ,\right]
= - (J^{\top}J + kI)^{-1} \left[, \nabla_x(J^{\top}J) ,\right] (J^{\top}J + kI)^{-1} J^{\top} e
+ (J^{\top}J + kI)^{-1} \left[, \nabla_x(J^{\top} e) ,\right] ]