Main content

## 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

- Spherical coordinates:

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).

indicates the length of the radial line.$r$ the angle around the$\theta $ -axis. Specifically, if you project the radial line onto the$z$ -plane,$xy$ is the angle that line makes with the$\theta $ -axis.$x$ the angle between the radial line and the$\varphi $ -axis.$z$

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,
, the tiny volume$(r,\varphi ,\theta )$ should be expanded as follows:$dV$

The key term to remember (or re-derive) is ${{r}^{2}\mathrm{sin}(\varphi )}$

- 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
(these will be slightly curved, as if hugging a sphere).${r}$ - 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{\textstyle \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}({\varphi})$ . This means the arc length due to a small change in ${\theta}$ is ${r}\mathrm{sin}({\varphi}){\textstyle \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.

In other words, when you have some triple integral,

and you choose to express the bounds and the function using spherical coordinates, ${{r}^{2}\mathrm{sin}(\varphi )}$ term:

**you cannot just replace**$dV$ with $dr{\textstyle \phantom{\rule{0.167em}{0ex}}}d\varphi {\textstyle \phantom{\rule{0.167em}{0ex}}}d\theta $ . You must also remember thePersonally, I can never quite remember exactly how to expand the $dV$ term off the top of my head

"Was itor $\mathrm{sin}(\varphi )$ ... and is it $\mathrm{sin}(\theta )$ or $r$ ...?" ${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

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

Using these bounds, together with the fact that

we can start setting up our integral like this:

**Concept check**: Work through this integral, and appreciate just how lovely it is compared with the other nasty triple integrals you may have encountered.

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

in the region of the

**first octant**where### 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

**Concept check**: What about

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

Next, we convert the function

into spherical coordinates. To do this, we use the conversions for each individual cartesian coordinate.

Plugging each of these in, we get

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

**Bring it on home**: Solve that integral!

## Summary

- When you are performing a triple integral, if you choose to describe the function and the bounds of your region using spherical coordinates,
, the tiny volume$(r,\varphi ,\theta )$ should be expanded as follows:$dV$ The key term to remember (or re-derive) is${{r}^{2}\mathrm{sin}(\varphi )}$ - 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.(9 votes)
- Your answer is correct. When substituting in ϕ=π/2, the solution in the article forgot the factor of 1/2 in the ϕ/2 term.(12 votes)

- In my book the key term to remember is rather R^2*COS(ϕ§). Why is it different here?(5 votes)
- 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.(5 votes)

- how do you get x=rsin(phi)cos(theta) y=rsin(phi)sin(theta) and z=rcos(phi)(3 votes)
- 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(θ).(10 votes)

- 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.(4 votes)- 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.(3 votes)

- 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?(3 votes)
- 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(ϕ)).(5 votes)

- I got the volume of a sphere with raidus r using cartesian coordinate integration and I can confirm, it's a pain (involves trig substitution, u substitution, and annoying bounds)(2 votes)
- Hello friends, In the text of the article [such as in the summary] it is stated that spherical coordinates are (r, phi, theta) but in two of the figures the coordinates are shown as (r, theta, phi). Which is correct or does the sequence in a triplet vary among authors [as which angle is phi and which is theta varies]? Which is correct would matter if you were given (2, 0.5, 0.75) and asked where it is. Also - just for curiosity - are the 8 octants numbered in any consistent way? The articles are great. Best wishes to all. (April 2019)(1 vote)
- The ordering of the variables does not matter as long as their definitions and order remain consistent. Some put it (r, phi, theta) and others (r, theta, phi). The wikipedia page on "Octant (solid geometry)" has a table showing the octant numbering.(2 votes)

- Could you not switch the differential θ and ϕ so that θ becomes rdθ and ϕ becomes rsin(θ)dϕ? Would this just mean that instead of having the radius change as you move along z, it would change as you move across the xy plane? This is referring to the explanation for each differential variable you give.(1 vote)
- What if we are given an improper integral (from -oo to oo) with a regular xyz function and we are told to change the function into spherical coordinates. What should the bounds look like then?(1 vote)