If you're seeing this message, it means we're having trouble loading external resources on our website.

If you're behind a web filter, please make sure that the domains *.kastatic.org and *.kasandbox.org are unblocked.

## Multivariable calculus

### Course: Multivariable calculus>Unit 4

Lesson 9: Polar, spherical, and cylindrical coordinates

# Triple integrals in spherical coordinates

How to perform a triple integral when your function and bounds are expressed in spherical coordinates.

## Background

Different authors have different conventions on variable names for spherical coordinates. For this article, I will use the following convention. (In each description the "radial line" is the line between the point we are giving coordinates to and the origin).
• $r$ indicates the length of the radial line.
• $\theta$ the angle around the $z$-axis. Specifically, if you project the radial line onto the $xy$-plane, $\theta$ is the angle that line makes with the $x$-axis.
• $\varphi$ the angle between the radial line and the $z$-axis.
The following two are not strictly required, but they might help as warm up and practice for this topic.

## What we're building to

• When you are performing a triple integral, if you choose to describe the function and the bounds of your region using spherical coordinates, $\left(r,\varphi ,\theta \right)$, the tiny volume $dV$ should be expanded as follows:
$\begin{array}{rl}& \phantom{\rule{1em}{0ex}}{\iiint }_{R}f\left(r,\varphi ,\theta \right)\phantom{\rule{0.167em}{0ex}}dV\\ \\ & ={\iiint }_{R}f\left(r,\varphi ,\theta \right)\phantom{\rule{0.167em}{0ex}}\left(dr\right)\left(r\phantom{\rule{0.167em}{0ex}}d\varphi \right)\left(r\mathrm{sin}\left(\varphi \right)\phantom{\rule{0.167em}{0ex}}d\theta \right)\\ \\ & ={\iiint }_{R}f\left(r,\varphi ,\theta \right)\phantom{\rule{0.167em}{0ex}}{r}^{2}\mathrm{sin}\left(\varphi \right)\phantom{\rule{0.167em}{0ex}}d\theta \phantom{\rule{0.167em}{0ex}}d\varphi \phantom{\rule{0.167em}{0ex}}dr\end{array}$
The key term to remember (or re-derive) is ${r}^{2}\mathrm{sin}\left(\varphi \right)$
• Converting to spherical coordinates can make triple integrals much easier to work out when the region you are integrating over has some spherical symmetry.

## Dissecting tiny volumes in spherical coordinates

