Chapter 18
22 min read
Section 156 of 353

Double Integrals over General Regions

Multiple Integrals

Learning Objectives

By the end of this section, you will be able to:

  1. Identify and describe Type I and Type II regions in the xy-plane, understanding how the shape of a region determines the integration setup
  2. Set up the bounds for iterated integrals over general (non-rectangular) regions, correctly expressing variable bounds as functions
  3. Evaluate double integrals by computing iterated integrals with variable limits of integration
  4. Change the order of integration when necessary, recognizing when reversing the order simplifies the computation
  5. Apply double integrals to compute areas, volumes, and other quantities over non-rectangular regions
Why This Matters: Most real-world regions are not rectangles! From computing the mass of an irregularly shaped plate to finding probabilities over complex domains in machine learning, the ability to integrate over general regions is essential. This section extends double integration from simple rectangles to regions bounded by curves, vastly expanding what we can calculate.

The Big Picture

In the previous section, we learned to evaluate double integrals over rectangular regions. The setup was straightforward: both integration limits were constants. But what if we need to integrate over a region bounded by curves? Consider finding the volume under a surface over a circular disk, or computing the area between two parabolas.

The key insight is that we can still use iterated integrals, but now the limits of the inner integral become functions of the outer variable. This seemingly small change opens up an enormous range of applications.

The Central Challenge:

Given a region RR in the xy-plane bounded by curves, how do we express Rf(x,y)dA\iint_R f(x,y)\,dA as an iterated integral? The answer depends on how we describe the region—either as "slices" that run vertically (Type I) or horizontally (Type II).


Historical Context

The theory of double integrals over general regions developed alongside the rigorous foundations of calculus in the 19th century. Several mathematicians contributed key ideas:

  • Augustin-Louis Cauchy (1789-1857) developed the first rigorous theory of integration and established conditions under which iterated integrals could be evaluated in either order
  • Bernhard Riemann (1826-1866) generalized the definition of the integral, providing a framework for integration over arbitrary bounded regions
  • Guido Fubini (1879-1943) proved the definitive theorem about interchanging the order of integration, now known as Fubini's Theorem

Fubini's work in 1907 finally answered the question: when can we switch the order of integration in a double integral? His theorem shows that for continuous functions on "nice" regions (which includes all the regions we study in this course), either order gives the same result.


Type I Regions

Definition and Setup

A Type I region (also called a vertically simple region) is one where every vertical line that intersects the region does so in a single line segment. Mathematically, a Type I region has the form:

R={(x,y)axb,  g1(x)yg2(x)}R = \{(x, y) \mid a \leq x \leq b,\; g_1(x) \leq y \leq g_2(x)\}

Here, g1(x)g_1(x) and g2(x)g_2(x) are continuous functions with g1(x)g2(x)g_1(x) \leq g_2(x) on [a,b][a, b]. The region is bounded below by y=g1(x)y = g_1(x), above by y=g2(x)y = g_2(x), and on the sides by the vertical lines x=ax = a and x=bx = b.

For a Type I region, we integrate y first (the inner integral), then x (the outer integral):

Rf(x,y)dA=ab[g1(x)g2(x)f(x,y)dy]dx\iint_R f(x, y)\,dA = \int_a^b \left[ \int_{g_1(x)}^{g_2(x)} f(x, y)\,dy \right] dx

How to Read This: For each fixed value of xx between aa and bb, we integrate f(x,y)f(x,y) with respect to yy from the lower curve g1(x)g_1(x) to the upper curve g2(x)g_2(x). Then we integrate these results over all xx from aa to bb.

Examples of Type I Regions

Region DescriptionLower Bound g₁(x)Upper Bound g₂(x)x Interval
Under the parabola y = x²0[0, 2]
Between y = x and y = x²x[0, 1]
Quarter circle x² + y² ≤ 10√(1 - x²)[0, 1]
Below the line y = 1 - x01 - x[0, 1]

Type II Regions

Definition and Setup

A Type II region (also called a horizontally simple region) is one where every horizontal line that intersects the region does so in a single line segment. Mathematically:

R={(x,y)cyd,  h1(y)xh2(y)}R = \{(x, y) \mid c \leq y \leq d,\; h_1(y) \leq x \leq h_2(y)\}

