Multivariable Calculus – How to Integrate a Vector Function in Spherical Coordinates

integrationmultivariable-calculusspherical coordinates

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?

Best Answer

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.