← MATH 161 MathScape 0 MATH161

Riemann Sums

16 min read

Jump to a section
Reference: Stewart §4.1

Textbook Reference

Primary source OpenStax Calculus Volume 1, Section 5.1: “Approximating Areas”
Direct link https://openstax.org/books/calculus-volume-1/pages/5-1-approximating-areas
Supplementary OpenStax Calculus Volume 1, Section 5.2: “The Definite Integral”
Supplementary link https://openstax.org/books/calculus-volume-1/pages/5-2-the-definite-integral
Textbook used in class Stewart, Calculus, Section 4.1: “The Area and Distance Problems” (Examples 1, 2, 4)

Both OpenStax sources are free and openly licensed.


Key idea

You already know the area of a rectangle: length times width. A Riemann sum is what happens when you insist on using only that one fact to measure something with a curved edge.

Picture the region under a curve $y = f(x)$, above the $x$-axis, between $x = a$ and $x = b$. Its top is curved, so no formula from geometry gives its area directly. But you can cover it with thin rectangles. Each rectangle has a width you choose and a height equal to the function’s value somewhere in that strip. You can find each rectangle’s area exactly. Add them up and you have an estimate of the whole region.

The estimate is rough when the rectangles are fat, because their flat tops do not follow the curve. So you use more rectangles, each thinner, hugging the curve more closely. A Riemann sum is the total area of one such collection of rectangles. The exact area is what that total approaches as the number of rectangles grows without bound.

That is the entire idea, and it is bigger than area. The same picture, with the curve being a velocity instead of a height, computes distance traveled. With other curves it computes work, or volume, or total accumulated change of almost anything. When you take the limit of Riemann sums, you get the definite integral, the central object of the second half of this course. So the rectangles you are about to add up are the first draft of the integral.


Prerequisite Check

Before this lesson, make sure you can do all of the following:

If sigma notation is unfamiliar, learn that first. A Riemann sum is a sum, and the notation is how it is written compactly.


Quick Reference

The setup. To approximate the area under $y = f(x)$ on $[a, b]$ with $n$ rectangles of equal width, the width of each is \[ \Delta x = \frac{b - a}{n}, \] and the right endpoints of the subintervals are $x_i = a + i\,\Delta x$ for $i = 1, 2, \ldots, n$.

A Riemann sum. Choose a sample point $x_i^{*}$ in each subinterval and add up height times width: \[ \sum_{i=1}^{n} f(x_i^{*})\,\Delta x. \]

Name Sample point used Symbol
Left sum left endpoint $x_{i-1}$ $L_n$
Right sum right endpoint $x_i$ $R_n$
Midpoint sum midpoint of the subinterval $M_n$

Over or under. For an increasing function, the left sum underestimates and the right sum overestimates the true area. For a decreasing function, the reverse holds. The midpoint sum is usually the most accurate of the three.

The exact area. The area $A$ under a continuous $f$ is the limit of the Riemann sums: \[ A = \lim_{n \to \infty} \sum_{i=1}^{n} f(x_i)\,\Delta x. \]


Key Concepts

1. Approximating an Area with Rectangles

Start with the region $S$ under $y = x^2$ from $x = 0$ to $x = 1$. We want its area, and we will trap it between a low estimate and a high estimate. (This is Stewart 4.1, Example 1.)

Divide $[0, 1]$ into four equal strips, each of width $\Delta x = \frac{1}{4}$. The subintervals are $\left[0, \frac14\right]$, $\left[\frac14, \frac12\right]$, $\left[\frac12, \frac34\right]$, $\left[\frac34, 1\right]$.

Right endpoints. Use the right edge of each strip as the rectangle height. The heights are $f\!\left(\frac14\right)$, $f\!\left(\frac12\right)$, $f\!\left(\frac34\right)$, $f(1)$, which for $f(x) = x^2$ are $\left(\frac14\right)^2$, $\left(\frac12\right)^2$, $\left(\frac34\right)^2$, $1^2$. The right sum is \[ R_4 = \frac{1}{4}\left[\left(\tfrac14\right)^2 + \left(\tfrac12\right)^2 + \left(\tfrac34\right)^2 + 1^2\right] = \frac{15}{32} = 0.46875. \]

