# Computing the gradient of a function depending on the eigenvalue and eigenvector of a matrix.

I have a real, scalar-valued function for which I would like to compute the gradient.

Let $\xi = [\omega^T, \tau^T]^T$ be a 6-vector in $se(3)$, the Lie algebra associated with $SE(3)$, the Special Euclidean group for dimension 3, with $\omega \in so(3)$ and $\tau \in \mathbb{R}^3$.

Let $\exp$ be the exponential map from a Lie algebra to its respective manifold.

My function is:

$$f(\xi) = (c + \lambda^2)^{-\frac{1}{2}} u^T (\exp(\xi)\boxplus\mu_1 + \mu_2)$$

where:

• $\boxplus$ is the rigid transformation operator of applying a rigid transformation in $SE(3)$ on a 3-vector,

• $\lambda$ is the smallest eigenvalue of a $3\times 3$ real, symmetric, positive-semidefinite matrix $S = \exp(\omega) S_1 \exp(-\omega) + S_2$,

• $\mu_1, \mu_2$ are constant real-valued 3-vectors,

• $u$ is the eigenvector corresponding to $\lambda$,

• $S_1$, $S_2$ are $3\times 3$ constant real, symmetric, positive-semidefinite matrices, and

• $c$ is a constant scalar.

Now, what is the gradient $\nabla f(\xi)$ at $\xi = 0$?

My strategy right now is:

• Use the product rule $f = f_1 f_2 f_3$, $$f' = f_2^T f_3 f_1' + f_1 f_3^T f_2' + f_1 f_2^T f_3'$$ with $f_1(\xi) = (C_1 + \lambda^2)^{-\frac{1}{2}}$ and $f_2 = u$ and $f_3 = \exp(\xi)\boxplus\mu_1 + \mu_2$
• Use Theorem 1 from On Differentiating Eigenvalues and Eigenvectors to differentiate $f_1$ and $f_2$ with respect to $S$:

\begin{align} \frac{\partial f_1}{\partial \xi}&=\frac{\partial f_1}{\partial \lambda}\frac{\partial \lambda}{\partial \operatorname{vec}(S)}\frac{\partial \operatorname{vec}(S)}{\partial \xi}\\ &=-\lambda (c + \lambda^2)^{-\frac{3}{2}} (u^T \otimes u^T) \frac{\partial \operatorname{vec}(S)}{\partial \xi} \end{align} \begin{align} \frac{\partial f_2}{\partial \xi}&=\frac{\partial f_2}{\partial u}\frac{\partial u}{\partial \operatorname{vec}(S)}\frac{\partial \operatorname{vec}(S)}{\partial \xi}\\ &=(u^T \otimes(\lambda I - S)^{-1}) \frac{\partial \operatorname{vec}(S)}{\partial \xi} \end{align}

• Use derivatives of exponential maps of $SO(3)$ and $SE(3)$ from A Tutorial on SE(3) Transformation Parametrizations and On-Manifold Optimization to differentiate $S$ and $f_3$ with respect to $\xi$. $$\frac{\partial f_3}{\partial \xi} = \begin{bmatrix}-[\mu_1]_\times & I\end{bmatrix}$$ \begin{align}\frac{\partial \operatorname{vec}(S)}{\partial \xi} = \begin{bmatrix}\frac{\partial \operatorname{vec}(S)}{\partial \omega} & \mathbf{0}\end{bmatrix}\end{align} \begin{align}\frac{\partial \operatorname{vec}(S)}{\partial \omega} &= \begin{bmatrix}-[S_{11}]_\times\\ -[S_{12}]_\times\\ -[S_{13}]_\times\end{bmatrix} \exp(-\omega) + \operatorname{vec}(\exp(\omega) S_1) \begin{bmatrix} +[\mathbf{e}_1]_\times\\ +[\mathbf{e}_2]_\times\\ +[\mathbf{e}_3]_\times \end{bmatrix} \end{align} where $\otimes$ is the Kronecker product, $S_{11}, S_{12}, S_{13}$ are the columns of $S_1$ and $\mathbf e$ are the basis vectors and $[x]_\times$ is the skew-symmetric matrix form of the cross product of $x$.

Is this all correct?