How to integrate a vector function in spherical coordinates?

In my specific case, it's an electric field on the axis of charged ring (see image below), the integral is pretty easy, but I don't understand how handle the vector $(r,\theta,\phi)$ while integrating over $\phi$.

I tried the following:

$$\vec{E}=\int\limits_{Q}{\frac{kdq}{\|\vec{r}\|^3}\vec{r}}$$ $$ =\int_0^{2\pi}{\frac{k\lambda \vec{r}sin\theta d\phi}{\|\vec{r}\|^3}\vec{r}}$$ $$ =\int_0^{2\pi}{\frac{k\lambda Rd\phi}{\|\vec{r}\|^3}\vec{r}}$$ $$ =\frac{k\lambda R}{\|\vec{r}\|^3}\int_0^{2\pi}{\vec{r}d\phi} $$

Now, if I convert $\vec{r}$ to $(x,y,z)$ coordinates and integrate it's ok:

$$\int_0^{2\pi}{\vec{r}d\phi}=\int_0^{2\pi}{r(sin\theta cos\phi,sin\theta sin\phi,cos\theta)d\phi} = 2\pi r(0,0,cos\theta)=2\pi z\hat{z} $$

Putting it in the original expression will give the correct result.

But trying to do the following in spherical coordinates failed:

$$\int_0^{2\pi}{\vec{r}d\phi}=\int_0^{2\pi}{(r,\theta,\phi)d\phi} = {2\pi(r,\theta,\pi)} $$

Which is completely wrong...

What am I doing wrong?


1 Answer 1


In that final integral, I think you are making the very old, very common mistake of just thinking of a vector as three numbers. It is easy to do this because we learn about vectors in Cartesian coordinates first, and in Cart coords, thinking of a vector as three numbers is easy because it works. $\vec{r}$ is absolutely not $(r,\theta,\phi)$. Rather, $\vec{r}$ is $r\hat{r}$, and $\hat{r}$ depends on $\theta$ and $\phi$. The integral you want to calculate is

$\int \vec{r} d\phi = \int r\hat{r} d\phi = \int r\hat{r}(\theta,\phi) d\phi$

Actually, I don't like the way that looks on my screen, but what I am trying to emphasize is that $\hat{r}$ is a function of $\theta$ and $\phi$. Therefore $\hat{r}$ is different at each value of $\phi$ and this change with $\phi$ has to be calculated correctly for you to do the integral correctly. And, last of all, you need to understand that as you "add" each little piece of your integral, it is like adding a new vector to a sum. And the various vectors will all partically cancel and partially reinforce each other.

  • $\begingroup$ But each coordinate should be independent on the other? no? $\endgroup$
    – User
    Commented Apr 17, 2013 at 9:13
  • $\begingroup$ How would you express $\hat{r}$ without converting back to cartesian coordinates? $\endgroup$
    – User
    Commented Apr 17, 2013 at 9:59
  • $\begingroup$ To your first question, yes each coordinate should be independent of the others. But a vector is not just a set of coordinates. In Cartesian coords it's easy to think of it that way, because it works. But we can't do that when we move to other coordinates. Try to think of it this way: A vector is "a thing unto itself". Its components in a particular coordinate system are just a way of expressing it in that coordinate system, nothing more. The coords $(r,\theta,\phi)$ define a location in space, sure. The vector $\vec{r}$ is the thing pointing to that location. $\endgroup$ Commented Apr 17, 2013 at 15:25
  • 1
    $\begingroup$ To your second question, when we are in spherical coordinates $\hat{r}$ is just something "fundamental" that can't be expressed any other way. It certainly can't be expressed as any $a\hat{\theta}+b\hat{\phi}$ because $\hat{r}$ is always normal to $\hat{\theta}$ and $\hat{\phi}$. So, yes, if you want to express it as anything other than $\hat{r}$, you'll have to use Cart coords somehow. A couple of different ways would be $\hat{r}=\sin\theta\cos\phi\hat{x}+\sin\theta\sin\phi\hat{y}+\cos\theta\hat{z}=(x\hat{x}+y\hat{y}+z\hat{z})/\sqrt{x^2+y^2+z^2}$. $\endgroup$ Commented Apr 17, 2013 at 15:31
  • 1
    $\begingroup$ Let me rephrase part of my first comment: the coords $(r,\theta,\phi)$ are a way of indicating a location in space. But $\vec{r}$ is that location itself. It's kind of like the difference between the number 2 and the numeral "2" that we use to represent the number 2. In your final integral, you are trying to integrate over the representations of several locations, when you need to be integrating over the locations themselves. $\endgroup$ Commented Apr 17, 2013 at 15:47

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .