Hessian and gradient of matrices

228 Views Asked by At

Assuming that $f: R^n \rightarrow R$, $a \in R^n$, $g: R\rightarrow R$, and $h: R^n \rightarrow R$

What are the expressions for

  1. $\nabla f(x) $ and $\nabla^2 f(x)$ where $f(x) = g(h(x))$

and

  1. $\nabla f(x) $ and $\nabla^2 f(x) $ where $f(x) = g(a^T x)$
1

There are 1 best solutions below

3
On BEST ANSWER

Assuming everything is smooth, the first question is just an application of the so-called chain-rule: $$\nabla_xf=g'(h(x))\nabla_xh.$$ Using the product rule and once more the chain rule, one gets: $${\nabla^2}_xf=g''(h(x)){}^\intercal\nabla_{x}h\times\nabla_xh+g'(h(x)){\nabla^2}_xh.$$

The second question is just an application of the first one with $h\colon x\mapsto {}^\intercal ax$ which is linear.