# Divergence of a vector

1. Jan 9, 2005

### meteorologist1

Hi, I'm doing a problem of finding the divergence of a radius vector from the origin to any point in Cartesian, cylindrical, and spherical coordinates. The answers look kind of strange to me. I just want to make sure what I did was correct.

To find: $$\nabla\cdot \vec{r}$$

Cartesian: r = (x, y, z). I got the answer to be 3.

Cylindrical: r = (rho, phi, z). I got the answer to be 3 + 1/rho

Spherical: r = (r, theta, phi). I got the answer to be 3 + (1/r sin(theta))(sin(theta) + theta cos(theta) + 1).

Thanks.

2. Jan 9, 2005

### quasar987

3 ?! Could you show how you got to that answer please?

3. Jan 9, 2005

### marlon

That is correct since $$\vec{\nabla} \cdot \vec{r} = \frac{\partial x}{\partial x} + \frac{\partial y}{\partial y} + \frac{\partial z}{\partial z} = 3$$

marlon

4. Jan 9, 2005

Daniel.

5. Jan 9, 2005

### vincentchan

all answers should be the same.....

6. Jan 9, 2005

### meteorologist1

For the Cartesian:

$$\nabla\cdot \vec{r} = (\vec{i}\partial/\partial x + \vec{j}\partial / \partial y + \vec{k}\partial / \partial z) \cdot (\vec{i} x + \vec{j} y + \vec{k} z) =$$
$$\partial/\partial x (x) + \partial/\partial y (y) + \partial/\partial z (z) = 1 + 1 + 1 = 3$$

The other two cylindrical and spherical, I did the same way. But I used the $$\nabla\cdot \vec{r}$$ for cylindrical and spherical which I referred to in a handbook.

Last edited: Jan 9, 2005
7. Jan 9, 2005

### meteorologist1

Could you show me how to get "3" for the cylindrical and spherical? Thanks.

8. Jan 9, 2005

### Galileo

In cylindrical coordinates:
$$\vec r = \rho \hat \rho + z \hat z$$
and
$$\nabla \cdot \vec v(\rho,\phi,z) = \frac{1}{\rho}\frac{\partial}{\partial \rho}(\rho v_{\rho})+\frac{1}{\rho}\frac{\partial v_{\phi}}{\partial \phi}+\frac{\partial v_z}{\partial z}$$
For some vector function $v=\langle v_{\rho},v_{\phi},v_z \rangle$

In spherical coordinates:

$$\vec r = r\hat r$$
and
$$\nabla \cdot \vec v(r,\theta,\phi)=\frac{1}{r^2}\frac{\partial}{\partial r}(r^2v_r)+\frac{1}{r\sin \theta}\frac{\partial}{\partial \theta}(\sin \theta v_{\theta})+\frac{1}{r\sin \theta}\frac{\partial v_{\phi}}{\partial \phi}$$
for some vector function $v=\langle v_r,v_{\theta},v_{\phi} \rangle$

Both give 3 as well:

$$\nabla \cdot \vec r(\rho,\phi,z) =\frac{1}{\rho}\frac{\partial}{\partial \rho}(\rho \rho)+\frac{\partial z}{\partial z}=\frac{1}{\rho}2\rho+1=3$$

$$\nabla \cdot \vec r(r,\theta,\phi)=\frac{1}{r^2}\frac{\partial}{\partial r}(r^2 r)=\frac{1}{r^2}3r^2=3$$

You can't use the divergence in cylindrical or spherical coordinates when r=0 though.

Last edited: Jan 9, 2005
9. Jan 9, 2005

### meteorologist1

Thanks very much. It looks like the reason I got the wrong answers is because I got the r vectors wrong in cylindrical and spherical coordinates. I need to get this straight.

I would like to ask another question related to these two coordinates:
In cylindrical coordinates,
If $$\vec{A} = a\vec{\rho} + b\vec{\phi} + c\vec{z}$$ where a, b, c are constants, is $$\vec{A}$$ a constant vector?

Similarly in spherical coordinates,
If $$\vec{A} = a\vec{r} + b\vec{\theta} + c\vec{\phi}$$ where a, b, c are constants, is $$\vec{A}$$ a constant vector?

10. Jan 9, 2005

### vincentchan

your question doesn't make any sense, if a,b,c are constant, sure A is constant. If not, it's not.....

11. Jan 9, 2005

### meteorologist1

I'm asking because when I converted A to Cartesian coordinates, it doesn't look constant anymore. Another way of asking the question is: Is $$\vec{A}$$ a uniform vector field?

12. Jan 9, 2005

### dextercioby

Not exactly and not always true.U need the unit vectors (basis vectors) to be constant in all systems of coordinates.Par éxample,write the second law of dynamics for a free body moving on a spere in cartesian coordinates and in spherical coordinates.
$$\vec{F}=m\vec{a} =0$$

Tell me if u notice something weird...
Voilà.My point exactly.It all depends on whether the g_{ij}'s are constant or not.

Daniel.

13. Jan 9, 2005

### vincentchan

his question is, in the following case....
$$\vec{A} = a\vec{\rho} + b\vec{\phi} + c\vec{z}$$

is A constant or not, sure we assume $$\vec{\rho}, \vec{\phi}, \vec{z}$$ define as usual which IS constant....

14. Jan 9, 2005

### dextercioby

What do u mean,"the usual way"??If they are constant and the components are constant,then the whole cevor is constant,of course.

Daniel.

15. Jan 10, 2005

### Galileo

I think confusion has arised because of the way the question is posted.
I think you meant to say: "Is $\vec A$ a constant vector field. The answer is no.
This is because spherical and cylindrical coordinates have at least one unit vector which is not constant. The Cartesian coordinate system is the only one for which all three unit vectors are constant.

It's for example easy to see for the field:

$$\vec A(r,\theta,\phi) = \hat r$$
This is a radial field. The magnitude is 1 everywhere, but the direction changes. It points along the +x-axis in the point (1,0,0), but it points along the +y direction in the point (0,1,0).

16. Feb 13, 2010

### Deluxe LY

Thanks all for the clarification, but, in the spherical coordinates system, how the second part went to zero?

I mean this whole part:

\frac{1}{r\sin \theta}\frac{\partial}{\partial \theta}(\sin \theta v_{\theta})+\frac{1}{r\sin \theta}\frac{\partial v_{\phi}}{\partial \phi}
[/tex]