20. Cylindrical and spherical coordinates
§11.1 traded Cartesian for polar coordinates because circular regions have awkward x,y boundaries. Solids in three dimensions have the same problem, twice over — a cylinder, a cone, or a sphere are all painful to describe with x,y,z, but nearly trivial once the right symmetry-matched coordinate system is used. This lesson builds two such systems: one for solids with an axis of symmetry, one for solids symmetric about a point.
Cylindrical coordinates
Keep z exactly as it is, and replace (x,y) with §6.2's polar coordinates:
x=r\cos\theta,\qquad y=r\sin\theta,\qquad z=z
The volume element is just §11.1's polar area element, with a plain dz tacked on:
dV=r\,dr\,d\theta\,dz
— no new derivation required, since a cylindrical volume element is literally a polar-coordinate area element (§11.1) given some height dz. Use cylindrical coordinates whenever a solid has a natural central axis — cylinders themselves, cones, paraboloids of revolution — the same class of shape §5.1's disk and shell methods handled for solids of revolution, now generalized to triple integrals that don't require the solid's boundary to be a single revolved curve.
Spherical coordinates
x=\rho\sin\varphi\cos\theta,\qquad y=\rho\sin\varphi\sin\theta,\qquad z=\rho\cos\varphi
where \rho\ge0 is the distance from the origin, \theta is the same azimuthal angle as before (angle around the z-axis), and \varphi\in[0,\pi] is the polar angle, measured down from the positive z-axis (so \varphi=0 is straight up, \varphi=\frac\pi2 is the xy-plane, \varphi=\pi is straight down).
The volume element (derived the same way §11.1's polar element was — by computing the volume of a small "spherical box" spanned by d\rho,d\varphi,d\theta) is:
dV=\rho^2\sin\varphi\,d\rho\,d\varphi\,d\theta
Use spherical coordinates whenever a solid is symmetric about a point — balls, spherical shells, or any region and integrand built from x^2+y^2+z^2=\rho^2, which (exactly like x^2+y^2=r^2 in polar) collapses immediately.
Reading the volume elements
Both dV formulas carry an extra factor beyond the naive d(\text{coord}_1)\,d(\text{coord}_2)\,d(\text{coord}_3) — cylindrical has r, spherical has \rho^2\sin\varphi. These factors are never optional — they're the actual local scaling between the new coordinates and true Cartesian volume, and §11.5's Jacobian lesson explains precisely where every one of them comes from in general, for any change of coordinates at all.
Doing it in Python
The volume of a sphere of radius R, computed in spherical coordinates — confirming the familiar \frac43\pi R^3 formula from first principles:
import sympy as sp
rho, phi, theta, R = sp.symbols('rho phi theta R', positive=True)
volume = sp.integrate(
sp.integrate(
sp.integrate(rho**2 * sp.sin(phi), (rho, 0, R)),
(phi, 0, sp.pi)
),
(theta, 0, 2*sp.pi)
)
print(f"sphere volume = {sp.simplify(volume)}")
The mass of a solid ball of radius R with density \rho_{\text{density}}(\text{point})= distance from the center — heavier toward the surface — using spherical coordinates, where "distance from center" is just the coordinate \rho itself:
import sympy as sp
rho, phi, theta, R = sp.symbols('rho phi theta R', positive=True)
density = rho # density increases linearly with distance from center
mass = sp.integrate(
sp.integrate(
sp.integrate(density * rho**2 * sp.sin(phi), (rho, 0, R)),
(phi, 0, sp.pi)
),
(theta, 0, 2*sp.pi)
)
print(f"mass = {sp.simplify(mass)}")
The volume of a cone (radius R at the base, height H), computed in cylindrical coordinates — a shape with an axis of symmetry but no spherical symmetry at all:
import sympy as sp
r, theta, z, R, H = sp.symbols('r theta z R H', positive=True)
# at height z, the cone's radius has shrunk linearly to R*(1 - z/H)
volume = sp.integrate(
sp.integrate(
sp.integrate(r, (r, 0, R*(1 - z/H))),
(theta, 0, 2*sp.pi)
),
(z, 0, H)
)
print(f"cone volume = {sp.simplify(volume)}")
print(f"matches (1/3)*pi*R^2*H: {sp.simplify(volume - sp.Rational(1,3)*sp.pi*R**2*H) == 0}")
Worked example
Find the volume of a sphere of radius R using spherical coordinates.
V=\int_0^{2\pi}\int_0^\pi\int_0^R\rho^2\sin\varphi\,d\rho\,d\varphi\,d\theta
Innermost integral (over \rho):
\int_0^R\rho^2\,d\rho=\frac{R^3}3
Middle integral (over \varphi):
\int_0^\pi\sin\varphi\,d\varphi=\Big[-\cos\varphi\Big]_0^\pi=-\cos\pi-(-\cos0)=1+1=2
Outer integral (over \theta):
\int_0^{2\pi}d\theta=2\pi
Multiplying all three (Fubini's theorem separates them cleanly here, since each factor depends on only one variable):
V=\frac{R^3}3\cdot2\cdot2\pi=\boxed{\frac{4\pi R^3}3}
Sanity check. This is exactly the standard solid-geometry formula for a sphere's volume — a direct, independent confirmation that the volume element \rho^2\sin\varphi\,d\rho\,d\varphi\,d\theta is correct, derived here purely from integration rather than assumed. The \sin\varphi factor is doing real geometric work: near the poles (\varphi close to 0 or \pi), \sin\varphi is small, correctly reflecting that a thin "spherical wedge" near a pole sweeps out much less volume than one near the equator (\varphi=\frac\pi2, where \sin\varphi=1 is largest) — the same reasoning that makes polar caps on a globe look small on a map despite covering a full range of longitude. ✓
Your turn
1. Find the volume of a cylinder of radius R and height H using cylindrical coordinates (a direct sanity check, since the answer should obviously be \pi R^2H).
2. Find the volume of a solid hemisphere of radius R (the upper half of a ball, \varphi\in\left[0,\frac\pi2\right]) using spherical coordinates.
3. True or false: for a solid that is symmetric about the z-axis but not about the origin (like a cone), spherical coordinates are the natural choice.
Solutions
1.
V=\int_0^{2\pi}\int_0^H\int_0^Rr\,dr\,dz\,d\theta=\int_0^{2\pi}\int_0^H\frac{R^2}2\,dz\,d\theta=\int_0^{2\pi}\frac{R^2H}2\,d\theta=2\pi\cdot\frac{R^2H}2=\boxed{\pi R^2H}
— matching the elementary cylinder-volume formula exactly, confirming the cylindrical volume element is set up correctly.
2.
V=\int_0^{2\pi}\int_0^{\pi/2}\int_0^R\rho^2\sin\varphi\,d\rho\,d\varphi\,d\theta=\frac{R^3}3\cdot\Big[-\cos\varphi\Big]_0^{\pi/2}\cdot2\pi=\frac{R^3}3\cdot1\cdot2\pi=\boxed{\frac{2\pi R^3}3}
— exactly half the full sphere's \frac43\pi R^3, as it should be for "half a ball."
3. False. A cone has an axis of symmetry (the z-axis) but is not symmetric about the origin — rotating the whole solid around any axis through the origin other than z itself would move the cone to a different position, unlike a sphere, which looks identical from every direction. Axis-symmetric-but-not-point-symmetric solids like cones, cylinders, and paraboloids are exactly the signal for cylindrical coordinates; spherical is reserved for genuine point symmetry, as the concept section specified.
Check yourself in code
Compute the volume of a sphere of radius R using spherical coordinates.
Print exactly this:
sphere volume = 4*pi*R**3/3
import sympy as sp
rho, phi, theta, R = sp.symbols('rho phi theta R', positive=True)
volume = sp.integrate(
sp.integrate(
sp.integrate(rho**2 * sp.sin(phi), (rho, 0, R)),
(phi, 0, sp.pi)
),
(theta, 0, 2*sp.pi)
)
print("sphere volume = ...")
import sympy as sp
rho, phi, theta, R = sp.symbols('rho phi theta R', positive=True)
volume = sp.integrate(
sp.integrate(
sp.integrate(rho**2 * sp.sin(phi), (rho, 0, R)),
(phi, 0, sp.pi)
),
(theta, 0, 2*sp.pi)
)
print(f"sphere volume = {sp.simplify(volume)}")
Cylindrical coordinates bolt an ordinary z onto §6.2's polar system, giving the volume element r\,dr\,d\theta\,dz and matching any solid with an axis of symmetry; spherical coordinates use distance-from-origin \rho and a polar angle \varphi, giving \rho^2\sin\varphi\,d\rho\,d\varphi\,d\theta and matching any solid symmetric about a single point. Both volume elements carry a scaling factor beyond the naive product of coordinate differentials — r for cylindrical, \rho^2\sin\varphi for spherical — and neither factor is optional decoration.
Next: where those scaling factors actually come from, in full generality — the Jacobian, and the change-of-variables formula that produces r, \rho^2\sin\varphi, and every other coordinate-system correction factor from a single unified recipe.