19. Triple integrals

📖 Reading · 10 min
💡 Every code box below is live — edit it and hit Run.

§11.0 added one dimension to Riemann sums, turning area into volume. Adding a third dimension does the same thing one more time — a triple integral sums tiny boxes of mass (or any other density-weighted quantity) throughout a genuine three-dimensional solid, rather than measuring the solid's volume from the outside the way §5.1's disks and washers did.

The triple integral over a box

For f(x,y,z) defined on a rectangular box B=[a,b]\times[c,d]\times[p,q], the triple integral is the limit of a triple Riemann sum — chop B into a 3D grid of tiny boxes, multiply f's value by each box's volume, sum, and refine:

\iiint_Bf(x,y,z)\,dV=\lim\sum_{i,j,k}f(x_i,y_j,z_k)\,\Delta x\,\Delta y\,\Delta z

Fubini's theorem extends without modification: this triple integral equals an iterated integral, evaluated in any order:

\iiint_Bf(x,y,z)\,dV=\int_a^b\int_c^d\int_p^qf(x,y,z)\,dz\,dy\,dx

— three ordinary single-variable integrals, nested, each one treating every other variable as a temporary constant, exactly as §11.0's double integral did with two.

Triple integrals over general solids

Just as §11.0 needed Type I and Type II regions for non-rectangular flat regions, a general solid E is described by projecting it onto a coordinate plane and specifying the z-range (or whichever variable is innermost) as functions of the other two:

E=\{(x,y,z):(x,y)\in D,\ u_1(x,y)\le z\le u_2(x,y)\}

\iiint_Ef\,dV=\iint_D\left(\int_{u_1(x,y)}^{u_2(x,y)}f(x,y,z)\,dz\right)dA

This is a direct nesting of both previous integration lessons: the outer double integral over D works exactly like §11.0, and its own Type I/II boundary description (from §11.0 or, when D is circular, §11.1's polar coordinates) still applies unchanged — only the innermost z-integral is genuinely new, and it's an ordinary single-variable integral once x,y are (temporarily) fixed.

Volume and mass, one dimension up

Setting f=1 recovers ordinary volume — the direct sibling of §11.0's "f=1 recovers area":

\text{Volume}(E)=\iiint_E1\,dV

This is a genuinely different volume technique from §5.1's disks, washers, and shells — those methods only worked for solids of revolution; a triple integral computes the volume of any solid whose boundary can be described, revolved or not.

For a solid with density \rho(x,y,z), mass is the direct three-dimensional extension of §11.2's lamina mass:

M=\iiint_E\rho(x,y,z)\,dV

with moments and center of mass following the identical pattern, one more coordinate added (M_{xy}=\iiint z\rho\,dV for the moment about the xy-plane, and so on).

Doing it in Python

The volume of a tetrahedron bounded by the coordinate planes and x+y+z=1 — a solid no disk, washer, or shell method from §5.1 could handle directly, since it isn't a solid of revolution at all:

import sympy as sp

x, y, z = sp.symbols('x y z')

# 0<=x<=1, 0<=y<=1-x, 0<=z<=1-x-y
volume = sp.integrate(
    sp.integrate(
        sp.integrate(1, (z, 0, 1 - x - y)),
        (y, 0, 1 - x)
    ),
    (x, 0, 1)
)
print(f"volume of the tetrahedron = {volume}")

The mass of the same tetrahedron, with density \rho(x,y,z)=x+y+z (heavier toward the far corner):

import sympy as sp

x, y, z = sp.symbols('x y z')
rho = x + y + z

mass = sp.integrate(
    sp.integrate(
        sp.integrate(rho, (z, 0, 1 - x - y)),
        (y, 0, 1 - x)
    ),
    (x, 0, 1)
)
print(f"mass of the tetrahedron = {mass}")

Confirming the tetrahedron's volume matches the classical "one-sixth of a cube" geometry formula for a right tetrahedron with unit legs:

import sympy as sp

x, y, z = sp.symbols('x y z')

# actually run the integral rather than asserting its value
triple_integral_volume = sp.integrate(
    sp.integrate(
        sp.integrate(1, (z, 0, 1 - x - y)),
        (y, 0, 1 - x)
    ),
    (x, 0, 1)
)
classical_formula = sp.Rational(1, 6) * 1 * 1 * 1   # (1/6)*leg*leg*leg, this tetrahedron's shape
print(f"triple integral gives: {triple_integral_volume}")
print(f"classical formula:     {classical_formula}")
print(f"match: {sp.simplify(triple_integral_volume - classical_formula) == 0}")

Worked example

Find the volume of the tetrahedron bounded by the coordinate planes x=0, y=0, z=0 and the plane x+y+z=1.

Projecting onto the xy-plane, the base triangle is 0\le x\le1, 0\le y\le1-x (the triangle where the tetrahedron's "floor" sits). For each (x,y) in that triangle, z ranges from 0 up to the slanted plane, z=1-x-y.

V=\int_0^1\int_0^{1-x}\int_0^{1-x-y}1\,dz\,dy\,dx

Inner integral: \displaystyle\int_0^{1-x-y}dz=1-x-y.

V=\int_0^1\int_0^{1-x}(1-x-y)\,dy\,dx

Middle integral, treating x as constant, with u=1-x-y:

\int_0^{1-x}(1-x-y)\,dy=\left[(1-x)y-\frac{y^2}2\right]_0^{1-x}=(1-x)^2-\frac{(1-x)^2}2=\frac{(1-x)^2}2

V=\int_0^1\frac{(1-x)^2}2\,dx=\frac12\left[-\frac{(1-x)^3}3\right]_0^1=\frac12\left(0-\left(-\frac13\right)\right)=\boxed{\frac16}

Sanity check. This matches the classical solid-geometry formula for a tetrahedron with three mutually perpendicular edges of length 1 meeting at the origin: V=\frac16(\text{edge})^3=\frac16 — the same "pyramid volume is one-third base times height" logic from elementary geometry, here derived instead from first principles via three nested integrals. ✓

Your turn

1. Set up (don't necessarily finish by hand) the triple integral for the volume of the box [0,2]\times[0,3]\times[0,4], and confirm it gives the expected 2\times3\times4=24.

2. Find the mass of the tetrahedron from the worked example, with constant density \rho=2.

3. True or false: a triple integral can only compute volume; it cannot represent a physical quantity that isn't literally "size in three dimensions."

Solutions

1.

V=\int_0^2\int_0^3\int_0^4 1\,dz\,dy\,dx=\int_0^2\int_0^3 4\,dy\,dx=\int_0^2 12\,dx=\boxed{24}

— matching the box's ordinary length-times-width-times-height volume exactly, the simplest possible sanity check on the whole triple-integral machinery.

2. Constant density factors straight out:

M=\iiint_E2\,dV=2\iiint_E1\,dV=2\cdot\frac16=\boxed{\frac13}

3. False. Exactly as §11.2 showed for double integrals, the same triple-integral machinery computes mass (\rho in place of 1), and by the identical extension, moments, center of mass, and joint probability densities for three random variables at once. Setting f=1 happens to recover volume, but the integral itself is entirely agnostic to what f represents physically — a triple integral is a general summing tool, of which volume is only the simplest special case.

Check yourself in code

Find the volume and, with density \rho(x,y,z)=x+y+z, the mass of the tetrahedron bounded by the coordinate planes and x+y+z=1.

Print exactly this:

volume = 1/6
mass = 1/8
import sympy as sp

x, y, z = sp.symbols('x y z')

volume = sp.integrate(
    sp.integrate(sp.integrate(1, (z, 0, 1 - x - y)), (y, 0, 1 - x)),
    (x, 0, 1)
)
print("volume = ...")

rho = x + y + z
mass = sp.integrate(
    sp.integrate(sp.integrate(rho, (z, 0, 1 - x - y)), (y, 0, 1 - x)),
    (x, 0, 1)
)
print("mass = ...")
import sympy as sp

x, y, z = sp.symbols('x y z')

volume = sp.integrate(
    sp.integrate(sp.integrate(1, (z, 0, 1 - x - y)), (y, 0, 1 - x)),
    (x, 0, 1)
)
print(f"volume = {volume}")

rho = x + y + z
mass = sp.integrate(
    sp.integrate(sp.integrate(rho, (z, 0, 1 - x - y)), (y, 0, 1 - x)),
    (x, 0, 1)
)
print(f"mass = {mass}")

A triple integral \iiint_Ef(x,y,z)\,dV sums a density-weighted quantity throughout a genuine solid, computed as three nested ordinary integrals via Fubini's theorem exactly as before, with a general solid's bounds found by projecting onto a coordinate plane and describing the remaining variable's range as functions of the other two. Setting f=1 recovers volume — for any solid, not just the solids of revolution §5.1's disk and shell methods were restricted to — and setting f=\rho recovers mass, extending §11.2's lamina formulas one dimension further.

Next: solids with circular or spherical symmetry, where cylindrical and spherical coordinates do for triple integrals exactly what polar coordinates did for double integrals in §11.1.