Calcist

Style

Buttons

Spacing

How much to show

Decimal places

Text size

Riemann sum calculator

Enter a function, an interval and the number of subintervals. See the left, right, midpoint, trapezoid and Simpson estimates side by side, each sample point, and how far each one is from the true integral.

Use x, + − * / ^, brackets, sin, cos, tan, exp, ln, log, sqrt, abs, pi and e.

Private: calculated on your device. Nothing you type is sent anywhere.

Next: Integrating over an area instead of an interval? Use the double integral calculator. Adding up a sequence? Try the series calculator.

What a Riemann sum does

A Riemann sum estimates the area under a curve by cutting the interval [a, b] into n strips of equal width Δx = (b − a) ÷ n and adding up simple shapes. The methods differ only in where they measure the height of each strip. As n grows, every method closes in on the definite integral. Use it to check homework, to see why the integral is defined as a limit, or to estimate an integral you can't do by hand.

The five methods

Left: Lₙ = Δx [f(x₀) + f(x₁) + … + f(xₙ₋₁)]
Right: Rₙ = Δx [f(x₁) + f(x₂) + … + f(xₙ)]
Midpoint: Mₙ = Δx [f(m₁) + f(m₂) + … + f(mₙ)], mᵢ the middle of each strip
Trapezoid: Tₙ = (Δx ÷ 2) [f(x₀) + 2f(x₁) + … + 2f(xₙ₋₁) + f(xₙ)]
Simpson (n even): Sₙ = (Δx ÷ 3) [f(x₀) + 4f(x₁) + 2f(x₂) + … + 4f(xₙ₋₁) + f(xₙ)]

Here xᵢ = a + iΔx. Simpson's rule fits a parabola through each pair of strips, which is why it needs an even n. It's also a weighted average of the other two good rules: S₂ₙ = (2Mₙ + Tₙ) ÷ 3.

Worked example

Estimate ∫₀² x² dx with n = 4. Then Δx = 0.5, the endpoints are 0, 0.5, 1, 1.5, 2, and the midpoints are 0.25, 0.75, 1.25, 1.75. The midpoint sum is 0.5 × (0.0625 + 0.5625 + 1.5625 + 3.0625) = 2.625. The exact integral is 2³ ÷ 3 = 8/3 ≈ 2.666667.

Method (n = 4)ValueMinus 8/3
Left7/4 = 1.75−0.916667
Right15/4 = 3.751.083333
Midpoint21/8 = 2.625−0.041667
Trapezoid11/4 = 2.750.083333
Simpson8/3 = 2.6666670

The left sum is too low and the right sum too high, because x² is increasing. Simpson's rule is exact here, because it's exact for every polynomial up to degree 3.

How big is the error?

If |f″(x)| ≤ M on [a, b], the midpoint error is at most M(b − a)³ ÷ (24n²) and the trapezoid error at most M(b − a)³ ÷ (12n²). If |f⁽⁴⁾(x)| ≤ M, Simpson's error is at most M(b − a)⁵ ÷ (180n⁴). Doubling n cuts the midpoint and trapezoid errors by about 4 and Simpson's by about 16. Left and right sums only improve in proportion to 1 ÷ n.

Limitations

  • The "integral" row is exact for polynomials. For other functions it's a high-accuracy numerical value, and the page says so. If the function misbehaves, no reference is shown.
  • If f is undefined at a point a method needs, such as 1/x at x = 0, that method is marked instead of returning a wrong number. An improper integral needs a limit, not a sum.
  • Results are signed: area below the x-axis counts as negative.

Sources

How we checked this

Before every update, this calculator is run in a real browser with these known answers, and it must match all of them:

  • ∫₀² x² dx, n = 4: midpoint sum 21/8 = 2.625 ✓
  • Left sum 7/4 = 1.75 ✓
  • Right sum 15/4 = 3.75 ✓
  • Trapezoid 11/4 = 2.75 ✓
  • Simpson = 8/3 exactly ≈ 2.666666667 ✓
  • Exact integral 8/3 shown for a polynomial ✓
  • sin x on [0, π], n = 6: midpoint ≈ 2.02303032 (integral 2) ✓
  • Simpson with odd n is refused ✓
  • Left sum of 1/x from 0 hits x = 0 ✓

Last checked October 26, 2026. Spotted something wrong? The math is done in your browser with the formula shown on this page, so you can check any result by hand.

Add this calculator to your website (free)

Paste this code into any web page. The calculator works on your page, resizes itself, has no ads and no tracking, and nothing your visitors type is sent anywhere. More about embedding.

Questions people ask

What is the midpoint rule?

The midpoint rule is a Riemann sum that measures each strip's height at its middle. It's usually about twice as accurate as the trapezoidal rule and has the opposite sign of error for curves that bend one way.

Which Riemann sum is most accurate?

For smooth functions, Simpson's rule, then the midpoint and trapezoidal rules. Left and right sums are the least accurate. Their errors shrink only in proportion to 1 ÷ n.

Is a left Riemann sum an overestimate or an underestimate?

For an increasing function the left sum underestimates and the right sum overestimates. For a decreasing function it's the other way round.

Why does Simpson's rule need an even n?

It fits one parabola across each pair of strips, so the strips have to come in pairs.

How do I write a Riemann sum in sigma notation?

For the midpoint rule: Σ from i = 1 to n of f(a + (i − ½)Δx) Δx, with Δx = (b − a) ÷ n. For the right sum use f(a + iΔx), and for the left sum f(a + (i − 1)Δx).

Related calculators