As discussed in the introduction to triple integrals, when you are integrating over a three-dimensional region $R$, it helps to imagine breaking it up into infinitely many infinitely small pieces, each with volume $dV$.
When you were working in cartesian coordinates, these tiny pieces were thought of as rectangular blocks. In spherical coordinates, on the other hand, it helps to think of your tiny pieces as being slightly curved blocks "hugging" a sphere. I'll be drawing a fairly large version of one of these chunks, partly to exaggerate its curvature, and partly just so we can see it. For example, here's what one looks like in three dimensions:
The reason for this shape is that each face represents a constant value for one of the spherical coordinates:
• One pair of faces represents constant values of $r$ (these will be slightly curved, as if hugging a sphere).
• One pair of faces represents constant values of $\varphi$.
• One pair of faces represents constant values of $\theta$.
Why is that significant? Because the way multiple integrals work is that each individual integral treats all coordinate as constants, except for one. Therefore, as we consider how the multiple integral as a whole assembles these tiny pieces together, it is more natural to think about pieces whose volume can be expressed in terms of changes to individual coordinates. This will become clearer as you read further.
As the size of these blocks approaches zero, the curve will become so negligible that we can treat them as rectangular prisms. One edge represents a tiny change in the length in the distance from the origin, $dr$:
The other two edges are related to the tiny changes in the other two coordinates, $d\theta$ and $d\varphi$ . However, since $\theta$ and $\varphi$ measure radians, not a unit of length, these values must be multiplied by a unit of length in order to properly reflect the lengths of the edges in our rectangular prism.
For example, the edge representing a change in $\varphi$ has length $r\phantom{\rule{0.167em}{0ex}}d\varphi$:
The edge representing a change in $\theta$ is a little trickier. This edge is part of some circle wrapping around the $z$-axis, and the radius of that circle is not $r$, but $r\mathrm{sin}\left(\varphi \right)$. This means the arc length due to a small change in $\theta$ is $r\mathrm{sin}\left(\varphi \right)\phantom{\rule{0.167em}{0ex}}d\theta$.
That can be confusing at first, so it might be worth a moment of contemplation to ensure you understand how that works.
Putting all this together, we can express the volume of our "rectangular" block in terms of $dr$, $d\varphi$ and $d\theta$ by taking the product of all its side lengths.
$dV=\left(dr\right)\left(r\phantom{\rule{0.167em}{0ex}}d\varphi \right)\left(r\mathrm{sin}\left(\varphi \right)\phantom{\rule{0.167em}{0ex}}d\theta \right)={r}^{2}\mathrm{sin}\left(\varphi \right)\phantom{\rule{0.167em}{0ex}}dr\phantom{\rule{0.167em}{0ex}}d\varphi \phantom{\rule{0.167em}{0ex}}d\theta$
In other words, when you have some triple integral,
$\begin{array}{r}{\iiint }_{R}f\phantom{\rule{0.167em}{0ex}}dV\end{array}$
and you choose to express the bounds and the function using spherical coordinates, you cannot just replace $dV$ with $dr\phantom{\rule{0.167em}{0ex}}d\varphi \phantom{\rule{0.167em}{0ex}}d\theta$. You must also remember the ${r}^{2}\mathrm{sin}\left(\varphi \right)$ term:
$\begin{array}{r}{\iiint }_{R}f\left(r,\theta ,\varphi \right)\phantom{\rule{0.222em}{0ex}}{r}^{2}\mathrm{sin}\left(\varphi \right)\phantom{\rule{0.167em}{0ex}}dr\phantom{\rule{0.167em}{0ex}}d\varphi \phantom{\rule{0.167em}{0ex}}d\theta \end{array}$
Personally, I can never quite remember exactly how to expand the $dV$ term off the top of my head
"Was it $\mathrm{sin}\left(\varphi \right)$ or $\mathrm{sin}\left(\theta \right)$... and is it $r$ or ${r}^{2}$...?"
Instead, I think through the process I just illustrated above, asking what the arc lengths resulting from changes to $\varphi$ and $\theta$ are.

## Example 1: Volume of a sphere revisited

This might be the simplest possible starting example for triple integration in spherical coordinates, but it let's us compute an interesting non-trivial fact: The volume of a sphere.
Question: What is the volume of a sphere with radius $R$?
Situate the sphere such that its center is on the origin.
If we were doing this integral in cartesian coordinates, we would have that ugly-but-common situation where the bounds of inner integrals are functions of the outer variables. However, because spherical coordinates are so well suited to describing, well, actual spheres, our bounds are all constants.
Concept check: Which of the following sets of bounds on the coordinates $r$, $\varphi$ and $\theta$ accurately describes all the points inside a sphere of radius $R$ (without running over the entire sphere multiple times)

Using these bounds, together with the fact that
$dV={r}^{2}\mathrm{sin}\left(\varphi \right)\phantom{\rule{0.167em}{0ex}}dr\phantom{\rule{0.167em}{0ex}}d\varphi \phantom{\rule{0.167em}{0ex}}d\theta$
we can start setting up our integral like this:
$\begin{array}{r}{\iiint }_{\text{Ball}}dV={\int }_{0}^{2\pi }{\int }_{0}^{\pi }{\int }_{0}^{R}{r}^{2}\mathrm{sin}\left(\varphi \right)\phantom{\rule{0.167em}{0ex}}dr\phantom{\rule{0.167em}{0ex}}d\varphi \phantom{\rule{0.167em}{0ex}}d\theta \end{array}$
Concept check: Work through this integral, and appreciate just how lovely it is compared with the other nasty triple integrals you may have encountered.
$\begin{array}{r}{\int }_{0}^{2\pi }{\int }_{0}^{\pi }{\int }_{0}^{R}{r}^{2}\mathrm{sin}\left(\varphi \right)\phantom{\rule{0.167em}{0ex}}dr\phantom{\rule{0.167em}{0ex}}d\varphi \phantom{\rule{0.167em}{0ex}}d\theta =\end{array}$