Because $f(x) = x^2$ is increasing, these right-endpoint rectangles stick out above the curve, so $R_4$ is too big: \[ A < 0.46875. \]

Left endpoints. Use the left edge of each strip instead. The leftmost rectangle now has height $f(0) = 0$ and collapses. The left sum is \[ L_4 = \frac{1}{4}\left[0^2 + \left(\tfrac14\right)^2 + \left(\tfrac12\right)^2 + \left(\tfrac34\right)^2\right] = \frac{7}{32} = 0.21875. \]

These rectangles sit below the curve, so $L_4$ is too small. Together, \[ 0.21875 < A < 0.46875. \]

Using eight strips instead of four tightens the trap to $0.2734375 < A < 0.3984375$. The more rectangles, the narrower the gap.

See It: Squeeze the Area

Add rectangles one at a time. The right sum stays above the true area and the left sum stays below it, and the gap between them shrinks as the rectangles thin. Drive the gap nearly to zero, then name the number the two sums close in on.

Watch the direction of the error (increasing vs decreasing). For an increasing function like $x^2$, right endpoints overestimate and left endpoints underestimate. For a decreasing function it is exactly the other way around. Sketch the rectangles against the curve and you will see which way they lean; do not trust a memorized rule without the picture.


2. From Estimate to Exact Area: The Limit

The estimates above suggest the true area is near $\frac{1}{3}$. We can confirm it exactly by letting the number of rectangles go to infinity. (This is Stewart 4.1, Example 2.)

With $n$ rectangles of width $\frac{1}{n}$ and right endpoints $x_i = \frac{i}{n}$, the heights are $\left(\frac{i}{n}\right)^2$, so \[ R_n = \sum_{i=1}^{n} \left(\frac{i}{n}\right)^2 \cdot \frac{1}{n} = \frac{1}{n^3}\sum_{i=1}^{n} i^2. \]

Now apply the sum-of-squares formula $\displaystyle\sum_{i=1}^{n} i^2 = \frac{n(n+1)(2n+1)}{6}$: \[ R_n = \frac{1}{n^3}\cdot\frac{n(n+1)(2n+1)}{6} = \frac{(n+1)(2n+1)}{6n^2}. \]

Take the limit by dividing through: \[ \lim_{n \to \infty} R_n = \lim_{n \to \infty} \frac{1}{6}\left(\frac{n+1}{n}\right)\left(\frac{2n+1}{n}\right) = \lim_{n \to \infty} \frac{1}{6}\left(1 + \frac{1}{n}\right)\left(2 + \frac{1}{n}\right) = \frac{1}{6}\cdot 1 \cdot 2 = \frac{1}{3}. \]

Boxed answer: the exact area under $y = x^2$ on $[0, 1]$ is $\dfrac{1}{3}$.

The left sums $L_n$ approach the same value, $\frac{1}{3}$. Because both the underestimates and the overestimates close in on $\frac{1}{3}$, that number is the area.


3. The General Riemann Sum and the Definition of Area

The pattern works for any continuous $f$ on $[a, b]$, not just $x^2$ on $[0,1]$. Divide $[a, b]$ into $n$ equal strips. Each has width \[ \Delta x = \frac{b - a}{n}, \] and the right endpoint of the $i$th strip is $x_i = a + i\,\Delta x$. Approximating the $i$th strip by a rectangle of height $f(x_i)$ and width $\Delta x$, the total approximating area is the right sum \[ R_n = f(x_1)\,\Delta x + f(x_2)\,\Delta x + \cdots + f(x_n)\,\Delta x = \sum_{i=1}^{n} f(x_i)\,\Delta x. \]

Letting $n \to \infty$ gives the definition.

Definition (area as a limit of Riemann sums). The area $A$ of the region under the graph of a continuous function $f$ on $[a, b]$ is \[ A = \lim_{n \to \infty} \sum_{i=1}^{n} f(x_i)\,\Delta x. \] (Plain gloss: keep cutting the region into more, thinner rectangles; the total rectangle area settles down to a single number, and that number is the area.)

