How it’s calculated
A Riemann sum estimates the area under a curve by splitting [a, b] into n equal subintervals of width Δx = (b − a)/n and adding up rectangles. The height of each rectangle is f at the left end, the right end or the middle of its subinterval. The trapezoidal rule joins the endpoints with straight lines instead, and equals the average of the left and right sums.
Because f is a polynomial, the exact integral is also known (from its antiderivative), so the calculator shows how far off each estimate is. All four approach the exact value as n grows. The midpoint and trapezoid errors shrink roughly with 1/n², the left and right errors only with 1/n.
Example: f(x) = x² on [0, 2] with n = 4, so Δx = 0.5 and x = 0, 0.5, 1, 1.5, 2. L₄ = 0.5 × (0 + 0.25 + 1 + 2.25) = 1.75; R₄ = 0.5 × (0.25 + 1 + 2.25 + 4) = 3.75; M₄ = 0.5 × (0.0625 + 0.5625 + 1.5625 + 3.0625) = 2.625; T₄ = (1.75 + 3.75)/2 = 2.75. The exact value is 8/3 ≈ 2.6667, so the left sum underestimates (x² is increasing) and the right sum overestimates.
If you only have measured data points rather than a formula, use the numerical integration calculator instead.
Frequently asked questions
Which Riemann sum is most accurate?
Usually the midpoint sum, then the trapezoidal rule; both have errors that shrink with 1/n². The left and right sums are less accurate, with errors shrinking with 1/n.
When does the left sum underestimate?
When f is increasing on the interval, every left-endpoint rectangle sits below the curve, so Lₙ is too small and Rₙ too big. For a decreasing function it is the other way round.
Why is the trapezoid sum the average of left and right?
Each trapezoid has area Δx × (f(xᵢ₋₁) + f(xᵢ))/2, which is the average of the left and right rectangles on that subinterval.
How large can n be?
Up to 100,000. The table lists the first 20 subintervals.
Embed this calculator
Add this free calculator to your own website. Copy the code below into your page’s HTML:
Need this calculator branded, changed or built around your own prices?See custom business solutions →
Sources
- Calculus Volume 1, §5.1 Approximating Areas (left and right endpoint sums, Example 5.4) — OpenStax
- Calculus Volume 2, §3.6 Numerical Integration (midpoint and trapezoidal rules) — OpenStax
Formulas are taken from the free public references above. Results are provided “as is” for informational and educational purposes only. See our disclaimer.
Added · Last updated · How we check our calculators
Spotted a mistake or missing option? Report a problem· Suggest a calculator