---
title: Double integrals over general regions
heading: Slicing a region that isn't a rectangle
eyebrow: A9 · Lesson 15 · Iterated integrals
xp: 40
---

::: hook
A circuit board's copper pour is rarely a neat rectangle: it's a trapezoid, a triangle, a shape bounded by a curve. To find its total charge, its mass, its center or its capacitance to a ground plane, you integrate over that shape. The method is the same as for a rectangle, slicing into strips and adding, except that the limits of the inner integral now depend on where the strip is. Choosing which way to slice can turn an impossible integral into an easy one.
:::

::: play
- The region lies between the $x$-axis and the curve $y = x^2$, for $0 \le x \le a$. Each vertical strip runs from $y = 0$ up to $y = x^2$.
- The readouts give the region's area, $\int_0^a\int_0^{x^2}dy\,dx$, and its centroid.
- Make $a$ bigger. Why does the centroid move to the right faster than the middle of the interval?
:::
:::

```sim plot
view: graph
x: x = 0..3
y: y = 0..9
slider: a = 0.5..3 step 0.1 = 2
plot: x^2*(1 - step(x - a)) | label: y = x²
plot: x^2 | fill: 0..a | color: ch2
readout: area = a^3/3 | digits: 4
readout: centroid x = 3*a/4 | digits: 4
readout: centroid y = 3*a^2/10 | digits: 4
```

::: predict
## You need $\displaystyle\int_0^1\int_y^1 e^{x^2}\,dx\,dy$. The inner integral has no antiderivative. Is the problem hopeless?

- [ ] Yes: $e^{x^2}$ can't be integrated
- [x] No: swap the order of integration and it becomes easy
- [ ] Only numerically
- [ ] Only with series

::: reveal
Swap the order. The region is the triangle $0 \le y \le x \le 1$. Integrating $y$ first, from 0 to $x$, gives $\int_0^1 xe^{x^2}dx = \frac{e - 1}{2}$, which substitution handles. Same region, same answer, different slicing.
:::
:::

::: nameit
## Two ways to slice

**Vertical strips (type I):** for $a \le x \le b$ and $g_1(x) \le y \le g_2(x)$,

$$\iint_R f\,dA = \int_a^b\int_{g_1(x)}^{g_2(x)}f(x, y)\,dy\,dx$$

**Horizontal strips (type II):** for $c \le y \le d$ and $h_1(y) \le x \le h_2(y)$,

$$\iint_R f\,dA = \int_c^d\int_{h_1(y)}^{h_2(y)}f(x, y)\,dx\,dy$$

The inner limits may depend on the outer variable; the outer limits must be constants.

## Swapping the order

Sketch the region, then describe it the other way. For the triangle under $y = x$ on $[0, 1]$: vertically, $0 \le x \le 1$, $0 \le y \le x$; horizontally, $0 \le y \le 1$, $y \le x \le 1$.

## What the integrals give

With a density $\sigma(x, y)$:

- area: $\iint 1\,dA$;
- total charge or mass: $\iint\sigma\,dA$;
- centroid: $\bar x = \frac{\iint x\,dA}{\iint dA}$, $\bar y = \frac{\iint y\,dA}{\iint dA}$.

For the region under $y = x^2$ on $[0, a]$, the area is $\frac{a^3}{3}$, and $\bar x = \frac{3a}{4}$: the region's bulk is out to the right, where the curve is tall.
:::

::: example
## Evaluate $\iint_R xy\,dA$ over the triangle $0 \le y \le x \le 1$.

::: solution
1. **Use vertical strips.** For each $x$, $y$ runs from 0 to $x$:
   $$\int_0^1\int_0^x xy\,dy\,dx$$
2. **Integrate in $y$, then $x$.**
   $$\int_0^1 x\cdot\frac{x^2}{2}\,dx = \frac{1}{8}$$

**Answer:** the integral is $\frac18$.
:::
:::

::: example
## Evaluate $\displaystyle\int_0^1\int_y^1 e^{x^2}\,dx\,dy$ by swapping the order.

