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.
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.
Rectangles and trapezoids
- 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.
| Subintervals | Left endpoints | Right endpoints | Midpoint | Trapezoid |
|---|---|---|---|---|
| 1 | 0Error -2.6666667 | 8Error 5.3333333 | 2Error -0.66666667 | 4Error 1.3333333 |
| 2 | 1Error -1.6666667 | 5Error 2.3333333 | 2.5Error -0.16666667 | 3Error 0.33333333 |
| 4 selected | 1.75Error -0.91666667 | 3.75Error 1.0833333 | 2.625Error -0.041666667 | 2.75Error 0.083333333 |
| 8 | 2.1875Error -0.47916667 | 3.1875Error 0.52083333 | 2.65625Error -0.010416667 | 2.6875Error 0.020833333 |
| 16 | 2.421875Error -0.24479167 | 2.921875Error 0.25520833 | 2.6640625Error -0.0026041667 | 2.671875Error 0.0052083333 |
| 32 | 2.5429688Error -0.12369792 | 2.7929688Error 0.12630208 | 2.6660156Error -0.00065104167 | 2.6679688Error 0.0013020833 |
| 64 | 2.6044922Error -0.062174479 | 2.7294922Error 0.062825521 | 2.6665039Error -0.00016276042 | 2.6669922Error 0.00032552083 |
| 128 | 2.635498Error -0.03116862 | 2.697998Error 0.03133138 | 2.666626Error -4.06901e-5 | 2.666748Error 8.13802e-5 |
| 256 | 2.651062Error -0.015604655 | 2.682312Error 0.015645345 | 2.6666565Error -1.01725e-5 | 2.666687Error 2.03451e-5 |
How to use this calculator
- Enter the four coefficients of f(x). Enter zero for terms that are absent, such as the cubic coefficient of a quadratic.
- Enter Lower bound and Upper bound, then choose the number of Subintervals.
- Choose a Graph method and Inspect subinterval to check the sampled contribution. The graph marks the same subinterval shown in the inspector.
- 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
Summation & Series Explorer
Evaluate sigma notation with exact fractions. Explore indexed expressions, arithmetic and geometric series, partial sums, cancellation, remainders and CSV.
Piecewise Function Graph Calculator
Graph a piecewise function with open and closed endpoints. Evaluate f(x), compare one-sided limits, and identify gaps, jumps and removable discontinuities.
Quadratic Formula Calculator
Solve any quadratic equation ax² + bx + c = 0 and find its real or complex roots instantly.
Polynomial Division Calculator
Divide polynomials using long or synthetic division. Inspect each step, the exact quotient and remainder, and the reconstruction identity.
