---
title: "Multiple integrals: charge from charge density"
heading: Adding up a quantity spread over an area or a volume
eyebrow: A9 · Lesson 14 · Multiple integrals
xp: 40
---

::: hook
Charge on a capacitor plate isn't piled at one point: it's spread over the surface, more in some places than others. A charge density says how much there is per square meter at each point. To get the total, you add up density times area over the whole plate, and that's a double integral. The trick that makes it easy is to do it one direction at a time.

::: play
- The map shows a charge density $\sigma(x, y) = 1 + xy/2$ in nC/m², and the rectangle is a region you choose. The readout is the total charge inside.
- The graph below slices the rectangle into thin strips across $y$. Its curve is the charge per meter of each strip; the shaded area under it, from $x_1$ to $x_2$, is the total.
- Move the rectangle's edges. Where does the density help the total most?
:::
:::

```sim plot
view: flow
x: x = -3..3 m
y: y = -2..2 m
slider: x1 = -3..3 step 0.1 = -1
slider: x2 = -3..3 step 0.1 = 2
slider: y1 = -2..2 step 0.1 = 0
slider: y2 = -2..2 step 0.1 = 1.5
shade: 1 + x*y/2 | contours: 10 | scale: 4
path: x1 + (x2 - x1)*u, y1 | over: u = 0..1 | color: ch3
path: x2, y1 + (y2 - y1)*u | over: u = 0..1 | color: ch3
path: x2 + (x1 - x2)*u, y2 | over: u = 0..1 | color: ch3
path: x1, y2 + (y1 - y2)*u | over: u = 0..1 | color: ch3
readout: Q (nC) = (x2 - x1)*(y2 - y1) + (x2^2 - x1^2)*(y2^2 - y1^2)/8
```

```sim plot
view: graph
x: x = -3..3 m
y: g = -4..6 nC/m
slider: x1 = -3..3 step 0.1 = -1
slider: x2 = -3..3 step 0.1 = 2
slider: y1 = -2..2 step 0.1 = 0
slider: y2 = -2..2 step 0.1 = 1.5
plot: (y2 - y1) + x*(y2^2 - y1^2)/4 | fill: x1..x2 | label: charge per meter of strip
readout: area under the curve (nC) = (x2 - x1)*(y2 - y1) + (x2^2 - x1^2)*(y2^2 - y1^2)/8
```

::: predict
## The density is $\sigma = 1 + xy/2$. Over a rectangle centered on the origin, say $-1 \le x \le 1$ and $-1 \le y \le 1$, what does the $xy/2$ part add to the total?

- [ ] Something positive
- [ ] Something negative
- [x] Nothing
- [ ] It depends on the rectangle's size

::: reveal
Nothing. On that rectangle $xy$ is positive in two quarters and negative in the other two, by exactly matching amounts, so its integral cancels. The total is just the constant part times the area: 4 nC. Symmetry like this saves a lot of work: before integrating anything, check whether parts of it cancel.
:::
:::

::: nameit
## Double and triple integrals

**The idea.** Cut a region $R$ into small patches of area $\Delta A$, multiply the density at each patch by its area, and add up. As the patches shrink this becomes the **double integral**

$$\iint_R f(x, y)\,dA$$

With $f = 1$ it's the area of R. With $f = \sigma$, a surface charge density, it's the total charge. Divided by the area, it's the average value of $f$.

**Iterated integrals.** On a rectangle $a \le x \le b$, $c \le y \le d$, add up along each strip first, then add up the strips:

$$\iint_R f\,dA = \int_a^b\left(\int_c^d f(x, y)\,dy\right)dx$$

The inner integral treats $x$ as a constant, exactly like a partial derivative in reverse. For $\sigma = 1 + xy/2$ the inner integral is $(d - c) + x(d^2 - c^2)/4$, the curve in the second sim. You can do it in either order and get the same answer.

**Regions that aren't rectangles.** Let the inner limits depend on the outer variable. For the triangle under $y = x$ from $x = 0$ to $a$: $\int_0^a\int_0^x f\,dy\,dx$. With $f = 1$ that gives $\int_0^a x\,dx = a^2/2$, the triangle's area.

**Three kinds of density** need three kinds of integral:

| Density | Unit | Total charge |
|---|---|---|
| line charge λ (along a wire) | C/m | $Q = \int \lambda\,dl$ |
| surface charge σ (on a plate) | C/m² | $Q = \iint \sigma\,dA$ |
| volume charge ρ (in a material) | C/m³ | $Q = \iiint \rho\,dV$ |

A **triple integral** works the same way, one direction at a time, over a volume. The same integrals give mass from density, current from current density (lesson 31), and energy from the energy density $\tfrac12\varepsilon_0E^2$ stored in a field.
:::

::: example
## Evaluate $\iint xy\,dA$ over the rectangle $[0, 2] \times [0, 3]$.

::: solution
1. **Separate the integral.** The integrand is a product and the region is a rectangle:
   $$\int_0^2x\,dx \times \int_0^3y\,dy$$
2. **Evaluate each factor.**
   $$2 \times 4.5 = 9$$

**Answer:** the integral is 9.
:::
:::

::: example
## Find the volume under $z = 4 - x^2 - y^2$ above the unit square $[0, 1]^2$.

::: solution
1. **Integrate term by term.**
   $$\begin{aligned} V &= \iint(4 - x^2 - y^2)\,dA \\ &= 4 - \frac{1}{3} - \frac{1}{3} \\ &= 3.33 \end{aligned}$$

**Answer:** the volume is 3.33.
:::
:::

::: example
## What is the average of $f = x^2 + y^2$ over the unit square $[0, 1]^2$?

::: solution
1. **Average is integral over area.** The area here is 1, so the average is the integral itself.
2. **Integrate.**
   $$\begin{aligned} &\iint(x^2 + y^2)\,dA \\ &= \int_0^1\int_0^1x^2\,dx\,dy \\ &\quad + \int_0^1\int_0^1y^2\,dx\,dy \\ &= \tfrac13 + \tfrac13 \\ &= \tfrac23 \end{aligned}$$
3. **Interpret.** The average squared distance from the corner is $\frac23$. In the same way, the average power of a signal is the integral of its square divided by the time.

**Answer:** the average of $f$ over the square is $\frac23$.
:::
:::

::: check
given: s = 1..9 int; a = 2..9 int; b = 2..9 int
answer: s*a*b*1e-4
unit: nC
tolerance: 0.5%

## A rectangular plate {a} cm × {b} cm carries a uniform charge density of {s} nC/m². What is its total charge?

::: right
Right. A uniform density times the area: {s} nC/m² × {a} cm × {b} cm = {answer}.
:::

::: misses
- [s*a*b] Convert cm² to m²: $1\text{ cm}^2 = 10^{-4}\text{ m}^2$.
- [s*a*b*1e-2] $1\text{ cm}^2$ is $10^{-4}$ m², not $10^{-2}$.
- [any] Not yet. $Q = \sigma A$ with A in m².
:::
:::

::: check
given: a = 1 | 3; b = 2 | 5 | 6
answer: a^2*b^2/4
tolerance: 0.5%

## Find $\displaystyle\iint_R xy\,dA$ over the rectangle $0 \le x \le \given{a}$, $0 \le y \le \given{b}$.

::: right
Right. $\int_0^{\given{a}} x\,dx \cdot \int_0^{\given{b}} y\,dy = \tfrac{\given{a}^2}{2} \cdot \tfrac{\given{b}^2}{2}$ = {answer}.
:::

::: misses
- [a^2*b^2/2] Each integral contributes a ½: $\int_0^a x\,dx = a^2/2$.
- [a*b] That's the area. Integrate $xy$ over it.
- [any] Not yet. Integrate over y first, treating x as a constant, then over x.
:::
:::

::: check
given: c = 1..5 int; a = 2 | 4; b = 1 | 3
answer: c*a*b + a^2*b/2
tolerance: 0.5%

## Find $\displaystyle\iint_R (\given{c} + x)\,dA$ over $0 \le x \le \given{a}$, $0 \le y \le \given{b}$.

::: right
Right. The inner integral over y gives $\given{b}(\given{c} + x)$; then $\int_0^{\given{a}}\given{b}(\given{c} + x)\,dx$ = {answer}.
:::

::: misses
- [c*a*b] Don't forget the x part: it adds $a^2b/2$.
- [c*a*b + a^2*b] $\int_0^a x\,dx = a^2/2$.
- [any] Not yet. Integrate over y, then over x.
:::
:::

