TExcelTAD
Home › Calculus in Depth › Double Integrals over General Regions

Double Integrals over General Regions

Real regions are rarely rectangles: the area under a curve, a triangle, the overlap of two shapes. This lesson extends the double integral to bounded regions with curved boundaries, classifies regions as type I or type II so Fubini's theorem still turns them into iterated integrals with variable limits, and shows how reversing the order of integration makes "impossible" integrals easy.

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

It builds on Iterated Integrals.

Definition by extension

Let DD be a bounded region, so it fits inside some rectangle RR. Define

F(x,y)=f(x,y)if (x,y)∈DF(x,y)=0if (x,y)∈R but not in D\begin{aligned} F(x, y) &= f(x, y) && \text{if } (x, y) \in D \\ F(x, y) &= 0 && \text{if } (x, y) \in R \text{ but not in } D \end{aligned}

and set ∬Df dA=∬RF dA\iint_D f\,dA = \iint_R F\,dA. FF may jump across the boundary of DD, but if that boundary is made of finitely many smooth curves, FF is still integrable (the boundary has zero area), and the value does not depend on which enclosing rectangle we chose.

Type I and type II regions

A region is type I if it lies between two graphs of functions of xx:

D={(x,y):a≤x≤b, g1(x)≤y≤g2(x)}∬Df dA=∫ab∫g1(x)g2(x)f(x,y) dy dx\begin{aligned} D &= \{(x, y) : a \le x \le b,\ g_1(x) \le y \le g_2(x)\} \\ \iint_D f\,dA &= \int_a^b \int_{g_1(x)}^{g_2(x)} f(x, y)\,dy\,dx \end{aligned}

It is type II if it lies between two graphs of functions of yy:

D={(x,y):c≤y≤d, h1(y)≤x≤h2(y)}∬Df dA=∫cd∫h1(y)h2(y)f(x,y) dx dy\begin{aligned} D &= \{(x, y) : c \le y \le d,\ h_1(y) \le x \le h_2(y)\} \\ \iint_D f\,dA &= \int_c^d \int_{h_1(y)}^{h_2(y)} f(x, y)\,dx\,dy \end{aligned}

Both formulas follow from Fubini on the enclosing rectangle: for fixed xx, F(x,y)F(x, y) is zero outside g1(x)≤y≤g2(x)g_1(x) \le y \le g_2(x), so the inner integral shrinks to those limits.

Rules for the limits. The outer limits are constants. The inner limits may depend on the outer variable only. A vertical line drawn through a type I region enters at y=g1(x)y = g_1(x) and leaves at y=g2(x)y = g_2(x): that is how to read off the inner limits from a sketch.

Worked example

Let DD be the region between the parabola y=x2y = x^2 and the line y=2xy = 2x. They meet where x2=2xx^2 = 2x, at x=0x = 0 and x=2x = 2, and on [0,2][0, 2] the line is on top.

Type I:0≤x≤2,x2≤y≤2x∬D(x+y) dA=∫02∫x22x(x+y) dy dx=∫02[x(2x−x2)+4x2−x42]dx=∫02(4x2−x3−x42)dx=323−4−165=5215\begin{aligned} &\text{Type I:} \quad 0 \le x \le 2, \quad x^2 \le y \le 2x \\ \iint_D (x + y)\,dA &= \int_0^2 \int_{x^2}^{2x} (x + y)\,dy\,dx \\ &= \int_0^2 \left[x(2x - x^2) + \frac{4x^2 - x^4}{2}\right] dx \\ &= \int_0^2 \left(4x^2 - x^3 - \frac{x^4}{2}\right) dx \\ &= \frac{32}{3} - 4 - \frac{16}{5} = \frac{52}{15} \end{aligned}

The same region is type II: solving the curves for xx gives x=y/2x = y/2 (line, on the left) and x=yx = \sqrt{y} (parabola, on the right), for 0≤y≤40 \le y \le 4.

python · try it yourself
import sympy as sp
from scipy import integrate

x, y = sp.symbols("x y", nonnegative=True)
f = x + y
type1 = sp.integrate(f, (y, x**2, 2 * x), (x, 0, 2))
type2 = sp.integrate(f, (x, y / 2, sp.sqrt(y)), (y, 0, 4))
print("type I :", type1)
print("type II:", type2)

# scipy: dblquad(func(y, x), x_lo, x_hi, y_lo(x), y_hi(x))
val, _ = integrate.dblquad(lambda y, x: x + y, 0, 2, lambda x: x**2, lambda x: 2 * x)
print("dblquad:", round(val, 10), "  52/15 =", round(52 / 15, 10))
type I : 52/15
type II: 52/15
dblquad: 3.4666666667   52/15 = 3.4666666667

Reversing the order of integration

Some iterated integrals cannot be done as written because the inner integral has no elementary antiderivative. Sketching the region and switching to the other type can fix it.