Two facts make this definition trustworthy. First, the limit exists whenever $f$ is continuous. Second, you get the same number using left endpoints, right endpoints, or any sample point $x_i^{*}$ chosen inside each subinterval. A Riemann sum is the general form \[ \sum_{i=1}^{n} f(x_i^{*})\,\Delta x, \] where each $x_i^{*}$ is any point in the $i$th subinterval $[x_{i-1}, x_i]$.


4. The Midpoint Sum

The left and right sums lean one way or the other. Choosing the midpoint of each subinterval as the sample point usually balances the error and gives a better estimate.

Example. Estimate the area under $f(x) = \cos x$ from $x = 0$ to $x = \frac{\pi}{2}$ using four subintervals and midpoints. (This is Stewart 4.1, Example 3(b).)

Goal. Find the width, the four midpoints, then add height times width.

With $n = 4$ and width $\Delta x = \frac{\pi/2}{4} = \frac{\pi}{8}$, the subintervals are $\left[0, \frac{\pi}{8}\right]$, $\left[\frac{\pi}{8}, \frac{\pi}{4}\right]$, $\left[\frac{\pi}{4}, \frac{3\pi}{8}\right]$, $\left[\frac{3\pi}{8}, \frac{\pi}{2}\right]$. Their midpoints are \[ x_1^{*} = \frac{\pi}{16}, \quad x_2^{*} = \frac{3\pi}{16}, \quad x_3^{*} = \frac{5\pi}{16}, \quad x_4^{*} = \frac{7\pi}{16}. \]

The midpoint sum is \[ M_4 = \frac{\pi}{8}\left(\cos\frac{\pi}{16} + \cos\frac{3\pi}{16} + \cos\frac{5\pi}{16} + \cos\frac{7\pi}{16}\right) \approx 1.006. \]

Boxed answer: $M_4 \approx 1.006$.

Recap. The midpoint heights neither uniformly overshoot nor uniformly undershoot, which is why the midpoint sum is usually closer to the truth than $L_n$ or $R_n$ at the same $n$. The exact area here turns out to be $1$, and $M_4$ is already within one percent.


5. The Distance Problem: The Same Idea, Different Curve

The reason Riemann sums matter beyond geometry is that the very same sum solves a problem that has nothing to do with area on its face: finding distance from velocity. (This is Stewart 4.1, Example 4.)

Suppose a car’s odometer is broken and you want the distance driven over $30$ seconds. You read the speedometer every five seconds (after converting to feet per second):

Time (s) 0 5 10 15 20 25 30
Velocity (ft/s) 25 31 35 43 47 45 41

Over each five-second interval, pretend the velocity is constant and use distance equals velocity times time. Taking the velocity at the start of each interval (a left sum): \[ (25 + 31 + 35 + 43 + 47 + 45)\times 5 = 1130 \text{ ft}. \] Taking the velocity at the end of each interval (a right sum): \[ (31 + 35 + 43 + 47 + 45 + 41)\times 5 = 1210 \text{ ft}. \]

Boxed answer: the distance is between $1130$ ft and $1210$ ft.

Recap. Each product velocity times time is the area of a rectangle whose height is a velocity and whose width is a time. Adding them is a Riemann sum, and the exact distance is the limit as the readings get more frequent. So the total distance equals the area under the velocity graph. This is the bridge to the definite integral: areas, distances, work, and accumulated change are all the same limit of Riemann sums.


Common Errors Summary