Here, h1(y)h_1(y) and h2(y)h_2(y) are continuous functions with h1(y)h2(y)h_1(y) \leq h_2(y) on [c,d][c, d]. The region is bounded on the left by x=h1(y)x = h_1(y), on the right by x=h2(y)x = h_2(y), and above and below by the horizontal lines y=cy = c and y=dy = d.

For a Type II region, we integrate x first, then y:

Rf(x,y)dA=cd[h1(y)h2(y)f(x,y)dx]dy\iint_R f(x, y)\,dA = \int_c^d \left[ \int_{h_1(y)}^{h_2(y)} f(x, y)\,dx \right] dy

Examples of Type II Regions

Region DescriptionLeft Bound h₁(y)Right Bound h₂(y)y Interval
Right of the parabola x = y²4[-2, 2]
Between x = y and x = y²y√y[0, 1]
Quarter circle x² + y² ≤ 10√(1 - y²)[0, 1]
Left of x = 2 - y²02 - y²[-√2, √2]
Many regions are both Type I and Type II! For such regions, you can set up the integral either way. The choice often depends on which setup makes the integral easier to evaluate—consider the integrand and the complexity of the bound functions.

Interactive: Type I vs Type II

Explore different regions and see how they can be described as Type I (vertical slices) or Type II (horizontal slices). Watch how the integration slices sweep across the region:

Loading visualization...

Choosing the Right Type

When setting up a double integral, you often have a choice between Type I and Type II. Here are guidelines for making the best choice:

  1. Look at the boundary curves. If boundaries are given as y=f(x)y = f(x), Type I is natural. If given as x=g(y)x = g(y), Type II is natural.
  2. Consider the integrand. Sometimes one order makes the inner integral impossible to evaluate while the other order works. For example, ex2dx\int e^{x^2}\,dx has no elementary antiderivative, but ex2dy\int e^{x^2}\,dy (treating xx as constant) is easy.
  3. Check for splitting. If a Type I description requires splitting the region into multiple pieces, try Type II (and vice versa). Fewer integrals means less work.
  4. Use symmetry. For symmetric regions, the choice may not matter. For circular regions, consider polar coordinates (covered in the next section).

Interactive: Integration Bounds Explorer

Practice setting up integration bounds for different regions. See how to determine the correct limits and when each type is recommended:

Loading visualization...

Changing the Order of Integration

Fubini's Theorem

Fubini's Theorem guarantees that for a continuous function ff on a region RR that is both Type I and Type II, the double integral can be computed in either order:

abg1(x)g2(x)f(x,y)dydx=cdh1(y)h2(y)f(x,y)dxdy\int_a^b \int_{g_1(x)}^{g_2(x)} f(x,y)\,dy\,dx = \int_c^d \int_{h_1(y)}^{h_2(y)} f(x,y)\,dx\,dy

When to Reverse the Order:
  • When the inner integral cannot be evaluated in closed form (like sin(y2)dy\int \sin(y^2)\,dy)
  • When reversing leads to simpler antiderivatives
  • When the original limits require multiple integrals but reversed limits don't
Critical Step: When reversing the order, you must re-describe the same region using the new variable order. The region stays the same—only how you describe it changes! Always sketch the region first.

Interactive: Integration Order Demo

See how changing the order of integration affects the setup. Notice how some integrals become tractable only after reversing the order:

Loading visualization...

Computing Double Integrals

Example 1: Polynomial Integrand

Problem: Evaluate RxydA\iint_R xy\,dA where RR is the region bounded by y=x2y = x^2 and y=xy = x for 0x10 \leq x \leq 1.

Solution: This is a Type I region with g1(x)=x2g_1(x) = x^2 and g2(x)=xg_2(x) = x.

RxydA=01x2xxydydx\iint_R xy\,dA = \int_0^1 \int_{x^2}^{x} xy\,dy\,dx

First, evaluate the inner integral (treating xx as constant):

x2xxydy=xy22x2x=x32x52=x3x52\int_{x^2}^{x} xy\,dy = x \cdot \frac{y^2}{2}\Big|_{x^2}^{x} = \frac{x^3}{2} - \frac{x^5}{2} = \frac{x^3 - x^5}{2}

