# Formula for gradient of composite function

• Apr 22nd 2009, 04:45 PM
Formula for gradient of composite function
Suppose that $\displaystyle f: \mathbb {R}^n \rightarrow \mathbb {R}$ and $\displaystyle g: \mathbb {R} \rightarrow \mathbb {R}$

Find a formula for $\displaystyle \nabla (g \circ f)(x)$

I have $\displaystyle \nabla (g \circ f) = ( \frac { \partial (g \circ f) }{ \partial x_1 }(x),..., \frac { \partial (g \circ f) }{ \partial x_n }(x) )$

=$\displaystyle ( \frac { \partial g (f(x)) }{ \partial x_1} \frac { \partial f}{ \partial x_1 }(x),...,\frac { \partial g (f(x)) }{ \partial x_n} \frac { \partial f}{ \partial x_n }(x))$
$\displaystyle = \nabla g(f(x)) \nabla f(x)$,

is this right? Thanks.
• Apr 22nd 2009, 07:29 PM
NonCommAlg
Quote:

Find a formula for $\displaystyle \nabla (g \circ f)(x)$
I have $\displaystyle \nabla (g \circ f) = ( \frac { \partial (g \circ f) }{ \partial x_1 }(x),..., \frac { \partial (g \circ f) }{ \partial x_n }(x) )$
=$\displaystyle ( \frac { \partial g (f(x)) }{ \partial x_1} \frac { \partial f}{ \partial x_1 }(x),...,\frac { \partial g (f(x)) }{ \partial x_n} \frac { \partial f}{ \partial x_n }(x))$
$\displaystyle = \nabla g(f(x)) \nabla f(x)$,
i don't think so! since $\displaystyle g \circ f$ is a map from a subset of $\displaystyle \mathbb{R}^n$ to $\displaystyle \mathbb{R},$ we need $\displaystyle f$ to be a map from a subset of $\displaystyle \mathbb{R}^n$ to $\displaystyle \mathbb{R}$ and $\displaystyle g$ a map from the image of $\displaystyle f,$ which is a subset of $\displaystyle \mathbb{R},$ to $\displaystyle \mathbb{R}.$