# Riemann Sums

Let $f$ be a continuous, real-valued function on some closed interval $[a, b]$. A Riemann sum for $f$ on $[a, b]$ is the total signed area of a collection of abutting rectangles whose heights are function values of $f$. See below for definitions.

Click to select a function.

Click to select a type of Riemann sum.

Click the diagram to add points to the partition, or use the field below to create a partition having equal-length subintervals. (Clicking on an existing point removes that point from the partition.)

Intervals = ,
Estimate = ,
Error = .

## Definitions

Divide $[a, b]$ into finitely many subintervals by picking a partition, a collection of points $P = \{a = x_{0} \lt x_{1} \lt \dots \lt x_{n-1} \lt x_{n} = b\}.$ For each index $i = 1, \dots, n$, call $I_{i} = [x_{i-1}, x_{i}]$ the $i$th subinterval, let $\Delta x_{i} = x_{i} - x_{i-1}$ be its length, and pick a sample point $x_{i}^{*}$ in $I_{i}$. The corresponding Riemann sum is $S = \sum_{i=1}^{n} f(x_{i}^{*})\, \Delta x_{i}.$

Geometrically, divide $[a, b]$ into pieces using points of the partition. Select a sample point from each interval, evaluate the function $f$ at this point, and construct the rectangle of this height lying over the $i$th subinterval. The resulting Riemann sum is the total signed area of these rectangles; if $f(x_{i}^{*}) \lt 0$, we count the area of that rectangle negatively.

• If $x_{i}^{*} = x_{i-1}$, the left-hand endpoint of $I_{i}$, we call $S$ the left-hand Riemann sum.
• If $x_{i}^{*} = x_{i}$, the right-hand endpoint of $I_{i}$, we call $S$ the right-hand Riemann sum.
• If $x_{i}^{*}$ is a point of $I_{i}$ where $f$ achieves an absolute maximum, we call $S$ the maximum Riemann sum.
• If $x_{i}^{*}$ is a point of $I_{i}$ where $f$ achieves an absolute minimum, we call $S$ the minimum Riemann sum.
• If $x_{i}^{*} = \frac{1}{2}(x_{i-1} + x_{i})$, the midpoint of $I_{i}$, we call $S$ the midpoint Riemann sum. The midpoint sum may also be interpreted as the total signed area of trapezoids enclosed by tangent lines to the graph at the midpoints.

One other sum is represented geometrically by the signed areas of trapezoids. The average of the left- and right-hand sums, called the trapezoid sum, is the signed area enclosed by secant lines. That is, draw a dot on the graph of $f$ over each point of the partition, and connect the dots in order. The trapezoid sum is the resulting signed area.

### Relative Accuracy

If $S$ is a Riemann sum for $f$ on the interval $[a, b]$, the difference $E = S - \int_{a}^{b} f(x)\, dx$ is called the error. An overestimate has positive error; an underestimate has negative error.

For twice-differentiable functions whose second derivative is continuous, and for partitions with $n$ subintervals of equal length, the left-hand, right-hand, maximum, and minimum sums are expected to yield an error roughly proportional to $1/n$. That is, doubling the number of intervals roughly halves the error.

For the same functions, the trapezoid and midpoint methods yield an error roughly proportional to $1/n^{2}$. That is, doubling the number of intervals roughly quarters the error. Moreover, the midpoint error is expected to be roughly half the size of the trapezoid error.

### Qualitative Properties

Try to establish the properties stated below; first convince yourself they are true, then give reasons based on the definitions.

1. The maximum sum always overestimates, and the minimum sum always underestimates.
2. If $f$ is increasing on $[a, b]$, then the left-hand sum underestimates and the right-hand sum overestimates. What can you say if $f$ is decreasing?
3. If $f$ is convex (concave up) on $[a, b]$, then the midpoint sum underestimates and the trapezoid sum overestimates. What can you say if $f$ is concave (down)?