What area under a curve means
The area under the graph of from to is the region between the curve and the -axis over that stretch. Its units are height units times width units.
That makes area more than geometry. A car at 60 km per hour for 2 hours covers km. That is the area of a rectangle of height 60 and width 2 under the graph of its speed.
When the speed changes, the region under the speed graph is no longer a rectangle, but its area is still the distance. No school formula gives the area under a curve. So this lesson cuts the region into thin strips, covers each with a rectangle, and adds up the rectangles.
Rectangles under
Take from 0 to 1. Cut into strips of equal width . Each strip gets a rectangle whose height is the value of at one point of the strip.
| heights taken at | points | heights | total area |
|---|---|---|---|
| left ends | 0.21875 | ||
| right ends | 0.46875 | ||
| midpoints | 0.328125 |
Each total is the sum of the four heights times the width . For the left ends, . The three totals differ, so each is only an estimate of the area.
Writing the sum with Σ
Number the strips . Strip runs from to , where , so and . Write (read "x i star") for the point where strip takes its height.
Rule: Riemann sum
Each term is one rectangle: height times width . The left sum takes , the right sum , and the midpoint sum the middle of the strip, .
Every term has the same width, so comes out in front: . That is the constant multiple rule of lesson 0.2.2, and it is why each total above is "add the heights, then multiply by ".
Try it
riemann is the rule above, for all three choices of point. The cell prints the three totals of the table.
np.arange(n) numbers the strips , because Python counts from 0. So the strip numbered i starts at .
Too large or too small?
For a rising curve, the left sum is too small and the right sum too large. For a falling curve it is the other way round.
On a strip where rises, the left end is the lowest point. So the left rectangle sits under the curve and misses a sliver of area, while the right rectangle pokes above it. rises on , so the left sum 0.21875 is too small and the right sum 0.46875 too large.
falls on . With 4 strips its left sum is 0.759524 and its right sum 0.634524. The exact area is (lesson 2.5.3 shows why), so now the left sum is too large and the right sum too small.
Rule: Which way the error goes
The exact area is trapped between the two sums. A curve that rises and then falls follows neither line. For on with 4 strips, both sums are 1.896119, under the exact area 2.
The midpoint sum lands on a side that depends on how the curve bends (lesson 2.4.2). It is too small for (0.328125) and (0.69122), which bend up. It is too large for on (2.052344), which bends down.
The gap between the left and right sums has a simple formula. Both use the heights at ; only the two ends differ. So the right sum minus the left sum is : for with 4 strips, .
Try it in the explorer. It starts with the four left rectangles of the table: switch to right ends and midpoints and compare the totals. Then pick on and watch the left and right sums swap sides, and finally raise towards 100.
Explore
Add rectangles and change where each takes its height. The total area of the rectangles closes in on the exact area under the curve.
- Width of each
- 1 ÷ 4 = 0.25
- Total of 4 rectangles
- 0.21875
- Exact area
- 1/3 = 0.333333
- Error
- −0.114583 (an underestimate)
Thinner strips, smaller errors
As the strips get thinner, all three sums close in on the same number. For on :
| strips | 4 | 10 | 100 | 10000 |
|---|---|---|---|---|
| left sum | 0.21875 | 0.285 | 0.32835 | 0.333283 |
| right sum | 0.46875 | 0.385 | 0.33835 | 0.333383 |
| midpoint sum | 0.328125 | 0.3325 | 0.333325 | 0.333333 |
The left and right errors shrink in step with . Ten times as many strips cut the left error about ten times, from 0.04833 at to 0.00498 at . The midpoint error shrinks with : ten times as many strips cut it a hundred times, from 0.00083 to 0.0000083.
So the midpoint sum is the one to use when you estimate an area in code. Lesson 2.8.2 builds Simpson's rule, which is faster still.
The same limit by algebra
For the right sum of on , the points are and the width is . Pulling out in front leaves the sum of the first squares.
The last line uses the formula , which the Proof Gym proves by induction. For it gives , the sum of lesson 0.2.2. Then , the right sum in the table.
As , the top grows like and the bottom is , so (the biggest power wins, lesson 2.1.3). The error is , about : it halves each time doubles.
Try it
Each line prints , the left, midpoint and right sums, then the algebra's formula for the right sum. The last two numbers agree.
round(…, 6) keeps six decimal places, as in the table.
The definite integral
When the sums for every choice of point settle on one number, that number is the definite integral. They do for every continuous (lesson 2.1.2) on a closed interval .
Rule: Definite integral
The sign is a stretched S, for "sum". is the integrand, and are the lower and upper limits of integration, and recalls the width . So .
A definite integral is a number, in height units times width units. For the car, km.
The letter inside is a placeholder, like the index of a sum in lesson 0.2.2: and are the same number. If blows up inside , as does at 0, the sums need not settle. Lesson 2.6.3 deals with such integrals.
Signed area
Where is negative, the integral counts the area as negative. Below the axis, each height is negative, so each term is negative too.
So the integral adds the area above the axis and subtracts the area below. This is the net, or signed, area. The total area counts every piece as positive.
The region between and the axis from to 2. The integral is the net area, ; the total area is .
Both triangles can be checked with : above the axis, and below it. So .
A net area of zero does not mean there is no area. On , the dip of below the axis is a mirror image of the hump above it, so they cancel: . Each piece has area 2 (the explorer gives this exact area for on ), so the total area is 4.
Rule: Net and total area
The integral is the net area. The total area is the integral of , which flips the parts below the axis up. Lesson 2.5.3 finds both exactly.
Try it
Midpoint sums with 1200 strips for both examples. Each line prints the net area, then the total area from np.abs.
Unrounded, the total area of is 4.0000046. The midpoint sum is a little too large, because both humps of bend down. round(…, 4) keeps four decimal places.
Common mistakes
- Height times width. Each term is . Adding the heights alone forgets the width.
- The width is , not . With 4 strips on , .
- Count the points. strips have edges. The left sum uses the first of them, the right sum the last .
- "The left sum is too small" holds only for a rising curve. For a falling curve it is too large.
- A net area of 0 does not mean no area. on has net area 0 and total area 4.
- A Riemann sum is an estimate. The integral is its limit as .
Riemann sums and 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
- The area under from to is in height units times width units; under a speed graph it is a distance.
- A Riemann sum adds rectangles of width , with heights at the left ends, the right ends or the midpoints.
- For a rising the left sum is too small and the right sum too large; for a falling the reverse. They differ by .
- Left and right errors shrink like , midpoint errors like .
- The definite integral is the limit of the sums as .
- The integral is the net area: area below the axis counts as negative. The total area counts every piece as positive.