A Riemann sum estimates the area under a curve by cutting the interval into n strips of width Δx = (b − a)/n, building a rectangle on each strip, and adding up f(x)·Δx. The left sum takes each height from the left end of its strip, the right sum from the right end, and the midpoint sum from the middle.
The trapezoidal sum is the average of the left and right sums. Below, all four are worked on the same function so you can see how far each lands from the exact integral. You'll also get the rules for telling an overestimate from an underestimate, a table problem with unequal widths, and the limit that turns a Riemann sum into a definite integral.
[a, b] into n strips of width Δx = (b − a)/n with points xᵢ = a + iΔx. A Riemann sum is Σ f(xᵢ*)·Δx for i = 1 to n, where xᵢ* is any point in the i-th strip. As n → ∞, every such sum of a continuous f approaches ∫ₐᵇ f(x) dx.What Is a Riemann Sum?
Area under a curved graph has no simple formula, but area of a rectangle does. So you trade one curved region for a row of thin rectangles. Each rectangle is Δx wide, and its height is the function's value at one chosen point in its strip. Add the areas and you have an estimate.
The only decision is which point sets the height. OpenStax Calculus Volume 1, section 5.1 names the two basic choices the left-endpoint approximation Lₙ and the right-endpoint approximation Rₙ. The midpoint version Mₙ uses the center of each strip. Narrower strips hug the curve more closely, which is why every version gets better as n grows.
If f dips below the x-axis, that rectangle's height is negative and it subtracts, just as in a definite integral.
The Four Formulas Side by Side
With x₀ = a, x₁ = a + Δx, and so on up to xₙ = b, there are n + 1 points but only n strips. Each formula uses exactly n heights (the trapezoidal one uses all n + 1 points, but weights the inner ones twice).
| Method | Height of strip i taken at | Formula |
|---|---|---|
| Left sum | left end, xᵢ₋₁ | Lₙ = Δx[f(x₀) + f(x₁) + … + f(xₙ₋₁)] |
| Right sum | right end, xᵢ | Rₙ = Δx[f(x₁) + f(x₂) + … + f(xₙ)] |
| Midpoint sum | center, (xᵢ₋₁ + xᵢ)/2 | Mₙ = Δx[f(m₁) + f(m₂) + … + f(mₙ)] |
| Trapezoidal sum | both ends, averaged | Tₙ = (Δx/2)[f(x₀) + 2f(x₁) + … + 2f(xₙ₋₁) + f(xₙ)] |
The trapezoidal formula looks different, but it's just Tₙ = (Lₙ + Rₙ)/2. Every inner point appears once in the left sum and once in the right sum, so it gets a 2, while f(x₀) and f(xₙ) each appear only once. Strictly, a trapezoid isn't a rectangle, so this isn't a Riemann sum, but it's taught with them because it is built from the same heights.
Adding n + 1 heights to a left or right sum. With 4 strips on [0, 4] you list x = 0, 1, 2, 3, 4, and it's tempting to use all five. A left sum stops at x = 3; a right sum starts at x = 1. Count your terms: there must be exactly one per strip.
One Function, Four Approximations
Estimate ∫₀⁴ x² dx with n = 4 using left, right, midpoint and trapezoidal sums.
Width: Δx = (4 − 0)/4 = 1. Points: x = 0, 1, 2, 3, 4 with heights f = 0, 1, 4, 9, 16.
Left (first four heights): L₄ = 1 × (0 + 1 + 4 + 9) = 14.
Right (last four heights): R₄ = 1 × (1 + 4 + 9 + 16) = 30.
Midpoint (heights at 0.5, 1.5, 2.5, 3.5): M₄ = 1 × (0.25 + 2.25 + 6.25 + 12.25) = 21.
Trapezoidal: T₄ = (1/2)(0 + 2·1 + 2·4 + 2·9 + 16) = (1/2)(44) = 22, which matches (14 + 30)/2 = 22.
Exact value, using the Fundamental Theorem of Calculus: ∫₀⁴ x² dx = 4³/3 = 64/3 ≈ 21.333.
L₄ = 14, R₄ = 30, M₄ = 21, T₄ = 22 against an exact 64/3 ≈ 21.333Now double the strips to n = 8 (Δx = 0.5) and compare the errors, where error means estimate minus exact:
| Method | n = 4 | Error | n = 8 | Error |
|---|---|---|---|---|
| Left | 14 | −7.333 | 17.5 | −3.833 |
| Right | 30 | +8.667 | 25.5 | +4.167 |
| Midpoint | 21 | −0.333 | 21.25 | −0.083 |
| Trapezoidal | 22 | +0.667 | 21.5 | +0.167 |
Three patterns show up. Doubling n roughly halves the left and right errors but cuts the midpoint and trapezoidal errors to a quarter. The midpoint error is half the trapezoidal error and has the opposite sign. And left and right sit on opposite sides of the exact value, so the true area is trapped between them.
Since the midpoint error is about −½ of the trapezoidal error, the combination (2M + T)/3 cancels most of both. Here (2·21 + 22)/3 = 64/3, the exact answer. That weighted average is called Simpson's rule.
Overestimate or Underestimate?
Exams often ask whether an estimate is too big or too small without computing the integral. Two properties decide it, each controlling a different pair of methods.
| If f is… | Left sum | Right sum | Midpoint sum | Trapezoidal sum |
|---|---|---|---|---|
| increasing | under | over | (decided by concavity) | (decided by concavity) |
| decreasing | over | under | (decided by concavity) | (decided by concavity) |
| concave up | (decided by direction) | (decided by direction) | under | over |
| concave down | (decided by direction) | (decided by direction) | over | under |
The left and right rows come from where the rectangle's top sits. On an increasing graph the left end is the lowest point of each strip, so every left rectangle sits under the curve. The concavity rows come from the shape: on a curve that bends upward, a trapezoid's straight top is a chord that lies above the curve, so the trapezoid is too big. OpenStax Calculus Volume 2, section 3.6 covers both the midpoint and trapezoidal rules and their errors.
These rules need the property to hold on the whole interval. If f rises and then falls, you can't predict the left or right sum's direction from the table rule alone.
For f(x) = 12/x on [1, 4] with n = 3, find all four sums and predict which are too high before comparing with the exact value.
Predict first. f′(x) = −12/x² < 0, so f is decreasing: left is over, right is under. f″(x) = 24/x³ > 0, so f is concave up: trapezoidal is over, midpoint is under.
Δx = 1; heights at x = 1, 2, 3, 4 are 12, 6, 4, 3.
L₃ = 12 + 6 + 4 = 22 and R₃ = 6 + 4 + 3 = 13, so T₃ = (22 + 13)/2 = 17.5.
Midpoints 1.5, 2.5, 3.5: M₃ = 8 + 4.8 + 3.4286 ≈ 16.229.
Exact: ∫₁⁴ 12/x dx = 12 ln 4 ≈ 16.636. Then L₃ = 22 and T₃ = 17.5 are above it, while R₃ = 13 and M₃ ≈ 16.229 are below, exactly as predicted.
L₃ = 22 (over), R₃ = 13 (under), M₃ ≈ 16.229 (under), T₃ = 17.5 (over)Averaging the two endpoint heights and calling it the midpoint sum. The midpoint height is f evaluated at the middle x-value, not the mean of f at the ends. On [2, 3] above, f(2.5) = 4.8, but (6 + 4)/2 = 5. Averaging the ends is the trapezoidal sum in disguise.
Riemann Sums from a Table
Some problems give a table of values instead of a formula, often with data such as a rate of flow. The method is the same, with one change: the strips can have different widths, so each rectangle gets its own Δx. You can't factor out a single width.
Water flows into a tank at rate r(t) liters per minute. Readings: t = 0, 2, 5, 7, 12 min give r = 4, 7, 9, 10, 8 L/min. Estimate the water added from t = 0 to t = 12 with left, right and trapezoidal sums.
Widths: 2 − 0 = 2, 5 − 2 = 3, 7 − 5 = 2, 12 − 7 = 5 minutes. They add to 12, a quick check that none is missing.
Left: 4·2 + 7·3 + 9·2 + 10·5 = 8 + 21 + 18 + 50 = 97 L.
Right: 7·2 + 9·3 + 10·2 + 8·5 = 14 + 27 + 20 + 40 = 101 L.
Trapezoidal, one trapezoid per strip: (4 + 7)/2·2 + (7 + 9)/2·3 + (9 + 10)/2·2 + (10 + 8)/2·5 = 11 + 24 + 19 + 45 = 99 L, which again equals (97 + 101)/2.
Units: (L/min) × (min) = L, so each sum is an amount of water, not a rate.
Left ≈ 97 L, right ≈ 101 L, trapezoidal ≈ 99 LCan you say whether 97 L is too low? Not here. The rate rises from 4 to 10 and then falls to 8, so r is not increasing on the whole interval, and the over/under rule doesn't apply. If a question asks, that is the expected answer, with that reason.
A midpoint sum from a table only works when the table contains each strip's middle. With readings at t = 0, 2, 4, 6, 8, for example, you could use two strips [0, 4] and [4, 8] with heights r(2) and r(6).
How Accurate Is Each Method?
The error table in Example 1 wasn't luck. If |f″(x)| ≤ K on [a, b], the bounds listed in OpenStax Calculus Volume 2's chapter 3 key equations are:
|error of Mₙ| ≤ K(b − a)³/(24n²) and |error of Tₙ| ≤ K(b − a)³/(12n²)The n² in the denominator is why doubling n divides these errors by 4, and the 24 versus 12 is why the midpoint is typically twice as accurate. For x² on [0, 4], f″ = 2 everywhere, so K = 2 and the trapezoidal bound at n = 4 is 2·4³/(12·16) = 2/3, exactly the 0.667 error in the table. When f″ is constant, the bound is the error itself.
You can also run the bound backwards to choose n. For the trapezoidal error on ∫₀⁴ x² dx to be under 0.01, you need 128/(12n²) < 0.01, so n² > 1066.7 and n ≥ 33. A left sum would need more than 3,000 strips for the same accuracy, because its error shrinks only like 1/n.
From Riemann Sums to the Definite Integral
Write a right sum with a general n, take the limit, and the estimate becomes exact. This is the definition of the integral, and the limit step uses the same ideas as limits at infinity from earlier in the course.
Find Rₙ for f(x) = x² on [0, 4] as a formula in n, then take n → ∞.
Δx = 4/n and the right ends are xᵢ = 4i/n, so Rₙ = Σ (4i/n)²·(4/n) = (64/n³) Σ i², summing i = 1 to n.
Use Σ i² = n(n + 1)(2n + 1)/6: Rₙ = (64/n³)·n(n + 1)(2n + 1)/6 = 32(n + 1)(2n + 1)/(3n²).
Spot check with n = 4: 32·5·9/(3·16) = 1440/48 = 30, the same R₄ as Example 1.
Limit: (n + 1)(2n + 1)/n² = 2 + 3/n + 1/n² → 2, so Rₙ → 32·2/3 = 64/3.
Rₙ = 32(n + 1)(2n + 1)/(3n²) → 64/3Even R₁₀₀ ≈ 21.654 is still 0.32 too high. In practice you evaluate integrals with antiderivatives, and the integral calculator page covers that method.
How to Check Your Answer
- Count the terms
Left, right and midpoint sums have exactly
nheights. The trapezoidal coefficients follow1, 2, 2, …, 2, 1. - Check T against L and R
Your trapezoidal answer must equal
(L + R)/2. If it doesn't, one of the three is wrong. - Check the sandwich
For a function that only increases (or only decreases), the exact value lies between the left and right sums. For a function with one concavity, it lies between the midpoint and trapezoidal sums, closer to the midpoint.
- Compare with the exact integral
With a formula, find the antiderivative and check that your estimate lands close and on the predicted side.
If you get stuck on a homework problem, you can scan it with Solver AI and compare its step-by-step solution with your own list of heights to see where your work went off track. Work through it yourself first, so the comparison teaches you something.
Direction (increasing or decreasing) decides whether left and right sums run high or low. Concavity decides the midpoint and trapezoidal sums. The midpoint sum is usually the most accurate of the four, and every one of them becomes the integral as n → ∞.
Practice Problems
1. For f(x) = x² + 1 on [0, 2] with n = 2, find L₂, R₂ and M₂.
Answer: Δx = 1. L₂ = 1 + 2 = 3, R₂ = 2 + 5 = 7, M₂ = 1.25 + 3.25 = 4.5. The exact value is 14/3 ≈ 4.667.
2. Use the trapezoidal sum with n = 4 to estimate ∫₀⁴ √x dx. Is it an overestimate or an underestimate?
Answer: T₄ = (1/2)[0 + 2(1 + √2 + √3) + 2] ≈ 5.146. √x is concave down, so the trapezoids sit under the curve: an underestimate of the exact 16/3 ≈ 5.333.
3. A car's velocity is increasing. At t = 0, 4, 10, 16, 20 s it reads v = 0, 12, 20, 24, 25 m/s. Estimate the distance travelled with left, right and trapezoidal sums, and give the range the true distance must lie in.
Answer: widths 4, 6, 6, 4. Left: 0 + 72 + 120 + 96 = 288 m. Right: 48 + 120 + 144 + 100 = 412 m. Trapezoidal: 350 m. Because v is increasing, 288 m ≤ distance ≤ 412 m.
4. For f(x) = x³ on [0, 2], write Rₙ and Lₙ as formulas in n (use Σ i³ = [n(n + 1)/2]²), evaluate both at n = 4, find T₄, and take the limit.
Answer: Rₙ = (16/n⁴)[n(n + 1)/2]² = 4(n + 1)²/n² and Lₙ = 4(n − 1)²/n². At n = 4: R₄ = 6.25, L₄ = 2.25, so T₄ = 4.25. Both formulas tend to 4, which matches ∫₀² x³ dx = 2⁴/4 = 4.