If you dare, imagine trying to do this integral in cartesian coordinates. It's a nightmare! This gives us an important takeaway:
Key takeaway If you are integrating over a region with some spherical symmetry, passing to spherical coordinates can make the bounds much nicer to deal with.

## Example 2: Integrating a function

Integrate the function
$f\left(x,y,z\right)=x+2y+3z$
in the region of the first octant where
${x}^{2}+{y}^{2}+{z}^{2}\le 3$

### Step 1: Express the region in spherical coordinates.

How could you know that we should pass to spherical coordinates? We could do this whole integral in cartesian coordinates, couldn't we? Cylindrical coordinates would work too.
The fact that our boundary includes the condition ${x}^{2}+{y}^{2}+{z}^{2}\le 3$ is a description of the distance between points of our region and the origin. Since the spherical coordinate $r$ expresses precisely this idea, we can feel confident that describing the boundary of our region using $r$ will make the bounds of our three integrals simpler than if we did so in terms of $x$, $y$ and $z$.
Specifically, this condition becomes
$\begin{array}{rl}{x}^{2}+{y}^{2}+{z}^{2}& \le 3\\ \\ {r}^{2}& \le 3\\ \\ r& \le \sqrt{3\phantom{\rule{0.167em}{0ex}}}\end{array}$
Concept check: What about $\theta$ and $\varphi$? What bounds should we place on these two coordinates to keep our integral within the first octant?
$\le \theta \le$
$\le \varphi \le$

### Step 2: Express the function in spherical coordinates

Next, we convert the function
$f\left(x,y,z\right)=x+2y+3z$
into spherical coordinates. To do this, we use the conversions for each individual cartesian coordinate.
• $x=r\mathrm{sin}\left(\varphi \right)\mathrm{cos}\left(\theta \right)$
• $y=r\mathrm{sin}\left(\varphi \right)\mathrm{sin}\left(\theta \right)$
• $z=r\mathrm{cos}\left(\varphi \right)$
Plugging each of these in, we get
$\begin{array}{rl}f\left(x,y,z\right)& =x+2y+3z\\ \\ & =r\mathrm{sin}\left(\varphi \right)\mathrm{cos}\left(\theta \right)+2r\mathrm{sin}\left(\varphi \right)\mathrm{sin}\left(\theta \right)+3r\mathrm{cos}\left(\varphi \right)\\ \\ & =r\left(\mathrm{sin}\left(\varphi \right)\mathrm{cos}\left(\theta \right)+2\mathrm{sin}\left(\varphi \right)\mathrm{sin}\left(\theta \right)+3\mathrm{cos}\left(\varphi \right)\right)\\ \end{array}$
You might say that this makes things more complicated than they were in cartesian coordinates. And you'd be right! But when it comes to triple integrals, a more complicated function is a relatively small price to pay for getting our bounds to be constants.

### Step 3: Compute the triple integral

Concept check: Putting the previous two steps together, what is the integral that we need to solve?

Bring it on home: Solve that integral!
Integral from previous question:

## Summary

