TExcelTAD
Home › Calculus in Depth › Double Integrals in Polar Coordinates

Double Integrals in Polar Coordinates

Disks, rings, sectors and petals are awkward in xx and yy but trivial in polar coordinates. The price of switching is one extra factor: the area element becomes dA=r dr dθdA = r\,dr\,d\theta. This lesson derives that factor from the geometry of a polar rectangle, applies it to volumes and areas, and uses it for the most famous trick in probability, the evaluation of ∫e−x2 dx=π\int e^{-x^2}\,dx = \sqrt{\pi}, which also powers the Box–Muller method for generating normal random numbers.

The survey course introduces double and triple integrals in Double and Triple Integrals.

Polar coordinates themselves are covered in Polar Coordinates and Areas and Lengths in Polar Coordinates.

Polar rectangles and the area element

Recall x=rcos⁡θx = r \cos\theta, y=rsin⁡θy = r \sin\theta, r2=x2+y2r^2 = x^2 + y^2. A polar rectangle is

R={(r,θ):a≤r≤b, α≤θ≤β}(0≤a, 0≤β−α≤2π)R = \{(r, \theta) : a \le r \le b,\ \alpha \le \theta \le \beta\} \qquad (0 \le a,\ 0 \le \beta - \alpha \le 2\pi)

a piece of a ring between two radii and two angles. Divide [a,b][a, b] into pieces of width Δr\Delta r and [α,β][\alpha, \beta] into pieces of width Δθ\Delta\theta. A small polar rectangle between radii r1r_1, r2r_2 and angles θ\theta, θ+Δθ\theta + \Delta\theta is the difference of two circular sectors:

ΔA=12r22 Δθ−12r12 Δθ=12(r2+r1)(r2−r1) Δθ=rˉ Δr Δθ\Delta A = \tfrac{1}{2} r_2^2\,\Delta\theta - \tfrac{1}{2} r_1^2\,\Delta\theta = \tfrac{1}{2} (r_2 + r_1)(r_2 - r_1)\,\Delta\theta = \bar{r}\,\Delta r\,\Delta\theta

where rˉ=r1+r22\bar{r} = \frac{r_1 + r_2}{2} is the middle radius. This is exact, not an approximation: the piece is approximately a rectangle with sides Δr\Delta r (radial) and rˉ Δθ\bar{r}\,\Delta\theta (an arc), and its area is precisely their product. Pieces far from the origin are bigger than pieces near it, which is what the factor rr records.

A Riemann sum using the centres (rˉi,θˉj)(\bar{r}_i, \bar{\theta}_j) is therefore ∑f(rˉicos⁡θˉj,rˉisin⁡θˉj) rˉi Δr Δθ\sum f(\bar{r}_i \cos\bar{\theta}_j, \bar{r}_i \sin\bar{\theta}_j)\,\bar{r}_i\,\Delta r\,\Delta\theta, a Riemann sum for a function of (r,θ)(r, \theta). Taking the limit:

∬Rf(x,y) dA=∫αβ∫abf(rcos⁡θ,rsin⁡θ) r dr dθ\iint_R f(x, y)\,dA = \int_\alpha^\beta \int_a^b f(r \cos\theta, r \sin\theta)\,r\,dr\,d\theta

Note: Forgetting the rr is the most common mistake. A quick check: the area of a disk of radius aa is ∫02π∫0ar dr dθ=2π⋅a22=πa2\int_0^{2\pi} \int_0^a r\,dr\,d\theta = 2\pi \cdot \frac{a^2}{2} = \pi a^2. Without the rr you would get 2πa2\pi a, the circumference.

The same formula is a special case of the change of variables theorem: rr is the Jacobian determinant of the map (r,θ)↦(rcos⁡θ,rsin⁡θ)(r, \theta) \mapsto (r \cos\theta, r \sin\theta).

General polar regions

For a region D={α≤θ≤β, h1(θ)≤r≤h2(θ)}D = \{\alpha \le \theta \le \beta,\ h_1(\theta) \le r \le h_2(\theta)\}:

∬Df dA=∫αβ∫h1(θ)h2(θ)f(rcos⁡θ,rsin⁡θ) r dr dθ\iint_D f\,dA = \int_\alpha^\beta \int_{h_1(\theta)}^{h_2(\theta)} f(r \cos\theta, r \sin\theta)\,r\,dr\,d\theta

With f=1f = 1 and h1=0h_1 = 0 this gives the familiar area formula A=∫12h2(θ)2 dθA = \int \frac{1}{2} h_2(\theta)^2\,d\theta.

Volume under a paraboloid. The solid above the xyxy-plane and below z=4−x2−y2z = 4 - x^2 - y^2 sits over the disk r≤2r \le 2:

V=∫02π∫02(4−r2) r dr dθ=2π[2r2−r44]02=2π(8−4)=8πV = \int_0^{2\pi} \int_0^2 (4 - r^2)\,r\,dr\,d\theta = 2\pi \left[2r^2 - \frac{r^4}{4}\right]_0^2 = 2\pi (8 - 4) = 8\pi

One petal of a rose. The curve r=cos⁡2θr = \cos 2\theta has a petal for −π/4≤θ≤π/4-\pi/4 \le \theta \le \pi/4:

A=∫−π/4π/4∫0cos⁡2θr dr dθ=∫12cos⁡22θ dθ=π8A = \int_{-\pi/4}^{\pi/4} \int_0^{\cos 2\theta} r\,dr\,d\theta = \int \tfrac{1}{2} \cos^2 2\theta\,d\theta = \frac{\pi}{8}
python · try it yourself
import sympy as sp

r, th = sp.symbols("r theta", nonnegative=True)
print("disk area      :", sp.integrate(r, (r, 0, 3), (th, 0, 2 * sp.pi)))
print("paraboloid vol :", sp.integrate((4 - r**2) * r, (r, 0, 2), (th, 0, 2 * sp.pi)))
print("rose petal area:", sp.integrate(r, (r, 0, sp.cos(2 * th)), (th, -sp.pi / 4, sp.pi / 4)))

# a Cartesian integrand: ∬ over the ring 1 ≤ r ≤ 2 of x²/(x² + y²)
x, y = sp.symbols("x y")
f = x**2 / (x**2 + y**2)
polar = sp.simplify(f.subs({x: r * sp.cos(th), y: r * sp.sin(th)}))
print("integrand in polar:", polar, "->", sp.integrate(polar * r, (r, 1, 2), (th, 0, 2 * sp.pi)))
disk area      : 9*pi
paraboloid vol : 8*pi
rose petal area: pi/8
integrand in polar: cos(theta)**2 -> 3*pi/2

The Gaussian integral

The function e−x2e^{-x^2} has no elementary antiderivative, yet

I=∫−∞∞e−x2 dx=πI = \int_{-\infty}^{\infty} e^{-x^2}\,dx = \sqrt{\pi}

Proof. Square II and write the product of two integrals as a double integral over the whole plane (Fubini for a positive separable integrand):

I2=∫e−x2 dx⋅∫e−y2 dy=∬R2e−(x2+y2) dA=∫02π∫0∞e−r2 r dr dθ=2π⋅[−12e−r2]0∞=2π⋅12=π\begin{aligned} I^2 &= \int e^{-x^2}\,dx \cdot \int e^{-y^2}\,dy = \iint_{\mathbb{R}^2} e^{-(x^2 + y^2)}\,dA \\ &= \int_0^{2\pi} \int_0^{\infty} e^{-r^2}\,r\,dr\,d\theta \\ &= 2\pi \cdot \left[-\tfrac{1}{2} e^{-r^2}\right]_0^{\infty} = 2\pi \cdot \tfrac{1}{2} = \pi \end{aligned}

The factor rr is exactly what makes the inner integral elementary (substitute u=r2u = r^2). Since I>0I > 0, I=πI = \sqrt{\pi}. (Rigorously, integrate over disks and squares of growing size; both are squeezed to the same limit.)

