Gradient of two dependent coordinates

51 Views Asked by At

What is the right way to calculate the gradient of a function $f(r)$, where $r$ is a function of $\theta$?

$\nabla f=\frac{df}{dr}\hat{r}+\frac{1}{r}\frac{df}{d\theta}\hat{\theta}$

Should I once take the derivative of $f$ with respect to $r$, once with respect to $\theta$ - and plug those in the term for the gradient, because $r$ and $\theta$ are two different coordinates, or should I only take the derivative with respect to $\theta$, because bottom line $f$ is a function of $\theta$?

For example - what is the right way to calculate the gradient of the following function: $f(r)=r^2$, $r(\theta)=2\theta$.

Is it - $\nabla f=2r\hat{r}+4\hat{\theta}$, or - $\nabla f=4\hat{\theta}$? why?

Another question - when is it ok to take only the derivative with respect to $r$? I'm asking this because of an exercise I had, in which it was done.

Thanks in advance!

1

There are 1 best solutions below

1
On

As long as $f=f(r)$ and $r=r(\theta)$ you can solve it by chain rule: $\frac{df}{d\theta}=\frac{df}{dr}\frac{dr}{d\theta}$

For your problem, it will be like below:

$\nabla f=\frac{df}{dr}\hat{r}+\frac{1}{r}\frac{df}{d\theta}\hat{\theta}=\frac{df}{dr}\hat{r}+\frac{1}{r}\frac{df}{dr}\frac{dr}{d\theta}\hat{\theta}=\frac{df}{dr}( \hat r+\frac{1}{r} \frac{dr}{d\theta}\hat{\theta})$

And for your example:

$\nabla f=\frac{df}{dr}(\hat r+\frac{1}{r} \frac{dr}{d\theta}\hat{\theta})=2r(\hat r+\frac1r 2 \hat \theta)=2r\hat r+\frac4r\hat \theta$