# Formula for gradient of composite function

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

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

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

= $( \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))$
$= \nabla g(f(x)) \nabla f(x)$,

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

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