Skip to content
FiftyCalc Free calculators for all 50 states

Riemann Sum Calculator

Test cases replayed : 4 of 4 match · Methodology · No outside source listed

Enter the coefficients of f(x) = c3x³ + c2x² + c1x + c0, the interval [a, b] and the number of subintervals n. The calculator gives the four standard approximations and the exact integral.

Result

Sample figures

Midpoint Riemann sum (midpoint rule)—

Width of each subinterval Δx = (b − a) ÷ n —

  • Left Riemann sum—
  • Right Riemann sum—
  • Trapezoidal rule—
  • Exact integral from a to b—
  • Midpoint sum minus exact value—

Estimate for planning only, not tax, legal, financial or medical advice. This calculator uses the method explained on this page.

Riemann Sum Calculator

c3 (coefficient of x³): enter a number. Prefilled example: 0.

c2 (coefficient of x²): enter a number. Prefilled example: 1.

c1 (coefficient of x): enter a number. Prefilled example: 0.

c0 (constant): enter a number. Prefilled example: 0.

Lower limit a: enter a number. Prefilled example: 0.

Upper limit b: enter a number. Prefilled example: 2.

Number of subintervals n: enter a number from 1 to 100,000. Prefilled example: 4.

How to use this calculator

Fill in the fields in this order; each step takes you to its field.

  1. c3 (coefficient of x³): enter a number.
  2. c2 (coefficient of x²): enter a number.
  3. c1 (coefficient of x): enter a number.
  4. c0 (constant): enter a number.
  5. Lower limit a: enter a number.
  6. Upper limit b: enter a number.
  7. Number of subintervals n: enter a number from 1 to 100,000.
  8. Read the result: Midpoint Riemann sum (midpoint rule); the panel also shows Width of each subinterval Δx = (b − a) ÷ n, Left Riemann sum, Right Riemann sum, Trapezoidal rule, Exact integral from a to b and Midpoint sum minus exact value.

How this calculator works

Split [a, b] into n equal subintervals of width Δx = (b − a) ÷ n, with points xᵢ = a + iΔx. Left sum = Δx × [f(x₀) + … + f(xₙ₋₁)]; right sum = Δx × [f(x₁) + … + f(xₙ)]; midpoint sum = Δx × the sum of f at the middle of each subinterval; trapezoidal rule = (left sum + right sum) ÷ 2.

Because f is a polynomial, the sums are computed exactly with the closed forms of 0 + 1 + … + (n − 1) raised to the powers 1, 2 and 3 (n(n − 1)/2, (n − 1)n(2n − 1)/6 and [n(n − 1)/2]²), so a large n gives no rounding drift from adding many terms.

Exact integral = F(b) − F(a) with the antiderivative F(x) = c3x⁴/4 + c2x³/3 + c1x²/2 + c0x (fundamental theorem of calculus). Results are shown to 4 decimal places.

Worked example

c3 (coefficient of x³)0
c2 (coefficient of x²)1
c1 (coefficient of x)0
c0 (constant)0
Lower limit a0
Upper limit b2
Number of subintervals n4
Width of each subinterval Δx = (b − a) ÷ n0.5
Left Riemann sum1.75
Right Riemann sum3.75
Midpoint Riemann sum (midpoint rule)2.625
Trapezoidal rule2.75
Exact integral from a to b2.6667
Midpoint sum minus exact value-0.0417

Frequently asked questions

Which Riemann sum is most accurate?

For smooth functions the midpoint rule and the trapezoidal rule are usually much closer than the left or right sums, and the midpoint error is about half the trapezoidal error, with the opposite sign, when f'' does not change sign.

Why is the trapezoidal rule the average of the left and right sums?

Each trapezoid's area is Δx × [f(xᵢ) + f(xᵢ₊₁)] ÷ 2, and adding them gives exactly half the sum of the left and right Riemann sums.

What happens if b is less than a?

Δx is negative, so each sum is minus the matching sum from b to a (the left and right sums trade places), as the integral from a to b is minus the integral from b to a.

Related calculators