Volume under a surface
A function of two variables gives a height for each point of the plane, and its graph is a surface (lesson 4.1.1). Over a region of the -plane, the solid between and the surface has a volume. The double integral is that volume.
Its units are the height's units times area units. If is a depth of water in metres over a pond measured in metres, the double integral is a volume in cubic metres. If is a density in kilograms per square metre, it is a mass in kilograms.
A constant height is the simplest case. Water 0.5 m deep over a pool 4 m by 3 m has volume cubic metres: height times area. When the height varies, cut the region into small cells, as lesson 2.5.1 cut an interval into strips.
Boxes on a grid
Take , a bowl, over the rectangle : the points with and . Cut into strips of width , and into strips of width . That makes 8 cells, each of area .
Over each cell stand a box whose height is at the cell's midpoint. The heights are:
| 1.1875 | 1.6875 | 2.6875 | 4.1875 | |
| 0.1875 | 0.6875 | 1.6875 | 3.1875 |
The heights add up to 15.5, so the 8 boxes have volume . The exact volume, found below, is 4.
Rule: Double integral
Each term is one box: the height at a point of the cell, times the cell's area . The limit lets the cells shrink in both directions. is a small piece of area, as was a small piece of length in lesson 2.5.1.
The volume under , estimated by 8 boxes, and one slice of it. The shaded slice at has area ; adding up all the slices gives the volume.
Finer grids close in on the volume. The midpoint error shrinks with the square of the cell width, as in one variable (lesson 2.5.1). Cells 10 times narrower give an error 100 times smaller.
| cells | |||
|---|---|---|---|
| midpoint sum | 3.875 | 3.995 | 3.99995 |
| error | 0.125 | 0.005 | 0.00005 |
Try it
mid2 is the midpoint sum on an grid. np.meshgrid pairs every midpoint in with every midpoint in , so f(X, Y) holds all the box heights at once.
The loop prints the table; 5e-05 means . round hides float noise in the last digits.
Slices: the iterated integral
The exact volume comes from slicing. Hold fixed and the solid's cross-section is the region under the curve , a slice as in lesson 4.1.1. Its area is an ordinary integral in , with treated as a constant (lesson 2.5.3):
The slice at , shaded in the figure, has area . At the slice has area 0.667, and at it has 4.667.
A thin slab of thickness has volume about . Adding the slabs is a second integral, this time in :
Rule: Iterated integral over a rectangle
The inner integral holds fixed and gives the area of a slice, a function of . The outer integral adds the slices. The brackets are usually left out: read from the inside out, so goes with the inner sign.
The other order
Slice the other way: hold fixed and integrate across first. The slice at a fixed has area , and again.
Rule: Fubini's theorem
For continuous on the rectangle, both orders give the same number, the double integral. Stated here without proof.
The condition matters. blows up at the corner of the unit square, and its two orders give and .
A function that blows up needs care, as in lesson 2.6.3. For a function that is never negative, such as the bell of lesson 4.7.3, the two orders always agree, even over the whole plane.
A product splits
When , the inner integral in is times the number . So the double integral is a product of two single integrals:
Over , . Lesson 4.7.3 uses this to find the Gaussian integral.
Try it
SymPy integrates the inside first: sp.integrate(f, (y, 0, 1)) is the slice area . Integrating that in gives the volume, and the second line does the other order.
The last lines check the product rule and the two orders of .
Signed volume and area
Where is negative, a box hangs below the -plane, and its volume counts as negative, as signed area did in lesson 2.5.1. Take over . It is negative on the triangle where .
The inner integral is , and . That is the net volume: above the plane minus below it. The total volume, the integral of , is .
With every box has height 1, so the volume equals the base area. That turns a double integral into a way to find areas.
Rule: Signed volume and area
Volume below the -plane counts as negative. The total volume is , which counts every part as positive.
Regions between two curves
Most regions are not rectangles. Take the region between the parabola and the line ; they meet at and , and the line is on top. A vertical slice at runs from up to , so the inner limits depend on .
One region, sliced two ways. With fixed, runs from the parabola up to the line. With fixed, runs from the line across to the parabola, written as .
Its area is . For , the inner integral holds fixed:
Horizontal slices describe the same region differently. At a fixed , runs from the line, , to the parabola, , for from 0 to 1. Then as well.
Rule: Iterated integral over a region
The inner limits may depend on the outer variable; the outer limits are numbers. To change the order, draw the region and describe it again with slices the other way. Swapping the limits alone describes a different region.
Swapping the limits alone gives , the region's mirror image in the line . For the mistake hides, because is the same in the mirror. For it shows: the right answer is , but the swapped limits give .
Choosing the order
The order can decide whether an integral can be done at all. Take the triangle where , and
The inner integral needs an antiderivative of , and there is none made of familiar functions (lesson 2.6.1). Slice the other way: for each from 0 to 1, runs from 0 to . The inner integral is now easy, since does not depend on :
That is about 0.859141, by the substitution of lesson 2.6.1.
Try it
SymPy finds both orders over the region between and , and shows the swapped-limits mistake for .
For the triangle, SymPy's inner integral of in needs erfi, a new function (lesson 2.6.1). In the other order it gives , written -1/2 + E/2.
In Python: dblquad
scipy.integrate.dblquad(func, a, b, gfun, hfun) computes numerically. It returns the value and an estimate of its error, like quad in lesson 2.5.3. The limits gfun and hfun can be numbers or functions of .
The trap is the order of the arguments: func must take the inner variable first, func(y, x). Written as lambda x, y:, the letters swap roles and dblquad integrates a different function.
Try it
The cell checks the bowl, the region between and , and the triangle in both orders; [0] keeps the value.
The last line integrates over , which is . Written with the arguments the wrong way round, it returns .
Lesson 4.7.2 changes variables in a double integral, and case study 4.7.5 integrates a probability density over a region to get a probability.
Common mistakes
- A box is height times area. Each term is ; adding the heights alone leaves out .
- The inner integral treats the outer variable as a constant. In , integrates to .
- The outer limits are numbers. Only the inner limits may depend on a variable, and only on the outer one.
- Redraw the region to change the order. becomes , not .
dblquadwantsfunc(y, x), the inner variable first.- Volume below the plane counts as negative. For the total volume, integrate .
- The product rule needs a rectangle. Over a region between curves the inner limits depend on , and the integral does not split.
Double integrals
0 of 12 correct
- 1.
- 2.
- 3.
- 4.
- 5.
- 6.
- 7.
- 8.
- 9.
- 10.
- 11.
- 12.
How to type answers
- Powers with
^:x^7,2^(1/3),a^-2. - Multiply with
*or by writing side by side:3x^2,2(x+1). ln(x)is the natural log,log(x, 2)is log base 2,eis Euler's number,sqrt(x)is a square root.sin(x),cos(x)andtan(x)take radians; writepifor π andsin(x)^2for sin²x.- Your first answer to each question is saved: it counts towards your score and brings the question back for review.
- Exact answers like
ln(20)/ln(3)are best. Decimals need about 4 significant figures.
Summary card
- is the volume under over , in height units times area units: the limit of sums of boxes .
- Iterated integral: integrate across a slice with the other variable held fixed, then add the slices. Over a rectangle, either order gives the same answer for a continuous (Fubini).
- Over a rectangle, .
- Volume below the plane counts as negative; is the area of .
- Between curves, : inner limits depend on the outer variable. To change the order, redraw the region; the right order can make a hard integral easy.
dblquad(func, a, b, gfun, hfun)withfunc(y, x): the inner variable comes first.