Error Example Correction
Reversing the over/under rule claiming $R_n$ underestimates for increasing $f$ Increasing $f$: right overestimates, left underestimates; sketch the rectangles
Wrong width $\Delta x$ using $\frac{b}{n}$ when $a \neq 0$ $\Delta x = \frac{b - a}{n}$; subtract the left endpoint
Off-by-one in endpoints summing $i = 0$ to $n$ for a right sum Right sum uses $x_i = a + i\,\Delta x$, $i = 1$ to $n$; left sum uses $i = 0$ to $n-1$
Forgetting the leftmost zero dropping the collapsed rectangle silently A height of $0$ contributes $0$, but the strip still counts toward $n$
Mis-stating the limit writing $A = \sum f(x_i)\Delta x$ with no limit The exact area is $A = \lim_{n\to\infty}\sum f(x_i)\Delta x$; the finite sum is only an estimate
Misapplying the sum formula $\sum i^2 = \frac{n(n+1)}{2}$ That is $\sum i$; the squares formula is $\frac{n(n+1)(2n+1)}{6}$

Leveled Practice

Level 1 -- Direct Application

Problem 1. Compute the width $\Delta x$ for a right sum approximating the area under a function on $[2, 8]$ using $n = 12$ rectangles. Then write the right endpoint $x_5$.

Show answer

$\Delta x = \dfrac{b - a}{n} = \dfrac{8 - 2}{12} = \dfrac{6}{12} = \dfrac{1}{2}$.

$x_5 = a + 5\,\Delta x = 2 + 5\left(\tfrac12\right) = 2 + \tfrac52 = \dfrac{9}{2} = 4.5$.

Boxed answer: $\Delta x = \dfrac{1}{2}$, $x_5 = 4.5$.


Problem 2. Estimate the area under $f(x) = x^2$ on $[0, 2]$ using a right sum with $n = 4$ rectangles.

Show answer

$\Delta x = \dfrac{2 - 0}{4} = \dfrac12$. Right endpoints: $x_1 = 0.5$, $x_2 = 1$, $x_3 = 1.5$, $x_4 = 2$.

Heights: $0.5^2 = 0.25$, $1^2 = 1$, $1.5^2 = 2.25$, $2^2 = 4$.

\[ R_4 = \tfrac12(0.25 + 1 + 2.25 + 4) = \tfrac12(7.5) = 3.75. \]

Boxed answer: $R_4 = 3.75$.

(The exact area is $\frac{8}{3} \approx 2.667$. Since $x^2$ is increasing, the right sum overestimates, which matches $3.75 > 2.667$.)


Problem 3. A function $f$ is decreasing on $[1, 5]$. For a Riemann sum with equal subintervals, which is larger, the left sum $L_n$ or the right sum $R_n$? Which one overestimates the true area?

Show answer

For a decreasing function, the left endpoint of each strip is the highest point in that strip, so the left-endpoint rectangles sit above the curve.

So $L_n > R_n$, and $L_n$ is the overestimate. $R_n$ is the underestimate.

Boxed answer: $L_n$ is larger and overestimates; $R_n$ underestimates.


Level 2 -- Multiple Steps

Problem 4. Estimate the area under $f(x) = 1 + x^2$ on $[-1, 2]$ using a right sum with $n = 3$ rectangles.

Show answer

$\Delta x = \dfrac{2 - (-1)}{3} = \dfrac{3}{3} = 1$. Right endpoints: $x_1 = 0$, $x_2 = 1$, $x_3 = 2$.

Heights: $f(0) = 1$, $f(1) = 1 + 1 = 2$, $f(2) = 1 + 4 = 5$.

\[ R_3 = 1\cdot(1 + 2 + 5) = 8. \]

Boxed answer: $R_3 = 8$.


Problem 5. Estimate the area under $f(x) = 1 + x^2$ on $[-1, 2]$ using a midpoint sum with $n = 3$ rectangles, and compare with the right sum from Problem 4.

Show answer

$\Delta x = 1$, so the subintervals are $[-1, 0]$, $[0, 1]$, $[1, 2]$, with midpoints $-0.5$, $0.5$, $1.5$.

Heights: $f(-0.5) = 1 + 0.25 = 1.25$, $f(0.5) = 1.25$, $f(1.5) = 1 + 2.25 = 3.25$.

\[ M_3 = 1\cdot(1.25 + 1.25 + 3.25) = 5.75. \]

Boxed answer: $M_3 = 5.75$.

The exact area is $6$. The midpoint estimate $5.75$ is much closer than the right sum $8$ from Problem 4, which is the usual outcome: midpoints beat endpoints at the same $n$.