Now evaluate the outer integral:

01x3x52dx=12[x44x66]01=12(1416)=12112=124\int_0^1 \frac{x^3 - x^5}{2}\,dx = \frac{1}{2}\left[\frac{x^4}{4} - \frac{x^6}{6}\right]_0^1 = \frac{1}{2}\left(\frac{1}{4} - \frac{1}{6}\right) = \frac{1}{2} \cdot \frac{1}{12} = \frac{1}{24}

Example 2: Region Between Curves

Problem: Find the area of the region bounded by y=xy = \sqrt{x}, y=0y = 0, and x=4x = 4.

Solution: To find area, we integrate f(x,y)=1f(x,y) = 1. Using Type I:

Area=040x1dydx=04xdx=2x3/2304=283=163\text{Area} = \int_0^4 \int_0^{\sqrt{x}} 1\,dy\,dx = \int_0^4 \sqrt{x}\,dx = \frac{2x^{3/2}}{3}\Big|_0^4 = \frac{2 \cdot 8}{3} = \frac{16}{3}

Example 3: Reversing the Order

Problem: Evaluate 01x1sin(y2)dydx\int_0^1 \int_x^1 \sin(y^2)\,dy\,dx.

Challenge: The integral sin(y2)dy\int \sin(y^2)\,dy has no elementary antiderivative! We must reverse the order.

Step 1: Sketch the region. From the limits: 0x10 \leq x \leq 1 and xy1x \leq y \leq 1. This is the triangle above the line y=xy = x and below y=1y = 1.

Step 2: Reverse the description. For each yy from 00 to 11, xx ranges from 00 to yy.

010ysin(y2)dxdy\int_0^1 \int_0^y \sin(y^2)\,dx\,dy

Step 3: Evaluate. Now the inner integral is with respect to xx, and sin(y2)\sin(y^2) is constant:

01ysin(y2)dy\int_0^1 y\sin(y^2)\,dy

Using substitution u=y2u = y^2, du=2ydydu = 2y\,dy:

1201sin(u)du=12cos(u)01=1cos(1)2\frac{1}{2}\int_0^1 \sin(u)\,du = -\frac{1}{2}\cos(u)\Big|_0^1 = \frac{1 - \cos(1)}{2}


Properties of Double Integrals

Double integrals over general regions satisfy the same fundamental properties as integrals over rectangles:

PropertyFormulaMeaning
Linearity∫∫ᵣ (af + bg) dA = a∫∫ᵣ f dA + b∫∫ᵣ g dAIntegrals distribute over sums and scale with constants
Additivity∫∫ᵣ f dA = ∫∫ᵣ₁ f dA + ∫∫ᵣ₂ f dA (if R = R₁ ∪ R₂)Can split a region and sum the integrals
ComparisonIf f ≤ g on R, then ∫∫ᵣ f dA ≤ ∫∫ᵣ g dALarger functions have larger integrals
Area∫∫ᵣ 1 dA = Area(R)Integrating 1 gives the region's area
Additivity is powerful! If a region has a "hole" or complex boundary, you can often break it into simpler pieces, integrate over each, and sum the results.

Real-World Applications

Double integrals over general regions appear throughout science and engineering:

  • Mass of Variable-Density Plates: If ρ(x,y)\rho(x,y) gives the density at each point, the total mass is M=Rρ(x,y)dAM = \iint_R \rho(x,y)\,dA
  • Center of Mass: The coordinates of the center of mass are xˉ=1MRxρdA\bar{x} = \frac{1}{M}\iint_R x\rho\,dA and yˉ=1MRyρdA\bar{y} = \frac{1}{M}\iint_R y\rho\,dA
  • Moments of Inertia: Critical for engineering design of rotating objects, computed as I=Rr2ρdAI = \iint_R r^2 \rho\,dA
  • Electric Charge: If σ(x,y)\sigma(x,y) is the charge density, total charge is Q=RσdAQ = \iint_R \sigma\,dA
  • Probability: For a joint PDF f(x,y)f(x,y), probabilities are computed as P[(X,Y)R]=Rf(x,y)dAP[(X,Y) \in R] = \iint_R f(x,y)\,dA

Machine Learning Connections

