๐ Calculus Kingdom ยท Calculus
Riemann Sums & Approximating Area
Approximate the area under a curve with rectangles and trapezoids, say whether the estimate is too big or too small, write the limit of the sum as a definite integral, and evaluate an integral from geometry and from its properties.
In short
- A Riemann sum is (strip width) x (sum of the heights), with one height per strip. n strips means n heights, never n + 1.
- Where the height is read is the whole difference between a left, a right and a midpoint sum, and for a monotone f it decides whether the estimate is too big or too small.
- The trapezoidal rule doubles every inside value and halves the whole bracket; concave up makes it an over-estimate, concave down an under-estimate.
- A definite integral is the limit of these sums, and some of them can be read straight off geometry: area is positive, an integral is signed.
Area, before there is a formula for it
Geometry can measure a rectangle, a triangle and a trapezoid. It cannot measure the region under a curve, because the top edge will not sit still.
So do the only thing available: cover the region with rectangles you can measure, and add them up.
Cut the interval from a to b into n strips of the same width. That width is the same every time and it is worth writing down first:
width of one strip = (b - a)/n
Then give each strip a height by picking one x inside it and reading f there. Each rectangle has area height x width, and the total is an estimate of the area under the curve. A total built this way is a Riemann sum.
Two things decide a Riemann sum completely: how many strips there are, and where inside each strip the height is read. Change either one and you get a different number for the same region.
Notice what the arithmetic looks like. Every rectangle is multiplied by the same width, so the width can be factored out:
Riemann sum = width x (sum of all the heights)
Add the heights first, multiply by the width once at the end. It is less work and there is only one place left to lose the width.
Left, right and midpoint
Three standard choices of where to read the height, on the interval from a to b with n strips of width w:
- Left sum. Read f at the left edge of each strip: at a, a + w, a + 2w, up to a + (n - 1)w. The right-hand end b is never used.
- Right sum. Read f at the right edge of each strip: at a + w, a + 2w, up to b. The left-hand end a is never used.
- Midpoint sum. Read f in the middle of each strip: at a + w/2, a + 3w/2, and so on, half a width further along than the left edges.
Every one of them uses exactly n heights, one per strip. There are n + 1 edges but only n gaps between them, and it is the gaps that carry the rectangles. Counting n + 1 heights is the single most common slip here.
When f is monotone the picture settles which side of the truth the estimate falls on:
- f only rising: the left edge is the shortest point of each strip and the right edge is the tallest, so the left sum under-estimates and the right sum over-estimates.
- f only falling: the other way round. The left sum over-estimates and the right sum under-estimates.
If f rises on part of the interval and falls on the rest, neither argument applies. Some rectangles overshoot and others undershoot, and the shape alone cannot tell you which way the total leans.
A midpoint sum has no such rule, and in practice it is usually much closer than either endpoint sum: too much on one side of the middle roughly cancels too little on the other.
A Riemann sum can be read from a table as easily as from a rule. If speeds are logged every second and you want a midpoint sum over three 2-second pieces, the middles are the readings at 1, 3 and 5 seconds. The other readings are simply not used, and that is not a mistake.
The trapezoidal rule, and which way it leans
A rectangle has a flat top, which is a poor match for a sloping curve. Join the two points of the curve at the edges of a strip with a straight chord instead, and each strip becomes a trapezoid.
One trapezoid of width w with heights h1 and h2 at its two edges has area ((h1 + h2)/2) x w. Add the trapezoids across the whole interval and every inside edge gets counted twice, once for the strip on its left and once for the strip on its right:
trapezoidal estimate = (w/2) x [f0 + 2f1 + 2f2 + ... + 2f(n-1) + fn]
Only the first and last values are counted once, because each of them belongs to a single trapezoid. Every value in between is doubled. Both the doubling and the division by 2 are easy to drop, and dropping either changes the answer by a lot.
There is a second way to see the same formula: the trapezoidal estimate is exactly the average of the left sum and the right sum. That is a fast way to check it.
Concavity decides which way a trapezoidal estimate leans, and the argument is about chords, not about endpoints:
- f concave up (bending upward): a chord joining two points of the curve lies above the curve, so every trapezoid holds a little too much. The estimate is an over-estimate.
- f concave down (bending downward): the chord lies below the curve, so every trapezoid misses a sliver. The estimate is an under-estimate.
The trapezoidal rule is exact only for a straight line, where the chord is the curve.
The limit of the sum is the integral
Every Riemann sum is an estimate. Use more strips and the estimate improves; the natural question is what it improves towards.
That limit is the definite integral:
the integral from a to b of f(x) dx = the limit, as n grows without bound, of the sum of f(sample point) x width
Written out with right-hand sample points, the width is (b - a)/n and the i-th sample point is a + i(b - a)/n. For the interval from 1 to 3 with f(x) = x2, the width is 2/n, the i-th point is 1 + 2i/n, and the sum is
the sum from i = 1 to n of ((1 + 2i/n)2)(2/n)
which becomes the integral from 1 to 3 of x2 dx.
Reading such a limit backwards is a standard exercise, and it needs only two observations:
- The factor multiplying every term is the width, so it tells you b - a. A factor of 2/n means the interval has length 2, not that b is 2.
- The number the sample point counts up from is a. In 1 + 2i/n that number is 1, so the interval is from 1 to 1 + 2 = 3.
Whatever the sample point is fed into is the integrand, unchanged. The width factor becomes the dx of the integral; it never becomes a coefficient in front of the function.
Integrals from geometry, and their properties
Some definite integrals need no antiderivative at all, because the region really is a shape geometry already knows.
- A constant. The integral from a to b of c dx is the rectangle c(b - a).
- A line. The region is a triangle or a trapezoid. Where the line crosses the axis inside the interval, split the region at the crossing and treat the two pieces separately.
- A semicircle. y = sqrt(r^2 - x2) is the top half of the circle x2 + y2 = r2. From -r to r the region is half that circle, so the integral is (pi r2)/2; from 0 to r it is a quarter, (pi r2)/4. Answers here are exact multiples of pi.
Two words that are often used as if they meant the same thing do not. Area is always positive. An integral is signed: a part of the region below the x-axis counts as negative. For a graph that dips below the axis the two questions have different answers, and the question always says which one it wants.
The properties of the definite integral let one integral be built out of others, again with no antiderivative in sight:
integral from a to a of f = 0 integral from b to a of f = -(integral from a to b of f) integral from a to b of f + integral from b to c of f = integral from a to c of f integral of k f = k x (integral of f) integral of (f + g) = integral of f + integral of g
So if the integral of f from 1 to 4 is 7 and the integral of f from 4 to 9 is -3, then the integral of f from 1 to 9 is 7 + (-3) = 4, and the integral of (3f(x) - 2) from 1 to 9 is 3(4) - 2(9 - 1) = 12 - 16 = -4. The constant term contributes its own rectangle, which is easy to forget.
Worked examples
Example 1
f(x) = x2 + 1. Estimate the area under y = f(x) from x = 0 to x = 4 with a left Riemann sum using 4 rectangles of equal width, then say whether the estimate is too big or too small.
- Width of each strip: (4 - 0)/4 = 1.
- A left sum reads the heights at the left edges: x = 0, 1, 2, 3. The right-hand end x = 4 is not used.
- Heights: f(0) = 1, f(1) = 2, f(2) = 5, f(3) = 10.
- Total of the heights: 1 + 2 + 5 + 10 = 18.
- Left sum = 1 x 18 = 18.
- On [0, 4] the function only rises, so the left edge is the shortest point of each strip. Every rectangle sits under the curve, so 18 is an under-estimate.
Example 2
A cart is timed and its speed recorded every 2 seconds: at t = 0, 2, 4, 6, 8 the speeds are 3, 8, 9, 13, 14 metres per second. Use the trapezoidal rule on all five readings to estimate how far the cart travels in those 8 seconds.
- The readings are 2 seconds apart, so the five readings make four trapezoids side by side, each 2 seconds wide.
- The first and last readings belong to one trapezoid each, so they are counted once. Every reading in between belongs to two, so it is doubled.
- Bracket: 3 + 2(8 + 9 + 13) + 14 = 3 + 60 + 14 = 77.
- Trapezoidal estimate = (2/2) x 77 = 77.
- The cart travels about 77 metres. (Check: the average of the left sum 2(3 + 8 + 9 + 13) = 66 and the right sum 2(8 + 9 + 13 + 14) = 88 is 77, as it should be.)
Example 3
The graph of f is made of straight pieces joining (0, 4), (2, 0), (5, -3) and (7, 0) in order. Find the integral of f from x = 0 to x = 7, and also the total area between the graph and the x-axis.
- The graph changes side only at the corners (2, 0) and (7, 0), so no piece has to be split: each one stays on one side of the axis.
- From x = 0 to x = 2: a triangle of base 2 and height 4, above the axis, so it contributes ((4 + 0)/2) x 2 = 4.
- From x = 2 to x = 5: a triangle of base 3 and height 3, below the axis, so it contributes ((0 + (-3))/2) x 3 = -4.5.
- From x = 5 to x = 7: a triangle of base 2 and height 3, below the axis, so it contributes (((-3) + 0)/2) x 2 = -3.
- Integral = 4 + (-4.5) + (-3) = -7/2, since the parts below the axis are subtracted.
- Total area = 4 + 4.5 + 3 = 23/2, since a total area counts every part as positive.
Practice problems, with solutions
Three problems of increasing difficulty, each with the full working. In the game these are generated fresh every time; these three are fixed so this page always shows the same ones.
Problem 1
Difficulty 1 of 5f(x) = -2x + 11. Estimate the area under y = f(x) from x = 0 to x = 3 with a LEFT Riemann sum using 3 rectangles of equal width. Give an exact answer (a fraction in lowest terms if it is not a whole number).
Answer: 27
- Strip width: (3 - 0)/3 = 1
- Left edges: x = 0, 1, 2
- Heights: f(0) = 11, f(1) = 9, f(2) = 7
- Total of the heights: 27
- Left sum = (1)(27) = 27
Problem 2
Difficulty 3 of 5f(x) = 2x2 - 36x + 166. Estimate the area under y = f(x) from x = 0 to x = 8 with a RIGHT Riemann sum using 4 rectangles of equal width. Give an exact answer (a fraction in lowest terms if it is not a whole number).
Answer: 368
- Strip width: (8 - 0)/4 = 2
- Right edges: x = 2, 4, 6, 8
- Heights: f(2) = 102, f(4) = 54, f(6) = 22, f(8) = 6
- Total of the heights: 184
- Right sum = (2)(184) = 368
Problem 3
Difficulty 4 of 5f(x) = 3x + 2. Estimate the area under y = f(x) from x = 2 to x = 8 with a MIDPOINT Riemann sum using 5 rectangles of equal width. Give an exact answer (a fraction in lowest terms if it is not a whole number).
Answer: 102
- Strip width: (8 - 2)/5 = 6/5
- Middles: x = 13/5, 19/5, 5, 31/5, 37/5
- Heights: f(13/5) = 49/5, f(19/5) = 67/5, f(5) = 17, f(31/5) = 103/5, f(37/5) = 121/5
- Total of the heights: 85
- Midpoint sum = (6/5)(85) = 102
Common mistakes
- Using n + 1 rectangles. There are n + 1 edges but only n strips, so a sum with n strips adds exactly n heights โ you cannot use both ends and every inside edge.
- Adding the heights and stopping there. A height is a length until it is multiplied by the strip width; the multiplication is what turns it into an area.
- Reading a left sum at the right edges (or the other way round). A left sum starts at x = a and stops before x = b; a right sum starts one strip in and finishes at x = b.
- Forgetting to double the inside values in the trapezoidal rule, or forgetting to halve the bracket. Every inside edge is shared by two trapezoids, and a trapezoid uses the average of its two parallel sides.
- Reading the width factor of a Riemann sum as the upper limit. In a sum with a factor of 2/n over sample points 1 + 2i/n, the 2 is the LENGTH of the interval, so the integral runs from 1 to 3, not from 1 to 2 or from 0 to 2.
- Giving the total area when the question asked for the integral. A part of the region below the x-axis is subtracted in an integral and counted positively in a total area, so for a graph that dips below the axis the two answers differ.
What you should be able to do
- Compute a left, right or midpoint Riemann sum from a rule or a table.
- Apply the trapezoidal rule, and say whether an estimate is an over- or under-estimate.
- Write the limit of a Riemann sum as a definite integral, and read one back.
- Evaluate a definite integral from geometry and from the properties of integrals.
Where this fits in the curriculum
Common Core
- LIM-5.A
AP Calculus AB, Unit 6 โ Approximate a definite integral using geometric and numerical methods.
The Common Core has no calculus standards; this is the AP Calculus AB learning objective.
- LIM-5.B
AP Calculus AB, Unit 6 โ Interpret the limiting case of the Riemann sum as a definite integral.
The Common Core has no calculus standards; this is the AP Calculus AB learning objective.
- LIM-5.C
AP Calculus AB, Unit 6 โ Represent the limiting case of the Riemann sum as a definite integral.
The Common Core has no calculus standards; this is the AP Calculus AB learning objective.
- FUN-6.A
AP Calculus AB, Unit 6 โ Calculate a definite integral using areas and properties of definite integrals.
The Common Core has no calculus standards; this is the AP Calculus AB learning objective.