Derivative of matrix-valued function with respect to scalar

calculusderivativeslinear algebramatricesmatrix-calculus

Given vector $\mu \in \Bbb R^n$ and $n \times n$ matrices $A$ and $\Sigma$, let matrix-valued function $F : \Bbb R \to \Bbb R^{n \times n}$ be defined by

$$F(t) := |(I-2tA\Sigma)|^{1/2} \exp \left(\frac{1}{2}\mu'[I-(I-2tA\Sigma)^{-1})\Sigma^{-1}\mu \right)$$

How can I get the second derivative of $F$ with respect to $t$? Could someone please give me a hint?

Best Answer

Try matrixcalculus.org. Entering

det(eye-2*t*A*S)^(1/2)*exp((1/2) * v'*(eye-inv(eye-2*t*A*S)*inv(S))*v)

yields

function: $$ f = \mathrm{det}(\mathbb{I}-2\cdot t\cdot A\cdot S)^{(1/2)}\cdot \exp(1/2\cdot v^\top \cdot (\mathbb{I}-\mathrm{inv}(\mathbb{I}-2\cdot t\cdot A\cdot S)\cdot \mathrm{inv}(S))\cdot v) $$

gradient: $$\begin{aligned} \frac{\partial f}{\partial t} = &-(\mathrm{det}(\mathbb{I}-2\cdot t\cdot A\cdot S)^{(1/2-1)}\cdot \exp((v^\top \cdot (\mathbb{I}-\mathrm{inv}(\mathbb{I}-2\cdot t\cdot A\cdot S)\cdot \mathrm{inv}(S))\cdot v)/2)\cdot \mathrm{tr}(A\cdot S\cdot \mathrm{adj}(\mathbb{I}-2\cdot t\cdot A\cdot S)) \\&+\mathrm{det}(\mathbb{I}-2\cdot t\cdot A\cdot S)^{(1/2)}\cdot \exp((v^\top \cdot (\mathbb{I}-\mathrm{inv}(\mathbb{I}-2\cdot t\cdot A\cdot S)\cdot \mathrm{inv}(S))\cdot v)/2)\cdot v^\top \cdot \mathrm{inv}(\mathbb{I}-2\cdot t\cdot A\cdot S)\cdot A\cdot S\cdot \mathrm{inv}(\mathbb{I}-2\cdot t\cdot A\cdot S)\cdot \mathrm{inv}(S)\cdot v) \end{aligned}$$

You can try plugging this result back into the engine.