# Homework Help: Find gradient in spherical and cartesian coordinates

1. Oct 4, 2009

### naele

1. The problem statement, all variables and given/known data
Find the gradient of $3r^2$ in spherical coordinates, then do it in Cartesian coordinates

2. Relevant equations
$$\nabla f=\hat r \frac{\partial f}{\partial r} + \hat \theta \frac{1}{r} \frac{\partial f}{\partial \theta}+ \hat \phi \frac{1}{r\sin \theta}\frac{\partial f}{\partial \phi}$$
$$z=r \cos \theta$$

3. The attempt at a solution

Since there's no $\theta, \phi$ then the gradient is simply $6r \hat r$. Transforming to cartesian coordinates gives $$\frac{z}{6}\hat z$$ because cos 0 = 1. Any of the other coordinate transforms involve $\sin \theta$ or $\sin \phi$ so z is the only non-zero coordinate.

Last edited: Oct 4, 2009
2. Oct 4, 2009

### Dick

Are you given that theta=0? If so that's ok, except how did the 6 move from the numerator to the denominator?

3. Oct 4, 2009

### naele

It wasn't necessarily given, I just assumed it was since the $3r^2$ has no theta or phi term to just consider them as zero when I took the gradient. That second part with z/6 I suspect is completely wrong because I don't understand how to transform from spherical to cartesian.

4. Oct 4, 2009

### Dick

Then you can't put theta=0. $6 r \hat r$ is fine. What's r in cartesian coordinates? What's $\hat r$ in cartesian coordinates? You must know at least one of those. Look them up if you don't. Alternatively, express 3r^2 in cartesian coordinates and do it directly.

5. Oct 4, 2009

### naele

r is just the magnitude so in Cartesian that's $$\sqrt{x^2 + y^2 +z^2}$$. I think that $$\hat r = \sin \theta \cos \phi \hat x + \sin \theta \sin \phi \hat y + \cos \theta \hat z$$

6. Oct 4, 2009

### Dick

That's ok. Then 3r^2=3*(x^2+y^2+z^2). Can you use that to find the gradient directly in cartesian coordinates? But why not write
$$\hat r = \sin \theta \cos \phi \hat x + \sin \theta \sin \phi \hat y + \cos \theta \hat z$$
as
$$\hat r = (x \hat x + y \hat y + z \hat z)/r$$
That's the same thing isn't it?

7. Oct 4, 2009

### naele

Yes, I see it now. Doing it both ways gives me the same result
$$6x \hat x + 6y \hat y + 6z \hat z$$