::: solution
1. **Describe the region.** It's $0 \le y \le x \le 1$.
2. **Swap the order.** With $x$ outside:
   $$\begin{aligned} &\int_0^1\int_0^x e^{x^2}dy\,dx \\ &= \int_0^1 xe^{x^2}dx \end{aligned}$$
3. **Integrate.**
   $$\begin{aligned} \int_0^1 xe^{x^2}dx &= \frac{1}{2}e^{x^2}\Big|_0^1 \\ &= \frac{e - 1}{2} \\ &= 0.859 \end{aligned}$$

**Answer:** the integral is $\frac{e - 1}{2} = 0.859$.
:::
:::

::: example
## Find the area between $y = x^2$ and $y = x$, and its centroid.

::: solution
1. **Find where they meet.** They meet at $x = 0$ and 1, with $y = x$ on top.
2. **Area.**
   $$\begin{aligned} A &= \int_0^1(x - x^2)\,dx \\ &= \frac16 \end{aligned}$$
3. **Centroid's $x$.**
   $$\begin{aligned} \bar x &= 6\int_0^1x(x - x^2)\,dx \\ &= 6\left(\tfrac13 - \tfrac14\right) \\ &= 0.5 \end{aligned}$$
4. **Centroid's $y$.** Each vertical strip's own center is halfway between its top and bottom:
   $$\begin{aligned} \bar y &= 6\int_0^1\tfrac12(x^2 - x^4)\,dx \\ &= 3\left(\tfrac13 - \tfrac15\right) \\ &= 0.4 \end{aligned}$$

**Answer:** the area is $\frac16$, and its centroid is at $(0.5, 0.4)$.
:::
:::

::: check
given: a = 1 | 2 | 3
answer: a^4/8
tolerance: 0.5%

## Evaluate $\iint xy\,dA$ over the triangle $0 \le y \le x \le \given{a}$.

::: right
Right. $\int_0^a x\cdot\frac{x^2}{2}\,dx = \frac{a^4}{8}$ = {answer}.
:::

::: misses
- [a^4/4] The inner integral of $y$ from 0 to $x$ is $\frac{x^2}{2}$.
- [a^4/2] That's the square $[0, a]^2$'s value times 2: integrate over the triangle.
- [any] Not yet. Vertical strips: $y$ from 0 to $x$.
:::
:::

::: check
given: k = 2 | 5; a = 1 | 3
answer: k*a^3/3
unit: nC
tolerance: 0.5%

## A triangular plate covers $0 \le y \le x \le \given{a}$ (m) with charge density $\sigma = \given{k}x$ nC/m². What is its total charge, in nC?

::: right
Right. $\int_0^a\int_0^x kx\,dy\,dx = \int_0^a kx^2dx = \frac{ka^3}{3}$ = {answer}.
:::

::: misses
- [k*a^3/2] The strip at $x$ has height $x$, so the integrand becomes $kx^2$.
- [k*a^2/2] That integrates $\sigma$ along $x$ only; include the strip's height.
- [any] Not yet. Integrate $\sigma$ over the triangle.
:::
:::

::: check
given: c = 1 | 2 | 3
answer: c^3/6
tolerance: 0.5%

## What is the area between $y = \given{c}x$ and $y = x^2$?

::: right
Right. They meet at $x = 0$ and $x = c$; $\int_0^c(cx - x^2)\,dx = \frac{c^3}{6}$ = {answer}.
:::

::: misses
- [c^3/3] Subtract the lower curve: $\frac{c^3}{2} - \frac{c^3}{3}$.
- [any] Not yet. Find where the curves meet, then integrate the gap.
:::
:::

::: check
given: b = 0.5 | 0.8 | 1 | 1.2 | 1.5 | 2
answer: (exp(b^2) - 1)/2
tolerance: 0.5%

## Evaluate $\displaystyle\int_0^{\given{b}}\int_y^{\given{b}} e^{x^2}\,dx\,dy$.