Problem 6. The speed of a runner increases steadily during the first three seconds of a race. Her speed at half-second intervals is given. Find a lower estimate and an upper estimate for the distance she travels in those three seconds.

$t$ (s) 0 0.5 1.0 1.5 2.0 2.5 3.0
$v$ (ft/s) 0 6.2 10.8 14.9 18.1 19.4 20.2
Show answer

The width of each interval is $\Delta t = 0.5$ s. The speed is increasing, so a left sum (start-of-interval speeds) underestimates and a right sum (end-of-interval speeds) overestimates. (This is Stewart 4.1, Exercise 9.)

Lower estimate (left endpoints, omit the last reading): \[ 0.5\,(0 + 6.2 + 10.8 + 14.9 + 18.1 + 19.4) = 0.5\,(69.4) = 34.7 \text{ ft}. \]

Upper estimate (right endpoints, omit the first reading): \[ 0.5\,(6.2 + 10.8 + 14.9 + 18.1 + 19.4 + 20.2) = 0.5\,(89.6) = 44.8 \text{ ft}. \]

Boxed answer: the distance is between $34.7$ ft and $44.8$ ft.


Level 3 -- Deeper Problems

Problem 7. Use the limit definition to find the exact area under $f(x) = x^2$ on $[0, 2]$. Use right endpoints. (You may use $\sum_{i=1}^{n} i^2 = \frac{n(n+1)(2n+1)}{6}$.)

Show answer

Width $\Delta x = \dfrac{2}{n}$, right endpoints $x_i = \dfrac{2i}{n}$, heights $\left(\dfrac{2i}{n}\right)^2 = \dfrac{4i^2}{n^2}$.

\[ R_n = \sum_{i=1}^{n} \frac{4i^2}{n^2}\cdot\frac{2}{n} = \frac{8}{n^3}\sum_{i=1}^{n} i^2 = \frac{8}{n^3}\cdot\frac{n(n+1)(2n+1)}{6}. \]

Simplify: \[ R_n = \frac{8(n+1)(2n+1)}{6n^2} = \frac{4}{3}\cdot\frac{(n+1)(2n+1)}{n^2}. \]

Take the limit: \[ \lim_{n\to\infty} R_n = \frac{4}{3}\lim_{n\to\infty}\left(1 + \frac1n\right)\left(2 + \frac1n\right) = \frac{4}{3}\cdot 1 \cdot 2 = \frac{8}{3}. \]

Boxed answer: the exact area is $\dfrac{8}{3}$.

(This matches the prediction from Problem 2, where the right sum $3.75$ overestimated a value near $2.667 = \frac{8}{3}$.)


Problem 8. Let $A$ be the area under an increasing continuous function $f$ from $a$ to $b$, with left and right sums $L_n$ and $R_n$ on $n$ equal subintervals. Show that \[ R_n - L_n = \frac{b - a}{n}\,[\,f(b) - f(a)\,]. \]

Show answer

Both sums use width $\Delta x = \dfrac{b-a}{n}$. Write them out: \[ R_n = \Delta x\,[\,f(x_1) + f(x_2) + \cdots + f(x_n)\,], \qquad L_n = \Delta x\,[\,f(x_0) + f(x_1) + \cdots + f(x_{n-1})\,]. \]

Subtract. Every interior term $f(x_1), \ldots, f(x_{n-1})$ appears in both sums and cancels. What remains is the last term of $R_n$ and the first term of $L_n$: \[ R_n - L_n = \Delta x\,[\,f(x_n) - f(x_0)\,] = \frac{b-a}{n}\,[\,f(b) - f(a)\,], \] since $x_0 = a$ and $x_n = b$.

Conclusion: This telescoping shows the gap between the over- and under-estimates shrinks like $\frac{1}{n}$. (This is Stewart 4.1, Exercise 25(b).) Geometrically, the $n$ thin difference-rectangles can be stacked into one rectangle of width $\Delta x$ and height $f(b) - f(a)$. As $n \to \infty$, $R_n - L_n \to 0$, so both sums converge to the same area $A$.