Consequence. Rescaling x=t−μσ2x = \frac{t - \mu}{\sigma\sqrt{2}} gives ∫e−(t−μ)2/(2σ2) dt=σ2π\int e^{-(t - \mu)^2/(2\sigma^2)}\,dt = \sigma\sqrt{2\pi}, so the normal distribution density 1σ2πe−(t−μ)2/(2σ2)\frac{1}{\sigma\sqrt{2\pi}} e^{-(t - \mu)^2/(2\sigma^2)} integrates to 1. The mysterious 2π\sqrt{2\pi} in every Gaussian formula comes from this polar computation.

In software: Box–Muller

The same idea runs backwards to generate normal random numbers. Two independent standard normals (X,Y)(X, Y) have joint density 12πe−r2/2\frac{1}{2\pi} e^{-r^2/2}. In polar form, the angle Θ\Theta is uniform on [0,2π)[0, 2\pi), and the radius satisfies P(R>ρ)=e−ρ2/2P(R > \rho) = e^{-\rho^2/2}. Inverting that survival function: if UU is uniform on (0,1](0, 1], then R=−2ln⁡UR = \sqrt{-2 \ln U} has the right distribution. Hence the Box–Muller transform:

U1,U2∼Uniform(0,1]R=−2ln⁡U1,Θ=2πU2X=Rcos⁡Θ,Y=Rsin⁡Θ(two independent N(0,1) samples)\begin{aligned} &U_1, U_2 \sim \text{Uniform}(0, 1] \\ &R = \sqrt{-2 \ln U_1}, \qquad \Theta = 2\pi U_2 \\ &X = R \cos\Theta, \qquad Y = R \sin\Theta && \text{(two independent } N(0, 1) \text{ samples)} \end{aligned}
python · try it yourself
import numpy as np

rng = np.random.default_rng(2024)
n = 200_000
u1 = 1.0 - rng.random(n)          # in (0, 1], avoids log(0)
u2 = rng.random(n)
R, T = np.sqrt(-2 * np.log(u1)), 2 * np.pi * u2
X, Y = R * np.cos(T), R * np.sin(T)

print("mean, std of X :", round(float(X.mean()), 4), round(float(X.std()), 4))
print("mean, std of Y :", round(float(Y.mean()), 4), round(float(Y.std()), 4))
print("corr(X, Y)     :", round(float(np.corrcoef(X, Y)[0, 1]), 4))
print("P(|X| < 1)     :", round(float(np.mean(np.abs(X) < 1)), 4), " (theory 0.6827)")
mean, std of X : -0.002 0.9995
mean, std of Y : 0.0036 0.9973
corr(X, Y)     : -0.0022
P(|X| < 1)     : 0.6823  (theory 0.6827)

Other places polar integration appears:

  • Radially symmetric kernels. Gaussian blurs, radial basis functions and light falloff are functions of rr only, so their normalising constants are one-dimensional integrals ∫f(r) 2πr dr\int f(r)\,2\pi r\,dr.
  • Sampling a disk uniformly (depth-of-field lens samples, scattering points in a circle): choose θ\theta uniform and r=aUr = a\sqrt{U}, not r=aUr = aU. The factor rr in dAdA says that a uniform rr would crowd points into the centre.
  • Antenna and sensor coverage, radar sectors and circular hit zones in games are polar rectangles.

Exercises

Exercise 1: A power of the radius

Evaluate ∬D(x2+y2)3/2 dA\iint_D (x^2 + y^2)^{3/2}\,dA over the disk x2+y2≤4x^2 + y^2 \le 4.

Answer

64π5≈40.21\frac{64\pi}{5} \approx 40.21.

Solution
(x2+y2)3/2=r3∫02π∫02r3⋅r dr dθ=2π⋅255=64π5\begin{aligned} (x^2 + y^2)^{3/2} &= r^3 \\ \int_0^{2\pi} \int_0^2 r^3 \cdot r\,dr\,d\theta &= 2\pi \cdot \frac{2^5}{5} = \frac{64\pi}{5} \end{aligned}