::: right
Right. Swapped: $\int_0^b xe^{x^2}dx = \frac{e^{b^2} - 1}{2}$ = {answer}.
:::

::: misses
- [exp(b^2) - 1] Substitution gives a factor of $\frac{1}{2}$.
- [any] Not yet. Swap to $y$ from 0 to $x$, then $x$ from 0 to $b$.
:::
:::

::: check
given: a = 2 | 3; b = 1 | 4
answer: a*b*(a + b)/2

## Evaluate $\iint(x + y)\,dA$ over the rectangle $0 \le x \le \given{a}$, $0 \le y \le \given{b}$.

::: right
Right. $\frac{a^2b}{2} + \frac{ab^2}{2}$ = {answer}.
:::

::: misses
- [a*b] That's the area; weight it by $x + y$.
- [any] Not yet. Integrate each term separately.
:::
:::

::: check
given: a = 1 | 2 | 3
answer: 2*a^3/3
tolerance: 0.5%

## What is the area of the region $0 \le x \le \given{a}$, $x^2 \le y \le \given{a}^2$?

::: right
Right. Horizontally it's $0 \le y \le a^2$, $0 \le x \le \sqrt y$: $\int_0^{a^2}\sqrt y\,dy = \frac{2a^3}{3}$ = {answer}.
:::

::: misses
- [a^3/3] That's the region under the curve; this one is above it.
- [any] Not yet. $\int_0^a(a^2 - x^2)\,dx$, or slice horizontally.
:::
:::

::: check
kind: parts
given: n = 2 | 3 | 4

## The region between $y = x^{\given{n}}$ and $y = x$ for $0 \le x \le 1$.

::: part
answer: 1/2 - 1/(n + 1)
tolerance: 0.5%

### What is its area?

::: misses
- [any] $\int_0^1(x - x^n)\,dx$.
:::
:::

::: part
answer: (1/3 - 1/(n + 2))/(1/2 - 1/(n + 1))
tolerance: 0.5%

### What is its centroid's $x$ coordinate?

::: misses
- [any] $\frac{\int x(x - x^n)\,dx}{\text{area}}$.
:::
:::
:::

::: check
kind: derivation
vars: a = 0.5..2

## Evaluate $\iint_R x\,dA$ over the triangle $0 \le y \le x \le a$.

::: step
answer: a^3/3

### For each $x$, the inner integral is $\int_0^xx\,dy = x^2$. What is $\int_0^ax^2\,dx$?
:::

::: right
Right. $\int_0^ax^2\,dx = \frac{a^3}{3}$.
:::
:::

::: explain
## Why do the inner limits of a double integral depend on the outer variable, while the outer limits must be constants?

::: model
The outer variable picks a strip, and the inner integral adds up the function along that strip. For a region that isn't a rectangle, strips at different positions have different lengths: the strip at $x$ might run from $y = 0$ to $y = x^2$. So the inner limits must be written in terms of the outer variable. The outer integral then adds up all the strips, from the first to the last, and those positions are fixed numbers. After both integrals there's no variable left, just a number.
:::
:::

::: practice

::: check
given: a = 1..12 int
answer: a^2/2

## What is the area of the triangle $0 \le y \le x \le \given{a}$, by double integration?

::: misses
- [a^2] That's the square.
- [any] $\int_0^a x\,dx$.
:::
:::

::: check
given: a = 1..12 int
answer: 3*a/4
tolerance: 0.5%

## Where is the centroid $\bar x$ of the region under $y = x^2$ for $0 \le x \le \given{a}$?

::: misses
- [a/2] The region is taller on the right.
- [any] $\frac{\int x\cdot x^2dx}{\int x^2dx}$.
:::
:::

::: check
given: a = 1..9 int
answer: a^3/6
tolerance: 0.5%

## Evaluate $\displaystyle\int_0^{\given{a}}\int_0^x y\,dy\,dx$.

::: misses
- [a^3/3] The inner integral gives $\frac{x^2}{2}$.
- [any] $\int_0^a\frac{x^2}{2}dx$.
:::
:::
:::
