Chain rule deriviation

148 Views Asked by At

Given gradient and hessian of $\phi$ and the first and second derivatives of $h$ I would like to find the gradient and hessian matrix of $f$

$f(x)=h(\phi(x))$

Where $f:R^n \longrightarrow R$

$\phi:R^n \longrightarrow R$

$h:R \longrightarrow R$

According to the chain rule: $\nabla f = h'(\phi(x))\nabla\phi(x)$ Is it correct and trivial and doesn't need any other proof? And how can I find the hessian of $f$?

1

There are 1 best solutions below

0
On BEST ANSWER

Since

$$f(x_1,x_2,...,x_n)=h(\phi(x_1,x_2,...,x_n))$$

by chain rule we have that

$$\frac{\partial f}{\partial x_i}=h'(\phi(\vec x))\frac{\partial \phi}{\partial x_i}\implies \nabla f(\vec x) = h'(\phi(\vec x))\nabla\phi(\vec x)$$

For the Hessian note that

$$\frac{\partial^2 f}{\partial x_i^2}=h''(\phi(\vec x))\left(\frac{\partial \phi}{\partial x_i}\right)^2+h'(\phi(\vec x))\frac{\partial^2 \phi}{\partial x_i^2}$$

$$\frac{\partial^2 f}{\partial x_ix_j}=h''(\phi(\vec x))\frac{\partial \phi}{\partial x_i}\frac{\partial \phi}{\partial x_j}+h'(\phi(\vec x))\frac{\partial^2 \phi}{\partial x_ix_j}$$