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 be a bounded region, so it fits inside some rectangle . Define
and set . may jump across the boundary of , but if that boundary is made of finitely many smooth curves, 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 :
It is type II if it lies between two graphs of functions of :
Both formulas follow from Fubini on the enclosing rectangle: for fixed , is zero outside , 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 and leaves at : that is how to read off the inner limits from a sketch.
Worked example
Let be the region between the parabola and the line . They meet where , at and , and on the line is on top.
The same region is type II: solving the curves for gives (line, on the left) and (parabola, on the right), for .
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. . The inner integral is not elementary. The region is , : the triangle with corners , , . As a type II region it is , , so
The -integral produced the factor , which is exactly the derivative needed for the substitution .
Example. . Reversed: , , so the inner integral gives , and the answer is .
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 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:
The area formula reproduces the single-variable area between curves: .
Volume of a solid. The tetrahedron cut from the first octant by the plane lies under over the triangle with , :
which matches .
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 . 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. for a joint density ; for independent uniforms on , is the area above the parabola, . Many "probability that one random time beats another" questions are integrals over triangles like the ones above.
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 where is the triangle bounded by , and .
Answer
Solution
Exercise 2: Reverse the order
Rewrite with the order of integration reversed.
Answer
.
Solution
The region is , : above the curve (that is, ) and below . For fixed in , runs from the -axis to the curve .
Exercise 3: Reverse to evaluate
Evaluate .
Answer
.
Solution
The region: , , i.e. , .
Exercise 4: Between two curves (code)
Let be the region between and . Compute exactly by hand and check with scipy.integrate.dblquad.
Answer
.
Solution
The curves meet at and , and on .
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 , which limits may depend on ?
- Only the outer limits
- Only the inner limits
- All four
- None
Reversing gives…
What does compute?
- The perimeter of
- The area of
- The volume above
- Always 1