Approximating area with Riemann sums
A speedometer shows a speed at every instant, but distance is speed times time only while the speed holds still. How can rectangles, the one shape whose area is easy, measure the distance covered while the speed keeps changing?
Where you are 16 in Integrals
Why this exists
A car holding 15 meters per second for 6 seconds covers 15 \cdot 6 = 90 meters. On a graph of velocity against time that motion is a horizontal line at height 15, and the distance is the area of the rectangle under it, width times height (Area of rectangles and squares). Once the speed changes, the graph curves, and no formula gives the area under a curve.
Over a short stretch of time, though, the speed hardly changes. Treat it as constant there, take a rectangle for that stretch, and add the rectangles. Narrower stretches give a better estimate. The same holds for any rate: a flow in liters per minute, a power in kilowatts. The area under the graph of a rate is the total amount, so “how much area is under this curve?” and “how much accumulated?” are one question.
Definition
Day 1: the region and three sums
Let f be continuous with f(x) \ge 0 on [a, b]. The region under the graph is bounded above by y = f(x), below by the x-axis, and on the sides by x = a and x = b. Write A for its area.
Cut [a, b] into n pieces of equal width
Piece k is [x_{k-1}, x_k] and carries a rectangle of width \Delta x. Its height is a value of f in that piece, chosen by one of three rules: the left end, the right end, or the midpoint \displaystyle m_k = \frac{x_{k-1} + x_k}{2}.
These are the left, right and midpoint sums. Each term is one rectangle’s area; the index k counts rectangles, as in Sigma notation. Shifting the index writes the left sum as \sum_{k=0}^{n-1} f(x_k)\,\Delta x, the same numbers added.
Day 2: unequal pieces and any sample point
A partition of [a, b] is a list a = x_0 < x_1 < \dots < x_n = b. The pieces may have different widths \Delta x_k = x_k - x_{k-1}. Choose a sample point c_k anywhere in piece k, ends included. The sum
is a Riemann sum for f on [a, b], named for Bernhard Riemann. Left, right and midpoint sums are the cases where every c_k is a left end, a right end or a midpoint.
Intuition
Take \displaystyle v(t) = 10 + \frac{t^2}{4} on [0, 8] with four pieces. The graph rises, so the lowest point of each piece is its left end and the highest its right end.
Left rectangles miss a sliver under the curve; right rectangles overshoot by a sliver. The true area is caught between them. A midpoint rectangle overshoots on one side of its dot and falls short on the other, and the two slivers nearly cancel.
As the pieces narrow, each sliver shrinks faster than the number of slivers grows, so the error falls. Example 3 measures how fast.
Results
The three sums. With \displaystyle \Delta x = \frac{b-a}{n}, x_k = a + k\,\Delta x and \displaystyle m_k = \frac{x_{k-1} + x_k}{2}, the sums L_n, R_n, M_n are as defined above.
Bracketing by monotonicity. If f \ge 0 is increasing on [a, b], then L_n \le A \le R_n for every n. If f is decreasing, then R_n \le A \le L_n.
The gap. For any f, R_n - L_n = \dfrac{(b - a)\big(f(b) - f(a)\big)}{n}. For a monotone f this gap is the width of the bracket, and it shrinks like \displaystyle \frac{1}{n}.
Midpoint and concavity. If f \ge 0 is concave up on [a, b], then M_n \le A; if concave down, M_n \ge A. If f is linear, M_n = A exactly.
Riemann sums between the extremes. If f is increasing on [a, b], every Riemann sum on a given partition lies between the left-end sum and the right-end sum for that partition.
Why it is true
Bracketing. Suppose f is increasing on piece [x_{k-1}, x_k]. Then f(x_{k-1}) \le f(x) \le f(x_k) for every x in the piece, so the strip under the graph contains the left rectangle and sits inside the right rectangle. A region inside another has no more area (a basic property of area, taken as given here), so
where A_k is the strip’s area. Adding over k gives L_n \le A \le R_n. For a decreasing f the two ends trade places. The gap formula is Exercise 9.
Midpoint and concavity. Let T(x) = f(m_k) + f'(m_k)(x - m_k) be the tangent line at the midpoint of a piece. At the two ends of the piece, T equals \displaystyle f(m_k) - f'(m_k)\frac{\Delta x}{2} and \displaystyle f(m_k) + f'(m_k)\frac{\Delta x}{2}. The trapezoid under T has area equal to the width times the average of the two end heights, which is \Delta x \cdot f(m_k): exactly the midpoint rectangle.
A concave up graph lies above its tangent lines and a concave down graph below them. That fact is not proved here; it is proved in Concavity and inflection points for a differentiable f, and this argument uses it as given. What this section proves is the step from it to the sums. So for concave up f the strip holds at least the trapezoid’s area, which is the rectangle’s: f(m_k)\,\Delta x \le A_k. Adding gives M_n \le A. Concave down reverses every inequality. A linear f is its own tangent line, so the two areas agree.
Worked examples
Day 1: Leonor merges onto the highway
Leonor speeds up along an on-ramp. Her speedometer readings, converted to meters per second, follow \displaystyle v(t) = 10 + \frac{t^2}{4} for 0 \le t \le 8, with t in seconds. Estimate the distance she covers with L_4, R_4 and M_4, and say what the first two guarantee.
SolutionOn a short time interval the velocity is nearly constant, and distance at constant velocity is velocity times time, the area of a rectangle on the graph. So distance is the area under the velocity graph, and each sum estimates it. The units agree: meters per second times seconds is meters.
Here \displaystyle \Delta t = \frac{8 - 0}{4} = 2, the cut points are 0, 2, 4, 6, 8, and the midpoints are 1, 3, 5, 7. At the cut points v is 10, 11, 14, 19, 26, and at the midpoints it is 10.25, 12.25, 16.25, 22.25.
The left sum uses the readings at 0, 2, 4, 6; the right sum those at 2, 4, 6, 8; the midpoint sum those at 1, 3, 5, 7. Each has the common width 2 factored out:
Since \displaystyle v'(t) = \frac{t}{2} > 0 for 0 < t \le 8, the velocity is increasing (Increasing and decreasing from the derivative), so the left sum is under the distance and the right sum over it: Leonor covers between 108 and 140 meters. The midpoint estimate, 122 meters, sits inside that bracket; Example 3 shows how close it is.
Day 1: Duarte brakes to a stop
Duarte brakes his car evenly: v(t) = 20 - 2.5t meters per second for 0 \le t \le 8. Find L_4, R_4 and M_4 and compare each with the exact stopping distance.
SolutionAgain \Delta t = 2. The readings at 0, 2, 4, 6, 8 are 20, 15, 10, 5, 0, and at the midpoints 1, 3, 5, 7 they are 17.5, 12.5, 7.5, 2.5.
Here the region is a triangle with base 8 and height 20, so the exact distance is \displaystyle \frac{1}{2}(8)(20) = 80 meters (Area of triangles).
The velocity falls, so the order reverses: each left rectangle uses the largest reading in its piece and overestimates, each right rectangle underestimates, and 60 < 80 < 100. The midpoint sum is exact. On each piece the line crosses the top of the midpoint rectangle at its middle. The gap under the line on the left half and the corner of the rectangle above the line on the right half are right triangles with the same legs, 1 second and 2.5 meters per second, so the rectangle gains exactly what it loses.
Day 1: sigma notation and more rectangles for Leonor
Write L_n, R_n and M_n for Leonor’s \displaystyle v(t) = 10 + \frac{t^2}{4} on [0, 8] in sigma notation. Evaluate them for n = 4, 8, 16, 100 and compare with the exact distance, \displaystyle \frac{368}{3} \approx 122.67 meters. Take that number on trust for now: nothing in this lesson can produce it, and The fundamental theorem of calculus will show how to find it.
SolutionWith n pieces, \displaystyle \Delta t = \frac{8}{n} and \displaystyle t_k = \frac{8k}{n}, so \displaystyle v(t_k) = 10 + \frac{1}{4}\cdot\frac{64k^2}{n^2} = 10 + \frac{16k^2}{n^2}. The midpoint of piece k is \displaystyle m_k = \frac{8k - 4}{n}, and \displaystyle v(m_k) = 10 + \frac{4(2k - 1)^2}{n^2}. Each term is width times height:
For n = 4 the midpoint terms are \displaystyle 2\left(10 + \frac{(2k-1)^2}{4}\right) = 20.5, 24.5, 32.5, 44.5, which add to 122, as in Example 1. Adding the terms by computer for larger n:
| n | L_n | R_n | M_n |
|---|---|---|---|
| 4 | 108 | 140 | 122 |
| 8 | 115 | 131 | 122.5 |
| 16 | 118.75 | 126.75 | 122.625 |
| 100 | 122.0288 | 123.3088 | 122.6656 |
The errors, rounded:
| n | exact - L_n | R_n - exact | exact - M_n |
|---|---|---|---|
| 4 | 14.67 | 17.33 | 0.67 |
| 8 | 7.67 | 8.33 | 0.17 |
| 16 | 3.92 | 4.08 | 0.042 |
| 100 | 0.638 | 0.642 | 0.0011 |
Every error shrinks as n grows. Doubling n roughly halves the left and right errors and cuts the midpoint error by a factor of 4. The bracket closes at a known rate: \displaystyle R_n - L_n = \frac{8}{n}\big(v(8) - v(0)\big) = \frac{128}{n}, which is 1.28 meters at n = 100.
Day 1: reading a sum back into rectangles
Describe the rectangles behind \displaystyle \displaystyle\sum_{k=1}^{6} \frac{1}{3}\sqrt{1 + \frac{k}{3}}: the function, the interval, the number of pieces and the kind of sum. Does it overestimate or underestimate the area, and what is it?
SolutionThe factor \displaystyle \frac{1}{3} multiplying every term is the width, and there are six terms, so n = 6 and the interval has length \displaystyle 6 \cdot \frac{1}{3} = 2. The heights are \displaystyle \sqrt{x} at \displaystyle x = 1 + \frac{k}{3}, which runs \displaystyle \frac{4}{3}, \frac{5}{3}, \dots, 3 as k goes from 1 to 6. These are the right ends of the pieces of [1, 3], because k = 0, the point x = 1, is left out. So the sum is R_6 for \displaystyle f(x) = \sqrt{x} on [1, 3].
The square root is increasing, so the right sum overestimates the area. Adding the six terms gives about 2.917.
The same six numbers are also R_6 for \displaystyle \sqrt{1 + x} on [0, 2], the same rectangles slid one unit left. A sum fixes the areas of the rectangles, not the picture.
Day 2: Afonso’s bike computer
Afonso’s bike computer logs his velocity at uneven times as he speeds up along a flat road. He pushes harder the whole minute, so his acceleration v'(t) is positive throughout.
| t (s) | v(t) (m/s) |
|---|---|
| 0 | 2 |
| 10 | 5 |
| 25 | 7 |
| 30 | 8 |
| 50 | 8.5 |
| 60 | 9 |
Estimate the distance with a left and a right sum, and bracket it.
SolutionThe pieces have widths 10, 15, 5, 20, 10, and each rectangle takes its own width.
A positive derivative makes v increasing (Increasing and decreasing from the derivative), so on each piece the left reading is the lowest and the right reading the highest. Afonso rode between 375 and 455 meters. The table has no readings at the midpoints of the pieces, so no midpoint sum can be formed. Averaging the two sums, 415, is the idea behind the trapezoidal rule, a later lesson.
Day 2: snowmelt into a reservoir
On a spring day, snowmelt runs into a mountain reservoir at a rate r(t), in thousands of cubic meters per hour, t hours after 8 a.m. A hydrologist’s model has r''(t) < 0 for the whole day.
| t | r(t) | t | r(t) |
|---|---|---|---|
| 0 | 1.0 | 5 | 6.0 |
| 1 | 3.2 | 6 | 5.2 |
| 2 | 4.8 | 7 | 3.8 |
| 3 | 5.8 | 8 | 1.8 |
| 4 | 6.2 |
Estimate the water that ran in over the eight hours with M_4. Is it an overestimate or an underestimate, and do the left and right sums come with a guarantee?
SolutionFour pieces of width 2 are [0, 2], [2, 4], [4, 6], [6, 8], with midpoints 1, 3, 5, 7, all in the table:
The units are thousands of cubic meters per hour times hours, so about 37{,}600 cubic meters. Since r'' < 0, the rate is concave down, and a midpoint sum for a concave down function overestimates. The true total is less than 37.6 thousand cubic meters.
The rate rises and then falls, so r is not monotone on [0, 8], and the bracketing result does not apply to the whole interval: neither L_4 nor R_4 is known to be over or under. Concavity decides the midpoint sum where monotonicity decides nothing.
Day 2: a Riemann sum with mixed sample points
For f(x) = 16 - x^2 on [0, 4], take the partition 0, 1, 2, 3.5, 4 and the sample points c_1 = 0.5, c_2 = 2, c_3 = 3, c_4 = 4. Find the Riemann sum, then the smallest and largest Riemann sums possible on this partition.
SolutionThe widths are 1, 1, 1.5, 0.5. Each sample point lies in its piece; c_2 = 2 and c_4 = 4 are right ends, which is allowed.
Since f'(x) = -2x < 0 for x > 0, f is decreasing on [0, 4], so on each piece its largest value is at the left end and its smallest at the right end. The largest sum uses f(0), f(1), f(2), f(3.5) = 16, 15, 12, 3.75, and the smallest uses f(1), f(2), f(3.5), f(4) = 15, 12, 3.75, 0:
Every choice of sample points gives a sum between 32.625 and 50.875, and 38.25 is one of them. Refining the partition squeezes that range; the one number all Riemann sums close in on is the subject of The definite integral as a limit of Riemann sums.
Boundaries
- The bracketing result needs f monotone on the whole interval. A function that turns, like the snowmelt rate, can make a left sum fall on either side; split the interval at the turning point first if it is known.
- The midpoint result needs one concavity on the whole interval. A piece containing an inflection point carries no guarantee.
- A table records values only at its listed times. Calling a sum an overestimate needs knowledge of how the function behaves between readings, such as the sign of f' or f'', never the readings alone.
- Rectangles below the axis count negatively in a sum, since f(c_k) < 0 there. For a velocity that turns negative the sum estimates net change in position, not distance traveled. This lesson keeps f \ge 0.
- A sum needs a finite value at every sample point. For \displaystyle f(x) = \frac{1}{x} on [0, 1] the left sum does not exist, since f(0) is undefined.
Where this goes next
A sum with a fixed n is only an estimate. The definite integral as a limit of Riemann sums lets the widest piece shrink to zero and defines the exact area as the number every Riemann sum approaches. The trapezoidal rule averages the left and right sums and compares that with the midpoint sum. The fundamental theorem of calculus then finds exact areas, such as Leonor’s \displaystyle \frac{368}{3}, without adding any rectangles.
Exercises
Day 1: left, right and midpoint sums
- Find L_4, R_4 and M_4 for f(x) = x^3 on [0, 2].
- Find L_4 and R_4 for \displaystyle f(x) = \frac{1}{x} on [1, 3], as fractions, and state which inequality the area A under the graph satisfies.
- Duarte’s scooter starts from rest with velocity \displaystyle v(t) = 2\sqrt{t} meters per second for 0 \le t \le 9. Estimate the distance with L_3, R_3 and M_3.
- Find L_4 and M_4 for f(x) = \sin x on [0, \pi].
Day 1: sigma notation
- Write L_5 for f(x) = e^x on [0, 1] in sigma notation and evaluate it to four decimal places.
- Describe the rectangles behind \displaystyle \displaystyle\sum_{k=1}^{8} \frac{1}{4}\left(\frac{k}{4}\right)^2 (function, interval, n, kind of sum), find its value, and say whether it over- or underestimates the area.
- Write M_n for f(x) = x^3 on [0, 2] in sigma notation, and confirm that n = 4 gives your answer to Exercise 1.
- For Duarte’s scooter in Exercise 3, find the smallest n with R_n - L_n < 0.5.
Day 1: reasoning
- Prove that R_n - L_n = \dfrac{(b - a)\big(f(b) - f(a)\big)}{n} for any function f on [a, b].
- Leonor says: “My left sum came out below the true distance, so I must have been speeding up the whole time.” Show she is wrong using v(t) = t^2 - 2t + 2 on [0, 4] with n = 1.
- Prove that M_n = A for every n when f is linear and f \ge 0 on [a, b].
Day 2: sums from a table
- Duarte’s commuter train brakes into a station, its velocity falling the whole time. At t = 0, 3, 5, 9, 12 seconds its velocity is 30, 26, 22, 12, 0 meters per second. Find the left and right sums and bracket the distance.
- Early in the morning the snowmelt rate is rising. At t = 0, 0.5, 1.5, 2, 3.5 hours it is 0.4, 1.2, 2.0, 3.6, 5.0 thousand cubic meters per hour. Find the left and right sums and bracket the water that ran in.
- On a second ride Afonso logs his velocity every 5 seconds from t = 0 to t = 40: 3, 4.5, 5.8, 6.9, 7.8, 8.5, 9.0, 9.3, 9.4 meters per second, with v'(t) > 0 and v''(t) < 0 for 0 < t < 40. Find L_8 and M_4, and bracket the distance.
Day 2: over or under
- For f(x) = e^{-x} on [0, 2], find L_4, R_4 and M_4 to four decimal places and say whether each over- or underestimates the area, with the reason.
- Put L_n, R_n, M_n and A in order when f \ge 0 is (a) increasing and concave down, (b) decreasing and concave up, on [a, b].
Day 2: general Riemann sums
- Find the Riemann sum for f(x) = x^2 + 1 on the partition 0, 1, 1.5, 3 with sample points 0.5, 1.5 and 2.
- For \displaystyle f(x) = \sqrt{x} on the partition 0, 1, 4, 9, find the smallest and the largest possible Riemann sums.
Day 2: reasoning
- Prove that when f is increasing on [a, b], every Riemann sum on a partition lies between the left-end and right-end sums for that partition.
- A velocity log reads 10 meters per second at both t = 0 and t = 2. Explain why the table alone cannot say whether the left sum L_1 = 20 over- or underestimates the distance, using \displaystyle 10 + 5\sin\frac{\pi t}{2} and \displaystyle 10 - 5\sin\frac{\pi t}{2}.
Answers
- \Delta x = 0.5. L_4 = 0.5(0 + 0.125 + 1 + 3.375) = 2.25 and R_4 = 0.5(0.125 + 1 + 3.375 + 8) = 6.25. The midpoint heights are 0.015625, 0.421875, 1.953125, 5.359375, so M_4 = 0.5(7.75) = 3.875.
- \displaystyle \Delta x = \frac{1}{2}. \displaystyle L_4 = \frac{1}{2}\big(1 + \frac{2}{3} + \frac{1}{2} + \frac{2}{5}\big) \displaystyle = \frac{77}{60} and \displaystyle R_4 = \frac{1}{2}\big(\frac{2}{3} + \frac{1}{2} + \frac{2}{5} + \frac{1}{3}\big) \displaystyle = \frac{19}{20}. The function is decreasing, so \displaystyle \frac{19}{20} \le A \le \frac{77}{60}.
- \Delta t = 3. \displaystyle L_3 = 3(0 + 2\sqrt{3} + 2\sqrt{6}) \approx 25.09 meters; \displaystyle R_3 = 3(2\sqrt{3} + 2\sqrt{6} + 6) \approx 43.09 meters; \displaystyle M_3 = 3\big(2\sqrt{1.5} + 2\sqrt{4.5} + 2\sqrt{7.5}\big) \approx 36.51 meters.
- \displaystyle \Delta x = \frac{\pi}{4}. \displaystyle L_4 = \frac{\pi}{4}\big(0 + \frac{\sqrt{2}}{2} + 1 + \frac{\sqrt{2}}{2}\big), which is \displaystyle \frac{\pi}{4}(1 + \sqrt{2}) \approx 1.8961. The midpoints are \displaystyle \frac{\pi}{8}, \frac{3\pi}{8}, \frac{5\pi}{8}, \frac{7\pi}{8}, and the sines there add to about 2.6131, so M_4 \approx 2.0523.
- \displaystyle L_5 = \displaystyle\sum_{k=0}^{4} \frac{1}{5}e^{k/5}, which is \displaystyle \frac{1}{5}\big(1 + e^{0.2} + e^{0.4} + e^{0.6} + e^{0.8}\big) \approx 1.5522.
- Width \displaystyle \frac{1}{4} and 8 terms give an interval of length 2; heights x^2 at \displaystyle x = \frac{k}{4} for k = 1 to 8, the right ends. It is R_8 for f(x) = x^2 on [0, 2]. Value \displaystyle \frac{1}{64}(1 + 4 + \dots + 64) = \frac{204}{64} = \frac{51}{16}. An overestimate, since x^2 is increasing on [0, 2].
- \displaystyle \Delta x = \frac{2}{n} and \displaystyle m_k = \frac{2k - 1}{n}, so \displaystyle M_n = \displaystyle\sum_{k=1}^{n} \frac{2}{n}\left(\frac{2k - 1}{n}\right)^3. For n = 4: \displaystyle \frac{1}{2}\cdot\frac{1 + 27 + 125 + 343}{64} = \frac{496}{128} = 3.875, matching.
- \displaystyle R_n - L_n = \frac{9}{n}\big(v(9) - v(0)\big) = \frac{54}{n} < 0.5 needs n > 108, so n = 109.
- R_n = \Delta x\big(f(x_1) + \dots + f(x_n)\big) and L_n = \Delta x\big(f(x_0) + \dots + f(x_{n-1})\big). In R_n - L_n the values f(x_1) through f(x_{n-1}) appear in both and cancel, leaving \Delta x\big(f(x_n) - f(x_0)\big), which is \displaystyle \frac{b - a}{n}\big(f(b) - f(a)\big).
- L_1 = 4\,v(0) = 8. On [1, 4], v'(t) = 2t - 2 > 0, so v is increasing there and the area over [1, 4] is at least its left sum with three pieces, v(1) + v(2) + v(3) = 1 + 2 + 5 = 8. The area over [0, 1] is positive, so the distance exceeds 8: the left sum is under. Yet v'(t) < 0 on (0, 1), so she was slowing at first.
- On a piece, f(x) = f(m_k) + s(x - m_k) for the slope s. The region under it is a trapezoid with parallel sides \displaystyle f(m_k) - \frac{s\Delta x}{2} and \displaystyle f(m_k) + \frac{s\Delta x}{2}, so its area is \Delta x times their average, f(m_k)\,\Delta x. Adding over the pieces gives M_n = A.
- Widths 3, 2, 4, 3. L = 30(3) + 26(2) + 22(4) + 12(3) = 266 and R = 26(3) + 22(2) + 12(4) + 0(3) = 170. Velocity falls, so 170 \le D \le 266 meters.
- Widths 0.5, 1, 0.5, 1.5. L = 0.4(0.5) + 1.2(1) + 2.0(0.5) + 3.6(1.5) = 7.8 and R = 1.2(0.5) + 2.0(1) + 3.6(0.5) + 5.0(1.5) = 11.9. The rate rises, so between 7.8 and 11.9 thousand cubic meters.
- The first eight readings add to 54.8, so L_8 = 5(54.8) = 274. The readings at 5, 15, 25, 35 add to 29.2, so M_4 = 10(29.2) = 292. Increasing makes L_8 an underestimate and concave down makes M_4 an overestimate: between 274 and 292 meters.
- L_4 \approx 1.0988, over, and R_4 \approx 0.6664, under, because f'(x) = -e^{-x} < 0. M_4 \approx 0.8557, under, because f''(x) = e^{-x} > 0 (concave up).
- (a) L_n \le A \le M_n \le R_n: increasing gives L_n \le A \le R_n, concave down gives A \le M_n, and f(m_k) \le f(x_k) gives M_n \le R_n. (b) R_n \le M_n \le A \le L_n, by the same three steps reversed.
- Widths 1, 0.5, 1.5: 1.25(1) + 3.25(0.5) + 5(1.5) = 1.25 + 1.625 + 7.5 = 10.375.
- Widths 1, 3, 5, and \displaystyle \sqrt{x} is increasing. Smallest, left ends: 0(1) + 1(3) + 2(5) = 13. Largest, right ends: 1(1) + 2(3) + 3(5) = 22.
- On piece k, x_{k-1} \le c_k \le x_k and f is increasing, so f(x_{k-1}) \le f(c_k) \le f(x_k). Multiplying by \Delta x_k > 0 and adding over k gives the two inequalities.
- Both functions read 10 at t = 0 and t = 2, so both give L_1 = 20. The first stays at or above 10 on [0, 2], so its area contains the rectangle and L_1 is under; the second stays at or below 10, so L_1 is over. The same readings allow both, so only knowledge of the function between readings decides.