Example. I=∫01∫x1ey2 dy dxI = \int_0^1 \int_x^1 e^{y^2}\,dy\,dx. The inner integral ∫ey2 dy\int e^{y^2}\,dy is not elementary. The region is 0≤x≤10 \le x \le 1, x≤y≤1x \le y \le 1: the triangle with corners (0,0)(0, 0), (0,1)(0, 1), (1,1)(1, 1). As a type II region it is 0≤y≤10 \le y \le 1, 0≤x≤y0 \le x \le y, so

I=∫01∫0yey2 dx dy=∫01yey2 dy=e−12≈0.8591I = \int_0^1 \int_0^y e^{y^2}\,dx\,dy = \int_0^1 y e^{y^2}\,dy = \frac{e - 1}{2} \approx 0.8591

The xx-integral produced the factor yy, which is exactly the derivative needed for the substitution u=y2u = y^2.

Example. ∫0π∫xπsin⁡yy dy dx\int_0^{\pi} \int_x^{\pi} \frac{\sin y}{y}\,dy\,dx. Reversed: 0≤y≤π0 \le y \le \pi, 0≤x≤y0 \le x \le y, so the inner integral gives y⋅sin⁡yy=sin⁡yy \cdot \frac{\sin y}{y} = \sin y, and the answer is ∫0πsin⁡y dy=2\int_0^{\pi} \sin y\,dy = 2.

Tip: Always sketch. Reversing an order is not "swap the limits": you must describe the same region the other way, which usually means solving the boundary curves for the other variable.

Properties and area

All rectangle properties carry over: linearity, comparison, and additivity over regions D=D1∪D2D = D_1 \cup D_2 that overlap only on boundaries. Additivity lets you split a region that is neither type I nor type II (an annulus, say) into pieces that are. Two more facts:

∬D1 dA=A(D)(area)m≤f≤M on D  ⟹  m⋅A(D)≤∬Df dA≤M⋅A(D)\begin{aligned} &\iint_D 1\,dA = A(D) && \text{(area)} \\ &m \le f \le M \text{ on } D \implies m \cdot A(D) \le \iint_D f\,dA \le M \cdot A(D) \end{aligned}

The area formula reproduces the single-variable area between curves: ∬D1 dA=∫ab[g2(x)−g1(x)] dx\iint_D 1\,dA = \int_a^b [g_2(x) - g_1(x)]\,dx.

Volume of a solid. The tetrahedron cut from the first octant by the plane x+2y+z=2x + 2y + z = 2 lies under z=2−x−2yz = 2 - x - 2y over the triangle DD with 0≤x≤20 \le x \le 2, 0≤y≤2−x20 \le y \le \frac{2 - x}{2}:

V=∫02∫0(2−x)/2(2−x−2y) dy dx=∫02(2−x)24 dx=23V = \int_0^2 \int_0^{(2-x)/2} (2 - x - 2y)\,dy\,dx = \int_0^2 \frac{(2 - x)^2}{4}\,dx = \frac{2}{3}

which matches 13⋅base⋅height=13⋅(12⋅2⋅1)⋅2=23\frac{1}{3} \cdot \text{base} \cdot \text{height} = \frac{1}{3} \cdot \left(\frac{1}{2} \cdot 2 \cdot 1\right) \cdot 2 = \frac{2}{3}.

In software

  • Masks are "extension by zero". In NumPy you integrate over an irregular region by evaluating on a rectangular grid and multiplying by a Boolean mask, which is exactly F=f⋅1DF = f \cdot \mathbf{1}_D. The error comes from cells cut by the boundary, so it shrinks only like the cell size (first order), unlike the second-order midpoint rule on a rectangle.
  • Coverage and anti-aliasing. A rasteriser decides how much of a pixel a triangle covers, a double integral of the triangle's indicator over the pixel square; multisample anti-aliasing estimates it with a few fixed sample points, analytic coverage computes the polygon-clipped area.
  • Probability over regions. P((X,Y)∈D)=∬Dp(x,y) dAP((X, Y) \in D) = \iint_D p(x, y)\,dA for a joint density pp; for independent uniforms on [0,1][0, 1], P(Y>X2)P(Y > X^2) is the area above the parabola, 23\frac{2}{3}. Many "probability that one random time beats another" questions are integrals over triangles like the ones above.
python · try it yourself
import numpy as np

rng = np.random.default_rng(42)
N = 200_000
x, y = rng.uniform(0, 2, N), rng.uniform(0, 4, N)     # box [0,2] x [0,4], area 8
inside = (y >= x**2) & (y <= 2 * x)                   # region between parabola and line
f = np.where(inside, x + y, 0.0)                      # extension by zero
print("Monte Carlo area    :", round(8 * inside.mean(), 4), "  exact 4/3 =", round(4 / 3, 4))
print("Monte Carlo integral:", round(8 * f.mean(), 4), "  exact 52/15 =", round(52 / 15, 4))

g = np.linspace(0, 1, 1001)[:-1] + 0.0005             # midpoint grid on [0,1]^2
X, Y = np.meshgrid(g, g)
print("grid P(Y > X^2)     :", round(float(np.mean(Y > X**2)), 4), "  exact 2/3")
Monte Carlo area    : 1.3401   exact 4/3 = 1.3333
Monte Carlo integral: 3.4722   exact 52/15 = 3.4667
grid P(Y > X^2)     : 0.6666   exact 2/3