Double integrals over general regions connect directly to several machine learning concepts:

  • Multivariate Probability: Computing probabilities over decision boundaries requires integrating the joint distribution over complex regions defined by classifier outputs
  • Expectation Values: Expected values of bivariate random variables over non-rectangular supports use double integrals with variable bounds
  • Monte Carlo Integration: When analytic integration is impossible, neural networks use sampling-based integration—the foundation of variational inference and reinforcement learning
  • Attention Mechanisms: Soft attention can be viewed as computing weighted integrals over attention regions, generalizing the discrete sum
Why Monte Carlo? In high dimensions (like the parameter space of a neural network with millions of weights), analytic integration is impossible. Monte Carlo methods approximate integrals by averaging over random samples—the mathematical foundation for training modern AI systems.

Python Implementation

Here's a complete Python implementation showing how to compute double integrals over general regions numerically:

Double Integrals over General Regions
🐍python
1Imports

We use NumPy for numerical operations, SciPy for verified integration, and Matplotlib for visualization.

5Type I Integration Function

Implements iterated integration for Type I regions. The key insight: for each fixed x, we integrate over y from g₁(x) to g₂(x), then sum over all x values. This mimics the mathematical definition ∫∫ᵣ f dA = ∫ₐᵇ (∫_{g₁(x)}^{g₂(x)} f(x,y) dy) dx.

32Type II Integration Function

The same idea but with integration order reversed. For each fixed y, integrate over x from h₁(y) to h₂(y). This corresponds to ∫∫ᵣ f dA = ∫ᶜᵈ (∫_{h₁(y)}^{h₂(y)} f(x,y) dx) dy.

47Monte Carlo Integration

A probabilistic approach that works for any region shape. We sample random points, check if they're in the region, and average. By the Law of Large Numbers, this converges to the true integral. This is how neural network training handles integration over complex parameter spaces!

77Computing Area Example

When f(x,y) = 1, the double integral gives the area of the region. Here we compute the area between y = x² and y = x using both Type I and Type II setups. The exact area is 1/6.

97SciPy Verification

SciPy's dblquad function provides high-precision numerical integration. Note the unusual parameter order: f(y, x) rather than f(x, y). The function also returns an error estimate.

108Volume Calculation

When integrating f(x,y) over a region, we get the volume under the surface z = f(x,y). Here we find the volume under z = xy over the region between y = x² and y = x.

