# Divergence of a position vector in spherical coordinates

I know the divergence of any position vectors in spherical coordinates is just simply 3, which represents their dimension. But there's a little thing that confuses me.

The vector field of A is written as follows, ,
and the divergence of a vector field A in spherical coordinates are written as follows , which shows you have to put terms of A related to theta or psi.

However, when you represent a position using a position vector in spherical coordinates, you usually only use r hat simply because r hat includes angle terms already.

Then, when do you use theta or psi terms? And what exactly do A_theta and A_psi term represent when r hat already has the meaning of angles? I have a feeling that they are redundant.

I heard this is related to something called spherical symmetry but wanna understand it strictly. Thanks!

[Moderator's note: Approved as not being homework.]

Last edited by a moderator:

PeroK
Homework Helper
Gold Member
2020 Award
Summary:: I know the divergence of any position vectors in spherical coordinates is just simply 3, which represents their dimension. But there's a little thing that confuses me.

I know the divergence of any position vectors in spherical coordinates is just simply 3, which represents their dimension. But there's a little thing that confuses me.

The vector field of A is written as follows, ,
and the divergence of a vector field A in spherical coordinates are written as follows , which shows you have to put terms of A related to theta or psi.

However, when you represent a position using a position vector in spherical coordinates, you usually only use r hat simply because r hat includes angle terms already.

Then, when do you use theta or psi terms? And what exactly do A_theta and A_psi term represent when r hat already has the meaning of angles? I have a feeling that they are redundant.

I heard this is related to something called spherical symmetry but wanna understand it strictly. Thanks!

[Moderator's note: Approved as not being homework.]

First, a position vector is simply a single vector. You cannot differentiate it or take its divergence. What you can do is define a vector field everywhere with:
$$\vec A(r, \theta, \phi) = \vec r = r \hat r$$
This gives you a vector field that can be differentiated and its divergence is ##3## everywhere. Note also that the divergence of a vector field is a scalar field: i.e. a real-valued function associated with every point.

Now, a vector field can have components in any direction. So, we have in general:
$$\vec A(r, \theta, \phi) = A_r(r, \theta, \phi) \hat r + A_{\theta}(r, \theta, \phi) \hat \theta + A_{\phi}(r, \theta, \phi) \hat \phi$$
In other words, the vector field involves three real-valued functions at each point in space. The field of position vectors is only one example. The divergence of this field is given by the equation you posted.

• Terrycho
First, a position vector is simply a single vector. You cannot differentiate it or take its divergence. What you can do is define a vector field everywhere with:
$$\vec A(r, \theta, \phi) = \vec r = r \hat r$$
This gives you a vector field that can be differentiated and its divergence is ##3## everywhere. Note also that the divergence of a vector field is a scalar field: i.e. a real-valued function associated with every point.

Now, a vector field can have components in any direction. So, we have in general:
$$\vec A(r, \theta, \phi) = A_r(r, \theta, \phi) \hat r + A_{\theta}(r, \theta, \phi) \hat \theta + A_{\phi}(r, \theta, \phi) \hat \phi$$
In other words, the vector field involves three real-valued functions at each point in space. The field of position vectors is only one example. The divergence of this field is given by the equation you posted.
Thank you! So a vector field can be defined as either $$\vec A(r, \theta, \phi) = \vec r = r \hat r$$ or $$\vec A(r, \theta, \phi) = A_r(r, \theta, \phi) \hat r + A_{\theta}(r, \theta, \phi) \hat \theta + A_{\phi}(r, \theta, \phi) \hat \phi$$. Is that right?

Also then, from my understanding, you can always say that
$$A_r(r, \theta, \phi) \ = r$$
, and
$$A_{\theta}(r, \theta, \phi) = A_{\phi}(r, \theta, \phi)=0$$

is this right as well?
If so, is there any case that you have to write $$A_{\theta}(r, \theta, \phi) and A_{\phi}(r, \theta, \phi)$$ that are not zero?

PeroK
Homework Helper
Gold Member
2020 Award
Thank you! So a vector field can be defined as either $$\vec A(r, \theta, \phi) = \vec r = r \hat r$$ or $$\vec A(r, \theta, \phi) = A_r(r, \theta, \phi) \hat r + A_{\theta}(r, \theta, \phi) \hat \theta + A_{\phi}(r, \theta, \phi) \hat \phi$$. Is that right?

Also then, from my understanding, you can always say that
$$A_r(r, \theta, \phi) \ = r$$
, and
$$A_{\theta}(r, \theta, \phi) = A_{\phi}(r, \theta, \phi)=0$$

is this right as well?
If so, is there any case that you have to write $$A_{\theta}(r, \theta, \phi) and A_{\phi}(r, \theta, \phi)$$ that are not zero?

In principle, ##A_r, A_{\theta}, A_{\phi}## can be any functions you like. For example, the vector field could represent the velocity of a fluid at any point.

Often you use spherical coordinates when you have a spherically symmetric field - that's when it's most useful. E.g. the gravitational field might be:
$$\vec g = -\frac{GM}{r^2}\hat r$$
But, any field can be represented in spherical coordinates if you want.

• Terrycho
kuruman
Homework Helper
Gold Member
But, any field can be represented in spherical coordinates if you want.
Any? Even a uniform field? I don't mean to cause trouble, but "any" is too all encompassing without qualifications.

• kent davidge
Meir Achuz
Homework Helper
Gold Member
The divergence of the position vector equals three in any coordinate system.

• jasonRF
Nugatory
Mentor
Any? Even a uniform field? I don't mean to cause trouble, but "any" is too all encompassing without qualifications.
Why not a uniform field? Aside from the coordinate singularity at ##r=0##, it’s just a coordinate transformation, is it not?

• PeroK
kuruman
Homework Helper
Gold Member
Yes, in principle it is "just" a coordinate transformation, I guess. I have no idea though how to proceed to find it. It boggles my mind to imagine how to take ##\vec E=E_0~\hat z## and write it as ##\vec E= E_r(r,\theta,\phi)~\hat r+E_{\theta}(r,\theta,\phi)~\hat \theta+E_{\phi}(r,\theta,\phi)~\hat \phi##. In particular how does one handle the spherical unit vectors the direction of which depends on the spherical angles?

In principle, ##A_r, A_{\theta}, A_{\phi}## can be any functions you like. For example, the vector field could represent the velocity of a fluid at any point.

Often you use spherical coordinates when you have a spherically symmetric field - that's when it's most useful. E.g. the gravitational field might be:
$$\vec g = -\frac{GM}{r^2}\hat r$$
But, any field can be represented in spherical coordinates if you want.
So to let A_θ(r,θ,ϕ)=A_ϕ(r,θ,ϕ)=0, does a field have to be spherically symmetric ,or as you said, you can assign any function?

Last edited:
PeroK
Homework Helper
Gold Member
2020 Award
So to let A_θ(r,θ,ϕ)=A_ϕ(r,θ,ϕ)=0, does a field have to be spherically symmetric ,or as you said, you can assign any function?
If you want an exercise, you could calculate the divergence of:
$$\vec A = (r \cos \theta) \hat r + (r \sin \theta) \hat \theta + (r\sin \theta \cos \phi) \hat \phi$$

• Terrycho
PeroK
Homework Helper
Gold Member
2020 Award
Yes, in principle it is "just" a coordinate transformation, I guess. I have no idea though how to proceed to find it. It boggles my mind to imagine how to take ##\vec E=E_0~\hat z## and write it as ##\vec E= E_r(r,\theta,\phi)~\hat r+E_{\theta}(r,\theta,\phi)~\hat \theta+E_{\phi}(r,\theta,\phi)~\hat \phi##. In particular how does one handle the spherical unit vectors the direction of which depends on the spherical angles?

$$\hat z = \cos \theta \ \hat r - \sin \theta \ \hat \theta$$

If you want an exercise, you could calculate the divergence of:
$$\vec A = (r \cos \theta) \hat r + (r \sin \theta) \hat \theta + (r\sin \theta \cos \phi) \hat \phi$$
Thanks! I guess I was considering some useless stuff haha

PeroK
Homework Helper
Gold Member
2020 Award
Thanks! I guess I was considering some useless stuff haha
Actually, one example is the electric field of a dipole oriented along the z-axis:
$$\vec E = \frac{p}{4\pi \epsilon_0 r^3}(2\cos \theta \ \hat r + \sin \theta \ \hat \theta)$$

PeroK
Homework Helper
Gold Member
2020 Award
Why not a uniform field? Aside from the coordinate singularity at ##r=0##, it’s just a coordinate transformation, is it not?
Actually, the coordinate singularity is the whole z-axis. So, like the dipole example, we perhaps need the field to be in the ##\hat r## direction on the z-axis, where ##\hat \theta## and ##\hat \phi## are not well defined.

Last edited:
kuruman
Homework Helper
Gold Member
$$\hat z = \cos \theta \ \hat r - \sin \theta \ \hat \theta$$
Yes, of course. I tripped over my own feet even though I have taught the conducting sphere in a uniform electric field many times. Must be a subtle effect of home confinement.

• hutchphd and PeroK
If you want an exercise, you could calculate the divergence of:
→A=(rcosθ)^r+(rsinθ)^θ+(rsinθcosϕ)^ϕ

Shouldn't this be →A=(rcosθ)^r+(rsinθsinϕ)^θ+(rsinθcosϕ)^ϕ

PeroK
Homework Helper
Gold Member
2020 Award
If you want an exercise, you could calculate the divergence of:
→A=(rcosθ)^r+(rsinθ)^θ+(rsinθcosϕ)^ϕ

Shouldn't this be →A=(rcosθ)^r+(rsinθsinϕ)^θ+(rsinθcosϕ)^ϕ
Why should it be that?

Sorry and should the unit vectors by x y and z rather than r theta phi

PeroK
Homework Helper
Gold Member
2020 Award
Sorry and should the unit vectors by x y and z rather than r theta phi
Not in spherical coordinates!

Sorry, I was confused. Not the first time I answered off the cuff. I should read all the responses to the original post before answering. I will try to do this in the future.

vanhees71
Gold Member
I'm a bit puzzled about, what this discussion is about. You want to get the divergence of the vector field
$$\vec{A}(\vec{r})=\vec{r}=r \vec{e}_r.$$
The components in spherical orthonormal coordinates thus are
$$A_r=r, \quad A_{\vartheta}=A_{\varphi}=0.$$
Now you can simply take the formula for the divergence given in #1, which simplifies to
$$\vec{\nabla} \cdot \vec{A} =\frac{1}{r^2} \partial_r (r^2 A_r) = \frac{1}{r^2} \partial_r (r^3)=\frac{1}{r^2} 2 r^2 =3,$$
as it must be.

The divergence of a vector field is a scalar field and thus independent of the choice of coordinates used to calculate it. So it's no surprise to get ##3## as when using Cartesian coordinates.

PeroK
Homework Helper
Gold Member
2020 Award

The original question was whether ##\vec A = \vec r## is the only possible vector field expressible in spherical coordinates.

I think it has been shown that it is not the only one.

vanhees71
Gold Member
??? Meir Achuz