Riemann Sums.
Approximate the area under a curve. Then take the limit.
Riemann Sums
Approximate the area under a curve using rectangles, then sharpen the approximation until the error vanishes. The limit of a Riemann sum is the definite integral.
The Setup
You want the area bounded by a function $f$, the lines $x = a$ and $x = b$, and the $x$-axis. You don't have an antiderivative, or you have a table of values rather than a formula. So you approximate.
Partition $[a, b]$ into $n$ equal subintervals. Each subinterval supports one rectangle of width $\Delta x$ whose height comes from a sample point on the curve. Sum the rectangles.
The endpoints of the subintervals are $a = x_0 < x_1 < x_2 < \cdots < x_n = b$, where $x_i = a + i\,\Delta x$.
where $x_i^*$ is some sample point in the $i$-th subinterval.
A Worked Example
Water flows into a reservoir at rate $W(t)$ gallons per hour, with values measured at five times. The flow is continuous and always positive. Approximate the total volume of water added from $t = 0$ to $t = 12$ hours using a left Riemann sum.
| $t$ (hr) | 0 | 2 | 5 | 9 | 12 |
| $W(t)$ (gal/hr) | 4 | 11 | 17 | 22 | 14 |
Total volume equals the integral of the rate. With four subintervals $[0, 2], [2, 5], [5, 9], [9, 12]$ of widths $2, 3, 4, 3$, the left Riemann sum samples the rate at the left end of each:
The subintervals don't have to be equal width. When a rate is given as a table, the Riemann sum is just a weighted addition. Notice that $W(12)$ never appears in a left sum, the last rectangle is built from $W(9)$.
The Four Methods
The four standard sample-point choices are: the left endpoint, the right endpoint, the midpoint, and the average of left and right (which gives a trapezoid instead of a rectangle). Each method tells a different lie about the same function.
Left Riemann Sum
Sample the height at the left endpoint of each subinterval. The first rectangle has height $f(x_0) = f(a)$, the second has height $f(x_1)$, and the last has height $f(x_{n-1})$.
In sigma notation, $\displaystyle A_L \approx \sum_{i=0}^{n-1} f(x_i)\,\Delta x$.
Right Riemann Sum
Sample at the right endpoint instead. The first rectangle has height $f(x_1)$, the last has height $f(x_n) = f(b)$.
In sigma notation, $\displaystyle A_R \approx \sum_{i=1}^{n} f(x_i)\,\Delta x$. The right sum is just the left sum with the endpoints shifted by one.
Midpoint Sum
Sample at the midpoint of each subinterval, $\bar{x}_i = (x_{i-1} + x_i)/2$.
Or compactly: $\displaystyle A_M \approx \sum_{i=1}^{n} f\!\left(\tfrac{x_{i-1} + x_i}{2}\right) \Delta x$.
Trapezoidal Sum
Connect $f(x_{i-1})$ and $f(x_i)$ with a straight line segment. The shape between the segment and the $x$-axis is a trapezoid; its area is $\tfrac{1}{2} \Delta x \cdot \big[ f(x_{i-1}) + f(x_i) \big]$. Adding all $n$ of them telescopes:
Equivalently, $A_T = \tfrac{1}{2}(A_L + A_R)$. The trapezoidal sum is the average of the left and right sums.
Over or Under
Whether each method overestimates or underestimates depends on the function's shape on each subinterval. The four methods divide cleanly: rectangles care about monotonicity; midpoint and trapezoid care about concavity. The irrelevant attribute is shown struck through in each scenario.
Left Riemann
For a strictly increasing function the left Riemann sum is an underestimate; for a strictly decreasing function it is an overestimate. Concavity is irrelevant.
Right Riemann
Mirror of the left sum. For a strictly increasing function the right Riemann sum is an overestimate; for a strictly decreasing function it is an underestimate.
Midpoint
The bias depends on concavity, not monotonicity. If $f$ is concave up, the midpoint sum is an underestimate; if concave down, an overestimate. Geometrically, the slivers above the rectangle (where the curve rises) outweigh the slivers below, or vice versa.
Trapezoidal
Mirror of the midpoint sum. If $f$ is concave up, the trapezoidal sum is an overestimate (the chord lies above the curve); if concave down, an underestimate (the chord lies below).
Summary
| Method | Increasing | Decreasing | Concave up | Concave down |
|---|---|---|---|---|
| Left Riemann | Under | Over | — | — |
| Right Riemann | Over | Under | — | — |
| Midpoint | — | — | Under | Over |
| Trapezoidal | — | — | Over | Under |
Going to the Limit
Every Riemann sum has an error: the curve passes above or below the rectangles by some amount. When $n$ grows, $\Delta x$ shrinks, and the rectangles cling closer to the curve. The error tends to zero.
We define the area under $f$ as the limit of the Riemann sum as $n \to \infty$. That limit is the definite integral.
provided the limit exists and is independent of the choice of sample points $x_i^*$.
For a continuous function on $[a, b]$, all four methods (left, right, midpoint, trapezoidal) converge to the same value: the exact area. For our running example, $\displaystyle\int_0^8 (1 + 0.18x + 0.045x^2)\,dx = 21.44$ exactly.
Try It Yourself
Pick a method. Pick a function shape. Slide $n$ from 2 to 100. Watch the approximation chase the true area and the signed error chase zero, and use the over/under shading to confirm the rules from the previous section.