::: check
given: a = 2 | 4 | 5 | 6
answer: a^3/6
tolerance: 0.5%

## Find $\displaystyle\int_0^{\given{a}}\!\!\int_0^x y\,dy\,dx$ over the triangle under $y = x$.

::: right
Right. The inner integral is $x^2/2$, and $\int_0^{\given{a}} x^2/2\,dx = \given{a}^3/6$ = {answer}.
:::

::: misses
- [a^3/2] Integrate $x^2/2$ from 0 to {a}: that's $a^3/6$.
- [a^2/2] That's the triangle's area. Integrate $y$ over it.
- [any] Not yet. Do the inner integral first, with x as its upper limit.
:::
:::

::: check
given: rho = 1..9 int; L = 1..5 int
answer: rho*1e-6*(L/1000)^3*1e9
unit: nC
tolerance: 0.5%

## A cube of semiconductor {L} mm on a side holds a uniform charge density of {rho} µC/m³. What is its total charge?

::: right
Right. $Q = \rho V$ = {answer}.
:::

::: misses
- [rho*1e-6*(L/1000)^2*1e9] Use the volume, $L^3$.
- [rho*L^3*1e9] Convert µC/m³ to C/m³ and mm³ to m³.
- [any] Not yet. $Q = \rho V$, in SI units.
:::
:::

::: check
kind: parts
given: a = 2 | 3; b = 1 | 4

## Integrate over the rectangle $[0, \given{a}] \times [0, \given{b}]$.

::: part
answer: a^2*b^2/4
tolerance: 0.5%

### What is $\iint xy\,dA$?

::: misses
- [a*b] Integrate each variable: $\frac{a^2}{2} \cdot \frac{b^2}{2}$.
- [any] It separates into $\int_0^ax\,dx\int_0^by\,dy$.
:::
:::

::: part
answer: (a^2 + b^2)/3
tolerance: 0.5%

### What is the average of $x^2 + y^2$ over it?

::: misses
- [any] The average of $x^2$ over $[0, a]$ is $\frac{a^2}{3}$.
:::
:::
:::

::: check
kind: derivation
vars: a = 0.5..3, b = 0.5..3

## Find the volume under $z = x + y$ over $[0, a] \times [0, b]$.

::: step
answer: a^2*b/2

### What is $\iint x\,dA$?
:::

::: step
answer: a^2*b/2 + a*b^2/2

### What is the volume?
:::

::: right
Right. $\frac{ab(a + b)}{2}$: the area $ab$ times the average height $\frac{a + b}{2}$.
:::
:::

::: explain
## Why can a double integral over a rectangle be done as two ordinary integrals, one after the other?

::: model
The double integral adds up density times area over the whole rectangle. You can organize that sum by first adding along a thin strip at a fixed x, which is an ordinary integral over y with x held constant, giving the amount per unit width of that strip. Then you add up the strips across the rectangle, which is an ordinary integral over x. Every small patch gets counted exactly once either way, so the order doesn't matter.
:::
:::

::: practice

::: check
given: a = 2 | 3; b = 4 | 5
answer: (a^2*b + a*b^2)/2
tolerance: 0.5%

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

::: misses
- [a + b] Integrate over the region.
- [any] Do the two parts separately: $\iint x\,dA + \iint y\,dA$.
:::
:::

::: check
given: a = 2..9 int; b = 2..9 int
answer: a^2/3
tolerance: 0.5%

## What is the average value of $x^2$ over the rectangle $0 \le x \le \given{a}$, $0 \le y \le \given{b}$?

::: misses
- [a^2/2] The average of $x^2$ over $[0, a]$ is $a^2/3$.
- [a^3*b/3] That's the integral. Divide by the area.
- [any] Integrate, then divide by the area $\given{a}\given{b}$.
:::
:::

::: check
given: s = 1..9 int; R = 1 | 3 | 5
answer: s*pi*R^2
unit: nC
tolerance: 0.5%

## A disk of radius {R} m has a uniform charge density of {s} nC/m². What is its total charge?

::: misses
- [s*2*pi*R] Use the area, $\pi R^2$.
- [any] $Q = \sigma\pi R^2$.
:::
:::
:::
