Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

Suppose I have a vector field $\vec g (\vec x)$, which is fed into a scalar field $f(\vec x)$. I am trying to work out how compute the gradient $\nabla f(\vec g(\vec x))$. I figure some form of the chain rule applies but am having difficulty working it out.

Calculus is still little rusty so I'm trying to break it down and figure it out by its components:

$$\nabla f(\vec g(\vec x)) =\left\langle\frac{d}{dx} f(\vec g(\vec x)), \frac{d}{dy}f(\vec g(\vec x)), \frac{d}{dz} f(\vec g(\vec x))\right\rangle$$

And I (naively?) try to invoke the chain rule as normal:

$$=\left\langle f_x(\vec g(\vec x)) \frac{d}{dx} \vec g(\vec x), f_y(\vec g(\vec x)) \frac{d}{dy} \vec g(\vec x), f_z(\vec g(\vec x))\frac{d}{dz} \vec g(\vec x)\right\rangle$$

However, already I see I have a problem since in each of my components I have a scalar value multiplied by a vector -- and I know the gradient of a scalar field is supposed to be a vector field, not a matrix field. So this makes me think I should be taking the derivatives of the respective $(x,y,z)$ components of $\vec g(\vec x)$:

$$=\left\langle f_x(\vec g(\vec x)) \frac{d}{dx} \vec g_x(\vec x), f_y(\vec g(\vec x)) \frac{d}{dy} \vec g_y(\vec x), f_z(\vec g(\vec x))\frac{d}{dz} \vec g_z(\vec x)\right\rangle$$

So now this looks a little messy and I don't have a sound reason for why that would happen, making me think it's probably wrong. Could someone point me in the right direction?

share|improve this question
add comment

1 Answer

up vote 0 down vote accepted

Write $x_1,x_2,x_3$ instead of $x,y,z$ and $\vec{g}=\langle g_1,g_2,g_3 \rangle$. The derivative of $\vec{g}$ is a $3\times 3$ matrix. The $i$th, $j$th entry is $$ \frac{\partial g_i}{\partial x_j}. $$ Call this matrix $[g]$. The derivative of $f$ is a $1\times 3$ matrix, the gradient of $f$. Then the gradient of the composition will be $$ [g]\cdot \nabla f $$ where the $\cdot$ is matrix multiplication. Thus your gradient is $$ \left\langle \sum_{i=1}^3 \frac{\partial f}{\partial x_i}\frac{\partial g_i}{\partial x_1},\sum_{i=1}^3 \frac{\partial f}{\partial x_i}\frac{\partial g_i}{\partial x_2},\sum_{i=1}^3 \frac{\partial f}{\partial x_i}\frac{\partial g_i}{\partial x_3} \right\rangle. $$

share|improve this answer
    
OK, this makes sense, though I take it the first expression ought to be dgi/dxj, right? –  OEP Jan 21 '13 at 20:16
    
@OEP Yes, fixed. –  Joe Johnson 126 Jan 21 '13 at 20:56
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.