• When you are performing a triple integral, if you choose to describe the function and the bounds of your region using spherical coordinates, $\left(r,\varphi ,\theta \right)$, the tiny volume $dV$ should be expanded as follows:
$\begin{array}{rl}& \phantom{\rule{1em}{0ex}}{\iiint }_{R}f\left(r,\varphi ,\theta \right)\phantom{\rule{0.167em}{0ex}}dV\\ \\ & ={\iiint }_{R}f\left(r,\varphi ,\theta \right)\phantom{\rule{0.167em}{0ex}}\left(dr\right)\left(r\phantom{\rule{0.167em}{0ex}}d\varphi \right)\left(r\mathrm{sin}\left(\varphi \right)\phantom{\rule{0.167em}{0ex}}d\theta \right)\\ \\ & ={\iiint }_{R}f\left(r,\varphi ,\theta \right)\phantom{\rule{0.167em}{0ex}}{r}^{2}\mathrm{sin}\left(\varphi \right)\phantom{\rule{0.167em}{0ex}}d\theta \phantom{\rule{0.167em}{0ex}}d\varphi \phantom{\rule{0.167em}{0ex}}dr\end{array}$
The key term to remember (or re-derive) is ${r}^{2}\mathrm{sin}\left(\varphi \right)$
• Converting to spherical coordinates can make triple integrals much easier to work out when the region you are integrating over has some spherical symmetry.

## Want to join the conversation?

• For the last triple integral, my answer is 27pi/8 and not 81pi/16.
• Your answer is correct. When substituting in ϕ=π/2, the solution in the article forgot the factor of 1/2 in the ϕ/2 term.
• In my book the key term to remember is rather R^2*COS(ϕ§). Why is it different here?
• Maybe your book is using phi as the angle of elevation from the xy plane instead of from the positive x axis. In other words, this would start at π/2 (in the sin version) and go in the opposite direction (since elevation from the xy plane means decreasing phi as measured from the positive z-axis. Since sin(π/2-x) = cosx, these two statements would be equivalent.
• how do you get x=rsin(phi)cos(theta) y=rsin(phi)sin(theta) and z=rcos(phi)
• To find the values of x, y, and z in spherical coordinates, you can construct a triangle, like the first figure in the article, and use trigonometric identities to solve for the coordinates in terms of r, theta, and phi. To do this, I find it easier to first find that ϕ is the angle of the triangle opposite the line segment in the xy-plane. This is the angle between the hypotenuse of the triangle and its z-component.

For z, take cos(ϕ) = z/r. Then solve for z to find z = r*cos(ϕ).

For x and y, we first have to find the component in the xy-plane, then use θ to solve for the two coordinates. The component of r in the xy-plane, which I'll refer to as R, is given by sin(ϕ) = R/r. Solving for R gives R = r*sin(ϕ).

Now that we have the component of r in the xy-plane, we can find the x and y components. Construct another triangle in the xy-plane with a hypotenuse of length R, and with an angle of θ between the hypotenuse and x-component.

For x, we find that cos(θ) = x/R. Solving for x gives x = R*cos(θ). Substituting the value of R we found earlier gives x = r*sin(ϕ)*cos(θ).

For y, we use similar logic to get y = R*sin(θ). Then substituting in the value of R gives
y = r*sin(ϕ)*sin(θ).
• From the first problem, I don't understand why are the limits of phi are from 0 to pi. Shouldn't they be from 0 to 2*pi?
I don't understand the explanation in the article.
• I believe because you are already running around the sphere with theta(circle perimeter), you only need to check the vertical side of the sphere to account for the entire surface.

Doing 0 -> 2*pi counts both sides, but since you are already running around the whole circle perimeter this will count it twice.
• For the first concept check in example number 1, what if you let theta range from 0-pi and a phi range from 0-2pi?
• I am having so much trouble finding a resource that explains: the tiny volume dV is expanded the way it is above. Can somone point me in the direction of a proof?
(1 vote)
• I suggest learning about the Jacobian matrix, which provides a more general framework for coordinate transformations in integrals and allows easy computation of the necessary corrections in area/volume differential elements (in this case, the jacobian would relate dxdydz to drdϕdθ by some function of r,θ, and ϕ, which in this case turns out to be (r^2)​​sin(ϕ)).