# Volume of sphere - order of integration

Can anyone point out my mistaken reasoning please?

Question Use triple integral to find the volume of a sphere of radius $R$.

Can do the following and it works fine:

$$V = \int_{\phi=0}^{2\pi}\int_{\theta=0}^{\pi}\int_{r=0}^{R}r^2\sin\theta\,dr\,d\theta\,d\phi$$

But if I change the order of integration I get:

$$V = \int_{\theta=0}^{2\pi}\int_{\phi=0}^{\pi}\int_{r=0}^{R}r^2\sin\theta\,dr\,d\phi\,d\theta$$

I get zero. As follows:

\begin{align} V &=\frac{R^3}{3}\int_{\theta=0}^{2\pi}\left[\phi\,\sin\theta\right]_0^{\pi}\,d\theta \\[1.5ex] &=\frac{\pi\,R^3}{3}\int_{\theta=0}^{2\pi}\sin\theta\,d\theta \\[1.5ex] &=\frac{\pi\,R^3}{3}\left[-\cos\theta\right]_0^{2\pi} = 0 \end{align}

Thanks for any help, Mitch.

UPDATE\EDIT

Thanks everyone for your answers but I must confess I'm still unsure.

If I have a coordinate system as depicted here: http://www2.sjs.org/raulston/mvc.10/sphr.dv_files/image005.jpg

Then if I want to calculate the volume of a sphere surely it should matter not whether I integrate by

a) letting $\phi$ vary from 0 to 2$\pi$ and $\theta$ from 0 to $\pi$

or

b) letting $\theta$ vary from 0 to $2\pi$ and $\phi$ from 0 to $\pi$

In either case I stay in the same coordinate system and so no need to swap the roles of $\theta$ and $\phi$

So should not the following two integrals give the same answer?

$$V = \int_{\phi=0}^{2\pi}\int_{\theta=0}^{\pi}\int_{r=0}^{R}r^2\sin\theta\,dr\,d\theta\,d\phi$$

$$V = \int_{\phi=0}^{\pi}\int_{\theta=0}^{2\pi}\int_{r=0}^{R}r^2\sin\theta\,dr\,d\theta\,d\phi$$

I'm doubtless muddled here, thanks for any help clarifying this for me, Mitch.

• You forgot to swap the limits of integration. – user258700 Nov 26 '15 at 17:48
• I intended to allow theta to vary from 0 to 2*PI instead of phi and so phi to vary from 0 to PI. I still cover the entire sphere. Am I wrong? Thanks. (I guess I should have said that instead of changing the order of integration I meant to cover the sphere in a different way). – Mitch Nov 26 '15 at 17:51

You changed both the order of integration and the limits of integration. Note that if you only changed the order of integration the result agrees with your previous integration:

\begin{align*} V&= \int_{\theta=0}^{\pi}\int_{\phi=0}^{2\pi}\int_{r=0}^{R}r^2\sin\theta\,dr\,d\phi\,d\theta\\ &=\int_{\theta=0}^{\pi}\int_{\phi=0}^{2\pi}{r^3\over 3}\Bigg|_{r=0}^R\sin\theta\,d\phi\,d\theta\\ &={R^3\over 3}\int_{\theta=0}^{\pi}\sin\theta\int_{\phi=0}^{2\pi}\,d\phi\,d\theta\\ &={R^3\over 3}\int_{\theta=0}^{\pi}\sin\theta\,\left[\phi\right]_{\phi=0}^{2\pi}\,d\theta\\ &={R^3\over 3}\,2\pi\int_{\theta=0}^{\pi}\sin\theta\,d\theta\\ &={R^3\over 3}\,2\pi\left[-\cos\theta\right]_{\theta=0}^\pi\\ &={R^3\over 3}\cdot2\pi\cdot 2\\ &={4\pi R^3\over 3}. \end{align*}