Exercise 2: Half a ring

Evaluate ∬Dy dA\iint_D y\,dA where DD is the part of the ring 1≤x2+y2≤91 \le x^2 + y^2 \le 9 with y≥0y \ge 0.

Answer

523\frac{52}{3}.

Solution
∫0π∫13(rsin⁡θ) r dr dθ=(∫0πsin⁡θ dθ)(∫13r2 dr)=2⋅27−13=523\int_0^{\pi} \int_1^3 (r \sin\theta)\,r\,dr\,d\theta = \left(\int_0^{\pi} \sin\theta\,d\theta\right)\left(\int_1^3 r^2\,dr\right) = 2 \cdot \frac{27 - 1}{3} = \frac{52}{3}

Exercise 3: Cardioid area

Find the area enclosed by the cardioid r=1+cos⁡θr = 1 + \cos\theta.

Answer

3π2\frac{3\pi}{2}.

Solution
A=∫02π∫01+cos⁡θr dr dθ=12∫02π(1+2cos⁡θ+cos⁡2θ) dθ=12(2π+0+π)=3π2\begin{aligned} A &= \int_0^{2\pi} \int_0^{1 + \cos\theta} r\,dr\,d\theta = \tfrac{1}{2} \int_0^{2\pi} (1 + 2\cos\theta + \cos^2\theta)\,d\theta \\ &= \tfrac{1}{2} (2\pi + 0 + \pi) = \frac{3\pi}{2} \end{aligned}

Exercise 4: A drilled sphere (code)

A cylinder of radius 1 is drilled through the centre of a ball of radius 2. Find the volume of the material removed (inside both the ball and the cylinder) in polar coordinates, and check it with scipy.integrate.dblquad.

Answer

4π3(8−33)≈11.7447\frac{4\pi}{3}(8 - 3\sqrt{3}) \approx 11.7447.

Solution

Above and below the disk r≤1r \le 1 the ball reaches z=±4−r2z = \pm\sqrt{4 - r^2}:

V=∫02π∫0124−r2 r dr dθ=4π[−(4−r2)3/23]01=4π3(8−33)V = \int_0^{2\pi} \int_0^1 2\sqrt{4 - r^2}\,r\,dr\,d\theta = 4\pi \left[-\frac{(4 - r^2)^{3/2}}{3}\right]_0^1 = \frac{4\pi}{3}(8 - 3\sqrt{3})
python · try it yourself
import math
from scipy import integrate
val, _ = integrate.dblquad(lambda r, t: 2 * math.sqrt(4 - r * r) * r, 0, 2 * math.pi, 0, 1)
print(round(val, 4), round(4 * math.pi / 3 * (8 - 3 * math.sqrt(3)), 4))
11.7447 11.7447

Test yourself

In polar coordinates, dAdA equals…

  1. dr dθdr\,d\theta
  2. r dr dθr\,dr\,d\theta
  3. r2 dr dθr^2\,dr\,d\theta
  4. rsin⁡θ dr dθr \sin\theta\,dr\,d\theta

Which integral gives the area of the disk of radius 5?

  1. ∫02π∫05dr dθ\int_0^{2\pi} \int_0^5 dr\,d\theta
  2. ∫0π∫05r dr dθ\int_0^{\pi} \int_0^5 r\,dr\,d\theta
  3. ∫02π∫05r2 dr dθ\int_0^{2\pi} \int_0^5 r^2\,dr\,d\theta
  4. ∫02π∫05r dr dθ\int_0^{2\pi} \int_0^5 r\,dr\,d\theta

Why does switching to polar coordinates make ∬e−(x2+y2) dA\iint e^{-(x^2+y^2)}\,dA computable?

  1. Because e−r2e^{-r^2} is a polynomial
  2. The factor rr from dAdA makes ∫re−r2 dr\int r e^{-r^2}\,dr elementary
  3. Because θ\theta disappears from the limits
  4. It does not; the value is only numerical