Problem 9. Use Definition (area as a limit) to write the area under $f(x) = x^3 + \sqrt{1 + 2x}$ on $[4, 7]$ as a limit. Do not evaluate the limit.

Show answer

Width: $\Delta x = \dfrac{7 - 4}{n} = \dfrac{3}{n}$. Right endpoints: $x_i = 4 + \dfrac{3i}{n}$. (This is Stewart 4.1, Exercise 18.)

\[ A = \lim_{n\to\infty} \sum_{i=1}^{n} f(x_i)\,\Delta x = \lim_{n\to\infty} \sum_{i=1}^{n} \left[\left(4 + \frac{3i}{n}\right)^3 + \sqrt{1 + 2\left(4 + \frac{3i}{n}\right)}\,\right]\frac{3}{n}. \]

Boxed answer: the displayed limit. Setting up this expression correctly, the width, the endpoints, and the function evaluated at them, is the whole skill; evaluating such a limit by hand is rarely possible, which is exactly why the next chapters develop the Fundamental Theorem of Calculus to do it without summing.



Common Misconceptions

Common misconception

a Riemann sum with many rectangles gives the exact area.

This is the concept-image-conflicts-definition error. Every finite Riemann sum $\sum_{i=1}^n f(x_i)\,\Delta x$ is an approximation, not the exact area. The exact area is the limiting value $\lim_{n\to\infty}\sum_{i=1}^n f(x_i)\,\Delta x$; no particular choice of $n$ achieves it. Writing $A = \sum f(x_i)\,\Delta x$ without a limit symbol states that a finite sum equals the area, which is false.

Common misconception

the height of a Riemann rectangle at $x_i$ is the slope of the curve at that point.

This is the height-vs-slope error. The rectangle’s height is the function value $f(x_i)$, which represents the $y$-coordinate of the curve. The derivative $f'(x_i)$ is the slope of the tangent line, a completely separate quantity. Confusing the two produces wildly incorrect rectangle heights and meaningless sum values.


Mastery Checklist

You have mastered this skill when you can do all of the following without referring to notes:


Mental Model

Think of a Riemann sum as tiling a curved region with rectangles you can actually measure.

You cannot measure the curved region directly, so you replace it with something you can: a row of rectangles. Each rectangle is honest about its own area (height times width). The collection is a slightly wrong stand-in for the real region, because the flat tops do not match the curve.

Three things follow from the picture:


Connections

Within Integrals (Chapter 4)

Toward later calculus (MATH161 and beyond)

Audience Notes

For students who find math intimidating: You are not learning a new kind of arithmetic. You add up the areas of some rectangles, which is multiply-and-add, the most familiar thing there is. The only new idea is that using more, thinner rectangles gives a better answer. Start every problem by drawing the curve and a few rectangles. The picture tells you almost everything, including whether your estimate is too big or too small.

For career-focused students: This is exactly how numerical software computes integrals, total energy use over a day from a power reading, distance from GPS speed samples, signal area from sensor data. Code does not take limits; it sums many thin rectangles, which is a Riemann sum. Understanding the over- and under-estimate behavior is how engineers bound the error of those computations.

For gifted and curious students: Try the exact-area limit for $y = x^3$ on $[0,1]$ using the cube-sum formula $\sum i^3 = \left[\frac{n(n+1)}{2}\right]^2$ and confirm the area is $\frac14$. Then notice the pattern: the area under $x^k$ on $[0,1]$ is $\frac{1}{k+1}$, which foreshadows the power rule for integration.

For PhD-track students: The choice of sample point $x_i^{*}$ being irrelevant in the limit is not automatic; it relies on $f$ being continuous, hence uniformly continuous, on the closed interval $[a, b]$. The full theory replaces equal subdivisions with arbitrary partitions and asks that the supremum of the subinterval widths go to zero. The function is Riemann integrable exactly when the upper and lower sums share a common limit, the criterion that separates Riemann integration from the more general Lebesgue theory.


Back to Integrals | Related: Sigma Notation | Next: Definite Integral Definition