Riemann Sum Calculator (Left, Right, Midpoint, Trapezoid)

CalculusFreeNo sign-up

A Riemann sum calculator estimates the area under f(x) on [a, b] by cutting the interval into n strips of width Δx = (b − a)/n and adding f(sample point) × Δx. For f(x) = x² on [0, 2] with n = 4, the left sum is 0.5 × (0 + 0.25 + 1 + 2.25) = 1.75, while the exact area is 8/3 ≈ 2.667.

Riemann sum calculator with steps
Reads asf(x) = x2
Type x^3 for x³, 2x for 2·x, sqrt(x), e^x, ln(x), sin(x), 1/(x+1). Limits can be numbers, fractions, pi or e (for example pi/2). n can be 1 to 10,000.
Try:
Left Riemann sum, n = 4
L₄ = 7/4 = 1.75
Width Δx1/2 = 0.5
Exact integral ∫ f(x) dx8/3 ≈ 2.66667
Error (sum − integral)−0.916667 (34.37%)
Estimate isan underestimate
0.511.521234
f(x) = x²rectangles above the axis addbelow the axis subtractsample points
Compare all methods (n = 4)
Method Value Error
Left Riemann sum 7/4 ≈ 1.75 −0.916667
Right Riemann sum 15/4 ≈ 3.75 +1.08333
Midpoint sum 21/8 ≈ 2.625 −0.0416667
Trapezoid sum 11/4 ≈ 2.75 +0.0833333
Upper sum 3.75 +1.08333
Lower sum 1.75 −0.916667
Simpson’s rule (n even) 2.666666667 0
Table of xᵢ and f(xᵢ) (4 rows)
i [xᵢ₋₁, xᵢ] sample xᵢ* f(xᵢ*) f(xᵢ*)·Δx
1 [0, 0.5] 0 0 0
2 [0.5, 1] 0.5 0.25 0.125
3 [1, 1.5] 1 1 0.5
4 [1.5, 2] 1.5 2.25 1.125
Total 1.75
Show steps
  1. Find the width of each subintervalΔx = (b − a)/n = (2 − 0)/4 = 1/2 ≈ 0.5
  2. Mark the partition pointsxᵢ = a + iΔx: x₀ = 0, x₁ = 0.5, x₂ = 1, x₃ = 1.5, x₄ = 2
  3. Choose the heightsUse the left end of each subinterval: xᵢ* = xᵢ₋₁, so the heights are f(x₀), f(x₁), …, f(x₃).
  4. Write the sum Σ f(xᵢ*)·ΔxL₄ = 0.5·[0 + 0.25 + 1 + 2.25]
  5. Add and multiplyThe heights add up to 3.5, so L₄ = 0.5 × 3.5 = 7/4 ≈ 1.75
  6. Exact value with the Fundamental Theorem of CalculusF(x) = x3/3, so ∫ f(x) dx from 0 to 2 = F(b) − F(a) = 8/3 ≈ 2.66667
  7. CompareError = 1.75 − 2.666666667 = −0.916667. f is increasing on [a, b], so left sums underestimate and right sums overestimate. Doubling n usually makes the error about 2 times smaller.

Related: integral calculator · Simpson’s rule calculator · summation (sigma) calculator

Riemann Sum Calculator (Left, Right, Midpoint, Trapezoid)
Embed this calculator on your site

Free to use on class pages, blogs and course pages. Copy the code below and paste it into your page:

How to use the Riemann sum calculator

  1. Choose Function f(x) if you have a formula, or Data table if your problem gives a table of x and f(x) values.
  2. Type the function (for example x^2, sin(x) or 1/x), the limits a and b, and the number of subintervals n. Limits can be fractions or use pi, such as pi/2.
  3. Pick a method: left, right, midpoint, trapezoid, upper or lower sum. The answer updates as you type; press Compute sum or Enter at any time.
  4. Read the sum, the exact integral and the error, then look at the rectangles on the graph, the table of xᵢ and f(xᵢ), and the steps.

The “Compare all methods” table shows every sum for the same n side by side, plus Simpson’s rule when n is even, so you can see which estimate is closest.

How Riemann sums work

Split [a, b] into n subintervals of equal width Δx = (b − a)/n. The partition points are xᵢ = a + iΔx, for i = 0, 1, …, n. On each subinterval choose a sample point xᵢ*, build a rectangle of height f(xᵢ*), and add the areas:

Riemann sum = Σ f(xᵢ*) Δx, with the sum running from i = 1 to n.

The method decides where the sample point sits:

Method Sample point Formula Error shrinks like
Left (Lₙ) left end xᵢ₋₁ Δx[f(x₀) + … + f(xₙ₋₁)] 1/n
Right (Rₙ) right end xᵢ Δx[f(x₁) + … + f(xₙ)] 1/n
Midpoint (Mₙ) (xᵢ₋₁ + xᵢ)/2 Δx[f(m₁) + … + f(mₙ)] 1/n²
Trapezoid (Tₙ) both ends (Δx/2)[f(x₀) + 2f(x₁) + … + 2f(xₙ₋₁) + f(xₙ)] 1/n²
Upper sum where f is largest Δx[max₁ + … + maxₙ] depends on f
Lower sum where f is smallest Δx[min₁ + … + minₙ] depends on f

The trapezoid sum is the average of the left and right sums: Tₙ = (Lₙ + Rₙ)/2. Rectangles below the x-axis count as negative, so a Riemann sum estimates the signed area, the same thing the definite integral measures.

Over- or underestimate? The quick rules

  • If f is increasing on [a, b], left sums underestimate and right sums overestimate. If f is decreasing, it is the other way round.
  • If f is concave up (curving upward, like x²), trapezoids overestimate and midpoints underestimate. If f is concave down, it is the other way round.
  • An upper sum is never below the integral and a lower sum is never above it, whatever the shape of f.

The calculator checks the shape of your function and says which rule applies in the last step.

Worked examples

Example 1: four methods for x² on [0, 2]

With n = 4, Δx = (2 − 0)/4 = 0.5 and the partition points are 0, 0.5, 1, 1.5, 2. The function values are 0, 0.25, 1, 2.25 and 4.

  • Left: L₄ = 0.5 × (0 + 0.25 + 1 + 2.25) = 0.5 × 3.5 = 1.75.
  • Right: R₄ = 0.5 × (0.25 + 1 + 2.25 + 4) = 0.5 × 7.5 = 3.75.
  • Midpoint: the midpoints are 0.25, 0.75, 1.25, 1.75, so M₄ = 0.5 × (0.0625 + 0.5625 + 1.5625 + 3.0625) = 0.5 × 5.25 = 2.625.
  • Trapezoid: T₄ = (1.75 + 3.75)/2 = 2.75.

The exact value is ∫ x² dx from 0 to 2 = 2³/3 = 8/3 ≈ 2.6667. Because x² is increasing, L₄ is too low and R₄ too high. Because x² is concave up, M₄ is slightly low (error −0.0417) and T₄ slightly high (error +0.0833).

Example 2: a Riemann sum from a table

A table gives x = 0, 2, 5, 7, 10 and f(x) = 3, 7, 12, 10, 4. The widths are unequal (2, 3, 2, 3), so each term keeps its own width:

  • Left sum = 2(3) + 3(7) + 2(12) + 3(10) = 6 + 21 + 24 + 30 = 81.
  • Right sum = 2(7) + 3(12) + 2(10) + 3(4) = 14 + 36 + 20 + 12 = 82.
  • Trapezoid sum = (81 + 82)/2 = 81.5.

For a midpoint sum from a table you need an odd number of points, so that every other x value is the middle of a double-width subinterval. With x = 0, 10, 20, …, 60 and velocities 0, 12, 20, 25, 27, 26, 22, the midpoint sum is 20 × (12 + 25 + 26) = 1,260, an estimate of the distance travelled.

Example 3: midpoint sum for sin x on [0, π]

With n = 4, Δx = π/4 and the midpoints are π/8, 3π/8, 5π/8, 7π/8. By symmetry the four sine values are 0.38268, 0.92388, 0.92388, 0.38268, which add to 2.61313. So M₄ = (π/4) × 2.61313 ≈ 2.05234. The exact area is −cos π + cos 0 = 2, an error of about 0.0523 with only four rectangles.

From Riemann sums to the definite integral

As n grows, the rectangles get thinner and every method closes in on the same number, the definite integral:

∫ f(x) dx from a to b = lim (n → ∞) Σ f(xᵢ*) Δx.

For x² on [0, 2] the left sum climbs toward 8/3:

n Left sum Lₙ Midpoint Mₙ Error of Lₙ
4 1.75 2.625 −0.9167
10 2.28 2.66 −0.3867
100 2.6268 2.6666 −0.0399
1,000 2.662668 2.666666 −0.0040

