Go back

Summary of spherical coordinates

The spherical coordinate system is a coordinate system to describe points \((\rho,\theta,\phi)\) in 3D using \(\rho\), the radial distance, \(\theta\), the azimuthal angle, and \(\phi\), the polar angle, as in the sketch:

So here, \(\theta\) is the angle in the \(xy\)-plane measured from the \(x\)-axis to the \(y\)-axis, and \(\phi\) is the angle "down" from the \(z\)-axis. Now, these are the fundamental equations that are valid for spherical coordinates: $$\boxed{x=\rho\sin\phi\cos\theta \qquad y=\rho\sin\phi\sin\theta \qquad z=\rho\cos\phi}$$ $$\boxed{x^2+y^2+z^2=\rho^2}$$ And whereas we have \(dV=dx\,dy\,dz\) in Cartesian coordinates, in spherical coordinates we have $$\boxed{dV=\red{\rho^2\sin\phi}\,d\rho\,d\theta\,d\phi}$$ So, never forget to write this factor of \(\red{\rho^2\sin\phi}\)! (It's called a Jacobian)

(It is similar to the factor \(\red r\) that we have in polar coordinates: \(dA=\red{r}\,dr\,d\theta\), here this \(\red r\) is also a Jacobian)

So, if we have the region in spherical coordinates $$E=\{(\rho,\theta,\phi)\mid a\leq\rho\leq b,~ \alpha\leq\theta\leq\beta,~ c\leq\phi\leq d\}$$ Then the integral can be written as $$\boxed{\iiint_Ef(x,y,z)dV=\int_c^d\int_\alpha^\beta\int_{a}^{b}f^*(\rho,\theta,\phi)\,\rho^2\sin\phi\,d\rho\,d\theta\,d\phi}$$ where \(f^*(\rho,\theta,\phi)\) just means: \(f(x,y,z)\), but written in spherical coordinates.
That is: \(f^*(\rho,\theta,\phi)=f(\rho\sin\phi\cos\theta,~\rho\sin\phi\sin\theta,~\rho\cos\phi)\)




Example 1

Question: calculate \(\displaystyle\iiint_E xe^{x^2+y^2+z^2}\,dV\) where \(E\) is the region with \(x^2+y^2+z^2\leq4\) and \(0\leq y\leq x\).
Solution: the inequality \(x^2+y^2+z^2\leq4\) describes a sphere (actually, a ball, since the inner volume is also included and not only its surface). Anyway, this integral is probably going to be easiest when we use spherical coordinates.

First, we observe that the radius of the sphere is \(\sqrt{4}=2\), so \(\rho\) should run from \(0\) to \(2\). Also, \(\phi\) should run from \(0\) to \(\pi\) (we consider all polar angles, from all the way up till all the way down). But now we must think about the constraint \(0\leq y\leq x\). It means that we only want to consider the region below/above the \(xy\)-plane which is bounded by \(y=0\) and \(y=x\) (for positive \(x\) and \(y\)). In the \(xy\)-plane, the line \(y=x\) makes an angle of \(\theta=\frac{\pi}{4}\) with the \(x\)-axis. So, we should let \(\theta\) run from \(0\) to \(\frac{\pi}{4}\). We can then write the region of integration as $$E=\left\{(\rho,\theta,\phi) \mid 0\leq\rho\leq2,~0\leq\theta\leq\frac{\pi}{4},~0\leq\phi\leq\pi\right\}$$ Since in spherical coordinates we have \(x=\rho\sin\phi\cos\theta\) and \(x^2+y^2+z^2=\rho^2\), we can rewrite the integrand as \(\rho\sin\phi\cos\theta \,e^{\rho^2}\). Our integral then becomes $$\iiint_E xe^{x^2+y^2+z^2}\,dV = \int_0^{\pi}\int_0^{\pi/4}\int_0^2 \rho\sin\phi\cos\theta\,e^{\rho^2}\red{\rho^2\sin\phi}\,d\rho\,d\theta\,d\phi$$ Here \(\red{\rho^2\sin\phi}\) is the Jacobian for spherical coordinates.

Well, now we just have to solve this integral. We can rewrite our integral into the product of three "simple" (i.e., single) integrals: $$\iiint_E xe^{x^2+y^2+z^2}\,dV=\green{\left(\int_{0}^{\pi}\sin^2\phi\,d\phi\right)}\textcolor{#F39525}{\left(\int_0^{\pi/4}\cos\theta\,d\theta\right)}\red{\left(\int_0^2\rho^3\,e^{\rho^2}\,d\rho\right)}$$ Now we just have to solve these individual integrals and be done.

For the green one, we can use the trig identity \(~\sin^2\phi=\frac{1}{2}\left(1-\cos2\phi\right)\) to get $$\green{\int_{0}^{\pi}\sin^2\phi\,d\phi=\frac{1}{2}\int_{0}^{\pi}(1-\cos2\phi)\,d\phi=\frac{\pi}{2}-\frac{1}{2}\left[\frac{1}{2}\sin2\phi\right]_{0}^{\pi}=\frac{\pi}{2}}$$ The red one is very nice, because you first need to sub \(u=\rho^2\) (such that \(du=2\rho \,d\rho\)), and then perform integration by parts: $$\red{\int_0^2\rho^3\,e^{\rho^2}\,d\rho=\frac{1}{2}\int_{0^2}^{2^2}ue^u\,du=\frac{1}{2}\left(\left[ue^u\right]_0^4-\int_0^4e^u\,du\right)=\frac{1}{2}(4e^4-(e^4-1))=\frac{3e^4+1}{2}}$$ The orange integral is relatively doable (\(\textcolor{#F39525}{\int_0^{\pi/4}\cos\theta\,d\theta=\sin\frac{\pi}{4}-\sin0=\frac{1}{2}\sqrt2}\)), so the answer is $$\iiint_E xe^{x^2+y^2+z^2}\,dV =\green{\left(\frac{\pi}{2}\right)}\textcolor{#F39525}{\left(\frac{1}{2}\sqrt{2}\right)}\red{\left(\frac{3e^4+1}{2}\right)}=\boxed{\frac{\pi\sqrt2}{8}(3e^4+1)}$$