Do you intend for $\theta$ to the polar angle or the azimuthal angle? Note that you cannot just arbitrarily switch the two.

On the other hand, if you want to swap the role of the $\theta$ and $\phi$, you can do so, but the integration changes analogously (think about the geometry involved on what the $\theta$ and $\phi$ represent in each case:

$$V=\int_{\theta=0}^{\pi}\int_{\phi=0}^{2\pi}\int_{r=0}^{R}r^2\sin\theta\,dr\,d\phi\,d\theta=\int_{\theta=0}^{2\pi}\int_{\phi=0}^{\pi}\int_{r=0}^{R}r^2\sin\phi\,dr\,d\phi\,d\theta={4\pi R^3\over 3}.$$

To avoid the notational mess,

• the longitude coordinate covers a full turn, from Greenwich to Greenwich,

• the colatitude coordinate covers a half turn, from the North to the South pole.

The Jacobian is weighted by the sine of the colatitude (parallel lines vanish at the poles and are the longest at the equator).

So the double integral on the angles will amount to a full turn (longitude range) times the area under a single arch of a sinusoid (colatitude range), hence $2\pi\cdot2$.

Indeed, if you mess up with the ranges vs. the coordinates, the product of a half turn with the area of two arches of a sinusoid (with opposite signs) vanishes.

Note that the integral is fully separable and you can write

$$\int_{\phi=0}^{2\pi}\int_{\theta=0}^{\pi}\int_{r=0}^{R}r^2\sin\theta\,dr\,d\theta\,d\phi=\int_{\phi=0}^{2\pi}d\phi\cdot\int_{\theta=0}^{\pi}\sin\theta\,d\theta\cdot\int_{r=0}^{R}r^2\,dr.$$

• I know it's a long time on but is this possible with all double and above integrals (splitting them into multiplications)? – calcstudent Sep 8 '17 at 16:20
• @calcstudent: Fubini's theorem. – Yves Daoust Sep 8 '17 at 16:38

You forgot to shift the limits when you changed the order of integration. In other words the limits are specific to the variables, $$dr\,d\theta\,d\phi,$$

which in turn are specific to the function (i.e. defined by the function) that you are integrating over, in this case:

$$r^2\sin\theta$$ which defines your integral as: $$V = \int_{\phi=0}^{2\pi}\int_{\theta=0}^{\pi}\int_{r=0}^{R}r^2\sin\theta\,dr\,d\theta\,d\phi$$ The order of integration does not matter, but if you redefine the limits as you did, you will also need to redefine the function you are integrating over. That is, use $$r^2\sin\phi$$ instead.

Mitch, I saw your edit but you are still making the same mistake of not changing the variable in the sine function. It is already a function that is always supposed to be integrated from 0 to pi, and not 0 to 2pi, as you have written. Notice how the sine-function changes variable below in addition to changing the limits (also check JohnD's similar answer).

$$V=\int_{\theta=0}^{\pi}\int_{\phi=0}^{2\pi}\int_{r=0}^{R}r^2\sin\theta\,dr\,d\phi\,d\theta=\int_{\theta=0}^{2\pi}\int_{\phi=0}^{\pi}\int_{r=0}^{R}r^2\sin\phi\,dr\,d\phi\,d\theta$$ Both integrals above are correct but the basic function are and need to be the same, i.e.: $$r^2\sin\alpha$$ where $$\alpha$$ now needs to be defined as being integrated from 0 to pi. If you change it to any other limits, you will not be integrating over a whole sphere, and that is why you will get another answer. Hope this clarifies your edit.

• Thanks for your answer. I think I see it. :) – Mitch Nov 27 '15 at 14:58
• Yes! It was tricky for me also in the beginning. Just remember to view the sine-function as a tool whose use is already predetermined within sphere-integration. – litmus Nov 27 '15 at 15:02
• @Mitch Btw, please mark this question as answered so that others will see that your question was resolved. – litmus Nov 28 '15 at 5:45