Ten times more rectangles makes the left-sum error about ten times smaller, but the midpoint error about a hundred times smaller. That is why midpoint, trapezoid and Simpson’s rule are preferred in practice.

Common mistakes with Riemann sums

Mistake How to catch it
Using n + 1 terms in a left or right sum A left sum stops at xₙ₋₁ and a right sum starts at x₁: always exactly n heights.
Forgetting to multiply by Δx Adding heights alone gives a number with the wrong units; compare with the table’s area column.
Assuming equal widths in a table Subtract neighbouring x values first. Unequal widths need width × height for each term.
Doubling the first and last trapezoid values Only the inside points get the factor 2.
Rounding f(xᵢ) early Keep at least 4 decimals until the final sum.
Treating area below the axis as positive A Riemann sum gives signed area; for total area use |f(x)|.

Checking homework with the calculator

Work the sum by hand first: find Δx, list the sample points, then add. Enter the same problem and compare your list of heights with the table of xᵢ and f(xᵢ). If only the total differs, the mistake is in the arithmetic; if a height differs, the sample point is wrong. Before calculating, estimate: the sum should lie between (b − a) times the smallest and the largest value of f on the interval.

Riemann sums practice quiz: 10 questions

Test yourself with 10 multiple-choice questions. Choose an answer and press Submit to see if you are right and why. Your score appears at the end.

Question 1 of 10
1. What is Δx for a Riemann sum on [1, 7] with n = 3 subintervals?

Found a mistake? Let us know!

2. Find the left Riemann sum of f(x) = x² on [0, 3] with n = 3.

Found a mistake? Let us know!

3. Find the right Riemann sum of f(x) = x² on [0, 3] with n = 3.

Found a mistake? Let us know!

4. Find the midpoint sum of f(x) = 2x + 1 on [0, 4] with n = 2.

Found a mistake? Let us know!

5. If L₄ = 10 and R₄ = 14, what is the trapezoid sum T₄?

Found a mistake? Let us know!

6. f is increasing on [a, b]. Which statement is true?

Found a mistake? Let us know!

7. For a concave up function, the trapezoid sum is usually…

Found a mistake? Let us know!

8. A table gives x = 0, 1, 3 and f(x) = 2, 4, 5. What is the right Riemann sum?

Found a mistake? Let us know!

9. What does the midpoint sum of sin x on [0, π] with n = 2 equal (to 3 decimals)?

Found a mistake? Let us know!

10. Which expression defines ∫ f(x) dx from a to b?

Found a mistake? Let us know!

Frequently asked questions

How do you calculate a Riemann sum?

Find Δx = (b − a)/n, choose a sample point in each subinterval, evaluate f there, add the n values and multiply by Δx. For x² on [0, 2] with n = 4 left endpoints that is 0.5 × 3.5 = 1.75.

How do you do a left Riemann sum?

Use the left end of every subinterval: Lₙ = Δx[f(x₀) + f(x₁) + … + f(xₙ₋₁)]. The last point b is not used. For an increasing function the left sum underestimates the area.

How do you find a midpoint Riemann sum?

Evaluate f at the middle of each subinterval, mᵢ = (xᵢ₋₁ + xᵢ)/2, add the values and multiply by Δx. It is usually much closer than left or right sums: for x² on [0, 2] with n = 4 it gives 2.625 against the exact 2.6667.

How do you calculate a Riemann sum with a table?

Multiply each subinterval's width (the difference of neighbouring x values) by the table value at the chosen end, then add. Widths may differ, so do not use a single Δx unless the x values are equally spaced. Use the Data table tab to check.

How do you do a Riemann sum on a TI-84?

Use sum( and seq( from the LIST menu. For the left sum of x² on [0, 2] with n = 4, enter sum(seq(X², X, 0, 1.5, 0.5)) × 0.5, which returns 1.75. The seq( start and end are the first and last sample points, and the step is Δx.

Is the Riemann sum Calc 1 or Calc 2?

Riemann sums are introduced in Calculus 1 (and AP Calculus AB) to define the definite integral. They come back in Calculus 2 with numerical integration, error bounds and series.

Related calculators

More calculus calculators

Browse all 541 calculators

Related to This Article

What people say about "Riemann Sum Calculator: Left, Right, Midpoint, Trapezoid"?

No one replied yet.

Leave a Reply