Riemann Sum & Integral Approximation Calculator

Approximate a definite integral with rectangles or trapezoids. Enter a polynomial, set the interval and choose how many pieces to use. The graph draws the chosen method over the function and highlights the subinterval you inspect. A convergence table compares all four methods with the polynomial antiderivative, so you can see how rounding the curve into shapes affects the answer.

Numerical integration

Riemann sum workspace

Compare rectangle and trapezoid estimates, then see how the error changes as you divide the interval.

Polynomial and interval

f(x) = ax³ + bx² + cx + d

Definite integral 2.6666667. Left endpoints estimate 1.75.

Definite integral
2.6666667
From the polynomial antiderivative
Left endpoints
1.75
Estimate using 4 subintervals
Signed error
-0.91666667
Estimate minus integral

Rectangles and trapezoids

Left endpoints on the selected intervalThe shaded shapes approximate the integral from 0 to 2. Subinterval 1 is highlighted. Exact values are in the interval inspector.
x from 0 to 2Vertical values 0 to 4Dark curve represents f(x)Shaded shapes represent estimates
Left x
0
Midpoint x
0.25
Right x
0.5
Signed contribution
0

Convergence comparison

Each cell shows an estimate, followed by its signed error.

SubintervalsLeft endpointsRight endpointsMidpointTrapezoid
10Error -2.66666678Error 5.33333332Error -0.666666674Error 1.3333333
21Error -1.66666675Error 2.33333332.5Error -0.166666673Error 0.33333333
4 selected1.75Error -0.916666673.75Error 1.08333332.625Error -0.0416666672.75Error 0.083333333
82.1875Error -0.479166673.1875Error 0.520833332.65625Error -0.0104166672.6875Error 0.020833333
162.421875Error -0.244791672.921875Error 0.255208332.6640625Error -0.00260416672.671875Error 0.0052083333
322.5429688Error -0.123697922.7929688Error 0.126302082.6660156Error -0.000651041672.6679688Error 0.0013020833
642.6044922Error -0.0621744792.7294922Error 0.0628255212.6665039Error -0.000162760422.6669922Error 0.00032552083
1282.635498Error -0.031168622.697998Error 0.031331382.666626Error -4.06901e-52.666748Error 8.13802e-5
2562.651062Error -0.0156046552.682312Error 0.0156453452.6666565Error -1.01725e-52.666687Error 2.03451e-5

How to use this calculator

  1. Enter the four coefficients of f(x). Enter zero for terms that are absent, such as the cubic coefficient of a quadratic.
  2. Enter Lower bound and Upper bound, then choose the number of Subintervals.
  3. Choose a Graph method and Inspect subinterval to check the sampled contribution. The graph marks the same subinterval shown in the inspector.
  4. Compare the four methods in Convergence comparison. Use Download sums CSV to save every subinterval and convergence result.

The Formula

The mathematical logic powering this calculation is:

For f(x) = ax³ + bx² + cx + d on [L, U] with n equal subintervals, let Δx = (U − L)/n and xᵢ = L + iΔx. The left rule sums Δx × f(xᵢ) using the start of each subinterval. The right rule uses its end, f(xᵢ₊₁). The midpoint rule uses f((xᵢ + xᵢ₊₁)/2). The trapezoid rule averages the two endpoint heights on each subinterval before multiplying by Δx.

The definite integral is F(U) − F(L), where F(x) = ax⁴/4 + bx³/3 + cx²/2 + dx. The convergence comparison uses signed error, calculated as estimate minus integral. So an error below zero means the estimate is lower. The calculator uses exact integer numerators for decimal inputs and rational subinterval positions before converting the results to numbers for display and export.

Use 1–256 subintervals. Each coefficient and bound accepts six decimal places and a magnitude of at most 1,000,000. The upper bound may equal the lower bound. Negative values below the x-axis contribute negative signed area. If you need total geometric area, integrate each region between zeros separately and add the absolute areas.

Worked Example

If you input:

  • Cubic coefficient a: 0
  • Quadratic coefficient b: 1
  • Linear coefficient c: 0
  • Constant d: 0
  • Lower bound: 0
  • Upper bound: 2
  • Subintervals: 4

Result:

For x² on [0, 2], each subinterval has width 0.5. The left and right estimates are 1.75 and 3.75. The midpoint estimate is 2.625 and the trapezoid estimate is 2.75. The definite integral is 8/3, approximately 2.6666667.

Frequently Asked Questions

What’s the difference between left and right Riemann sums?

Each uses rectangles of the same width. The left rule uses the height at the start of each subinterval and the right rule uses the height at the end. For an increasing function, the left estimate is lower than the right estimate.

How do midpoint rectangles and trapezoids differ?

The midpoint rule uses a rectangle with height sampled at the middle of each subinterval. The trapezoid rule connects the two endpoint heights with a straight segment. A linear function is integrated exactly by both.

What does a negative estimate mean?

The calculator reports signed area. Area below the horizontal axis contributes a negative amount, so those contributions can offset the positive area above the axis.

Do more subintervals always give a better estimate?

For a continuous function, these approximations converge to the integral as the subintervals shrink. Individual signed errors can cancel at some counts, so compare the table when the function bends or crosses the axis.

What happens when the bounds are equal?

Every subinterval has width zero. The definite integral and each estimate are zero.

Similar Calculators