Riemann Sums: Left, Right, Midpoint and Trapezoidal, Side by Side
Solver AI TeamPublished 13 min read
A Riemann sum estimates the area under a curve by adding up rectangles. See left, right, midpoint and trapezoidal sums worked on the same function with their errors against the exact integral, the rules for overestimates and underestimates, table problems with unequal widths, and how the limit becomes the definite integral.
Frequently asked questions
What is a Riemann sum?
A Riemann sum estimates the area under y = f(x) from a to b. You split the interval into n strips of width Δx = (b − a)/n, pick one x-value in each strip, and add up f(x)·Δx. The choice of x (left end, right end or middle) gives the left, right or midpoint sum. As n grows, the sum approaches the definite integral.
What is the difference between a left and a right Riemann sum?
A left sum takes each rectangle's height from the left end of its strip, so it uses f(x₀) through f(xₙ₋₁). A right sum uses the right ends, f(x₁) through f(xₙ). Both have n terms. For x² on [0, 4] with four strips, the left sum is 14 and the right sum is 30, while the exact area is 64/3, about 21.33.
Is the trapezoidal rule a Riemann sum?
Strictly, no: a Riemann sum uses rectangles, and the trapezoidal rule uses trapezoids. It is always the average of the left and right sums, T = (L + R)/2, so courses teach it alongside them. It usually beats both left and right sums because the slanted top follows the curve more closely.
How do you know if a Riemann sum is an overestimate or an underestimate?
For left and right sums, look at whether f is increasing or decreasing. If f increases, the left sum is too low and the right sum too high; if f decreases, it flips. For midpoint and trapezoidal sums, look at concavity. If f is concave up, the trapezoidal sum is too high and the midpoint sum too low; if concave down, it flips.
Which Riemann sum is the most accurate?
For a smooth function, the midpoint and trapezoidal sums are far better than left and right sums. Their errors shrink with 1/n², so doubling n cuts the error to about a quarter, while left and right errors only halve. The midpoint error is usually about half the trapezoidal error and has the opposite sign, which makes the midpoint sum the usual winner.
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.
The Definition: Riemann Sum
Split [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).
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.
Common Mistake
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
Example 1: All four sums for f(x) = x² on [0, 4]
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.
AnswerL₄ = 14, R₄ = 30, M₄ = 21, T₄ = 22 against an exact 64/3 ≈ 21.333
Now 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.
Why it works
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.
Example 2: A decreasing, concave-up function
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.
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.
Example 3: Water flowing into a tank (unequal widths)
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.
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.
AnswerLeft ≈ 97 L, right ≈ 101 L, trapezoidal ≈ 99 L
Can 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).
|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.
Example 4: The limit of the right sum for x² on [0, 4]
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.
Even 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 n heights. The trapezoidal coefficients follow 1, 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.
The Takeaway
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₂.
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.