Exercises

Exercise 1: A triangle

Evaluate ∬Dxy dA\iint_D xy\,dA where DD is the triangle bounded by y=0y = 0, y=xy = x and x=2x = 2.

Answer
Solution
D: 0≤x≤2,0≤y≤x∫02∫0xxy dy dx=∫02x⋅x22 dx=∫02x32 dx=168=2\begin{aligned} &D: \ 0 \le x \le 2, \quad 0 \le y \le x \\ &\int_0^2 \int_0^x xy\,dy\,dx = \int_0^2 x \cdot \frac{x^2}{2}\,dx = \int_0^2 \frac{x^3}{2}\,dx = \frac{16}{8} = 2 \end{aligned}

Exercise 2: Reverse the order

Rewrite ∫04∫x2f(x,y) dy dx\int_0^4 \int_{\sqrt{x}}^2 f(x, y)\,dy\,dx with the order of integration reversed.

Answer

∫02∫0y2f(x,y) dx dy\int_0^2 \int_0^{y^2} f(x, y)\,dx\,dy.

Solution

The region is 0≤x≤40 \le x \le 4, x≤y≤2\sqrt{x} \le y \le 2: above the curve y=xy = \sqrt{x} (that is, x=y2x = y^2) and below y=2y = 2. For fixed yy in [0,2][0, 2], xx runs from the yy-axis x=0x = 0 to the curve x=y2x = y^2.

Exercise 3: Reverse to evaluate

Evaluate ∫01∫y1x3+1 dx dy\int_0^1 \int_{\sqrt{y}}^1 \sqrt{x^3 + 1}\,dx\,dy.

Answer

29(22−1)≈0.4063\frac{2}{9}(2\sqrt{2} - 1) \approx 0.4063.

Solution

The region: 0≤y≤10 \le y \le 1, y≤x≤1\sqrt{y} \le x \le 1, i.e. 0≤x≤10 \le x \le 1, 0≤y≤x20 \le y \le x^2.

∫01∫0x2x3+1 dy dx=∫01x2x3+1 dxu=x3+1, du=3x2 dx:13∫12u du=29(23/2−1)≈0.4063\begin{aligned} \int_0^1 \int_0^{x^2} \sqrt{x^3 + 1}\,dy\,dx &= \int_0^1 x^2 \sqrt{x^3 + 1}\,dx \\ u = x^3 + 1,\ du = 3x^2\,dx: \quad \frac{1}{3} \int_1^2 \sqrt{u}\,du &= \frac{2}{9}\left(2^{3/2} - 1\right) \approx 0.4063 \end{aligned}

Exercise 4: Between two curves (code)

Let DD be the region between y=x2y = x^2 and y=xy = \sqrt{x}. Compute ∬D(x+y) dA\iint_D (x + y)\,dA exactly by hand and check with scipy.integrate.dblquad.

Answer

310\frac{3}{10}.

Solution

The curves meet at x=0x = 0 and x=1x = 1, and x≥x2\sqrt{x} \ge x^2 on [0,1][0, 1].

∫x2x(x+y) dy=x(x−x2)+x−x42∫01[x3/2−x3+x2−x42]dx=25−14+14−110=310\begin{aligned} \int_{x^2}^{\sqrt{x}} (x + y)\,dy &= x(\sqrt{x} - x^2) + \frac{x - x^4}{2} \\ \int_0^1 \left[x^{3/2} - x^3 + \frac{x}{2} - \frac{x^4}{2}\right] dx &= \frac{2}{5} - \frac{1}{4} + \frac{1}{4} - \frac{1}{10} = \frac{3}{10} \end{aligned}
python · try it yourself
from scipy import integrate
val, _ = integrate.dblquad(lambda y, x: x + y, 0, 1, lambda x: x**2, lambda x: x**0.5)
print(round(val, 10))
0.3

Test yourself

In a type I iterated integral ∫ab∫g1(x)g2(x)f dy dx\int_a^b \int_{g_1(x)}^{g_2(x)} f\,dy\,dx, which limits may depend on xx?

  1. Only the outer limits
  2. Only the inner limits
  3. All four
  4. None

Reversing ∫01∫x1g(x,y) dy dx\int_0^1 \int_x^1 g(x, y)\,dy\,dx gives…

  1. ∫01∫y1g dx dy\int_0^1 \int_y^1 g\,dx\,dy
  2. ∫01∫0yg dx dy\int_0^1 \int_0^y g\,dx\,dy
  3. ∫x1∫01g dx dy\int_x^1 \int_0^1 g\,dx\,dy
  4. ∫01∫01g dx dy\int_0^1 \int_0^1 g\,dx\,dy

What does ∬D1 dA\iint_D 1\,dA compute?

  1. The perimeter of DD
  2. The area of DD
  3. The volume above DD
  4. Always 1