138 lines without explanation
1import numpy as np
2from scipy import integrate
3import matplotlib.pyplot as plt
4from matplotlib.patches import Polygon
5
6def double_integral_type_i(f, a, b, g1, g2, n=100):
7    """
8    Compute double integral over a Type I region.
9
10    Region: a ≤ x ≤ b, g1(x) ≤ y ≤ g2(x)
11
12    Uses iterated integration: first integrate with respect
13    to y (inner), then with respect to x (outer).
14
15    Args:
16        f: Function f(x, y) to integrate
17        a, b: x bounds (constants)
18        g1, g2: Functions giving y bounds
19        n: Number of subdivisions for each variable
20
21    Returns:
22        Approximate value of the double integral
23    """
24    # Outer integral over x
25    x_values = np.linspace(a, b, n)
26    dx = (b - a) / n
27
28    total = 0
29    for x in x_values:
30        # Inner integral over y for this fixed x
31        y_min, y_max = g1(x), g2(x)
32        if y_max > y_min:  # Valid interval
33            y_values = np.linspace(y_min, y_max, n)
34            dy = (y_max - y_min) / n
35            inner_sum = sum(f(x, y) * dy for y in y_values)
36            total += inner_sum * dx
37
38    return total
39
40def double_integral_type_ii(f, c, d, h1, h2, n=100):
41    """
42    Compute double integral over a Type II region.
43
44    Region: c ≤ y ≤ d, h1(y) ≤ x ≤ h2(y)
45
46    Uses iterated integration: first integrate with respect
47    to x (inner), then with respect to y (outer).
48    """
49    y_values = np.linspace(c, d, n)
50    dy = (d - c) / n
51
52    total = 0
53    for y in y_values:
54        x_min, x_max = h1(y), h2(y)
55        if x_max > x_min:
56            x_values = np.linspace(x_min, x_max, n)
57            dx = (x_max - x_min) / n
58            inner_sum = sum(f(x, y) * dx for x in x_values)
59            total += inner_sum * dy
60
61    return total
62
63def monte_carlo_double_integral(f, region_check, x_bounds, y_bounds, n=10000):
64    """
65    Monte Carlo integration over a general region.
66
67    This method works for ANY region, not just Type I/II.
68    Useful for complex boundaries or high dimensions.
69
70    Args:
71        f: Function to integrate
72        region_check: Function(x,y) -> bool, True if (x,y) in region
73        x_bounds, y_bounds: Bounding box [min, max]
74        n: Number of random samples
75
76    Returns:
77        Estimate of the integral and standard error
78    """
79    # Generate random points in the bounding box
80    x_samples = np.random.uniform(x_bounds[0], x_bounds[1], n)
81    y_samples = np.random.uniform(y_bounds[0], y_bounds[1], n)
82
83    # Evaluate f only at points inside the region
84    values = []
85    for x, y in zip(x_samples, y_samples):
86        if region_check(x, y):
87            values.append(f(x, y))
88        else:
89            values.append(0)  # Zero contribution outside
90
91    values = np.array(values)
92
93    # Area of bounding box times average value
94    box_area = (x_bounds[1] - x_bounds[0]) * (y_bounds[1] - y_bounds[0])
95    estimate = box_area * np.mean(values)
96    std_error = box_area * np.std(values) / np.sqrt(n)
97
98    return estimate, std_error
99
100# Example 1: Area between y = x^2 and y = x
101def f_area(x, y): return 1  # For area, integrate 1
102
103# Type I setup: 0 ≤ x ≤ 1, x^2 ≤ y ≤ x
104result_type_i = double_integral_type_i(
105    f_area,
106    a=0, b=1,
107    g1=lambda x: x**2,
108    g2=lambda x: x
109)
110print(f"Area (Type I): {result_type_i:.6f}")
111print(f"Exact value: {1/6:.6f}")
112
113# Type II setup: 0 ≤ y ≤ 1, y ≤ x ≤ √y
114result_type_ii = double_integral_type_ii(
115    f_area,
116    c=0, d=1,
117    h1=lambda y: y,
118    h2=lambda y: np.sqrt(y)
119)
120print(f"Area (Type II): {result_type_ii:.6f}")
121
122# Example 2: Using scipy for verification
123def scipy_integral():
124    result, error = integrate.dblquad(
125        lambda y, x: 1,  # Note: scipy expects f(y, x)!
126        0, 1,            # x bounds
127        lambda x: x**2,  # y lower bound
128        lambda x: x      # y upper bound
129    )
130    return result, error
131
132scipy_result, scipy_error = scipy_integral()
133print(f"\nScipy result: {scipy_result:.6f} ± {scipy_error:.2e}")
134
135# Example 3: Volume under z = xy over the region
136def f_volume(x, y): return x * y
137
138volume = double_integral_type_i(
139    f_volume,
140    a=0, b=1,
141    g1=lambda x: x**2,
142    g2=lambda x: x
143)
144print(f"\nVolume under z = xy: {volume:.6f}")
145print(f"Exact value: {1/24:.6f}")

Test Your Understanding


Summary

In this section, we extended double integration from rectangles to general regions bounded by curves. The key concepts are:

  1. Type I Regions: Bounded above and below by functions of xx. Integrate yy first: abg1(x)g2(x)fdydx\int_a^b \int_{g_1(x)}^{g_2(x)} f\,dy\,dx
  2. Type II Regions: Bounded left and right by functions of yy. Integrate xx first: cdh1(y)h2(y)fdxdy\int_c^d \int_{h_1(y)}^{h_2(y)} f\,dx\,dy
  3. Fubini's Theorem: For continuous functions on well-behaved regions, either order gives the same result
  4. Changing Order: Sometimes essential for evaluating integrals—always sketch the region first
  5. Applications: Area, volume, mass, center of mass, probability, and many engineering quantities
Looking Ahead: In the next section, we'll discover polar coordinates, which transform circular and angular regions into simple rectangles. Many integrals that are difficult in Cartesian coordinates become elegant in polar form. This will complete our toolkit for two-dimensional integration.
Loading comments...