Left and Right Sums
Error ∝ 1/n. For x² on [0, 2] with n = 4, the left sum error is −0.9167.
Midpoint rule for f(x) on [a, b] with the error bound, the n you need and a graph.
Enter your values below to get started.
Midpoints sit at a + (i − ½)Δx, never at a or b, so f only needs a value inside the interval.
Limits accept pi, e and fractions like 1/2.
Double n and the midpoint error drops about 4×.
(2Mn + Tn) / 3 gives Simpson's rule with 2n subintervals.
A midpoint sum calculator estimates ∫ab f(x) dx with the midpoint rule: n rectangles whose heights equal f at the center of each subinterval. Enter the function, the limits and n to get Mn, each midpoint in a table, the actual error, the error bound (b − a)³K / 24n², the smallest n for a target error and a comparison with the trapezoidal and Simpson's rules.
A midpoint sum is a Riemann sum in which each of the n rectangles takes its height from f at the center of its subinterval. The method is called the midpoint rule, and the result is written Mn.
For f(x) = x² on [0, 2] with n = 4, the midpoints are 0.25, 0.75, 1.25 and 1.75, and M4 = 2.625. The exact area is 8/3 ≈ 2.6667, an error of only 0.0417, half the trapezoidal error of 0.0833.
The midpoint sum calculator finds Δx, places one midpoint mi = a + (i − ½)Δx in each of the n subintervals, evaluates f at every midpoint, adds the values and multiplies by Δx. The calculator then measures the error against a reference integral (Simpson's rule with 2,000 subintervals) and estimates K = max |f″(x)| from 1,000 sample points for the error bound.
Δx = (b − a) / n. For [1, 3] and n = 4, Δx = 0.5.
mi = a + (i − ½)Δx: 1.25, 1.75, 2.25, 2.75.
For f(x) = 1/x: 0.8, 0.5714, 0.4444, 0.3636.
M4 = 0.5 × 2.1795 = 1.0898 (exact ln 3 ≈ 1.0986).
The midpoint sum formula is Mn = Δx[f(m1) + f(m2) + ⋯ + f(mn)], where mi = a + (i − ½)Δx and Δx = (b − a) / n.
A midpoint rectangle has the same area as the trapezoid under the tangent line at the midpoint: the tangent cuts off 2 equal triangles, one above and one below the rectangle top. The error therefore depends on curvature (f″), not on slope (f′).
For x² on [0, 2] with n = 4: (2 × 2.625 + 2.75) / 3 = 8/3, the exact value.
The midpoint sum is the most accurate of the 4 basic Riemann sums for smooth functions: its error is about half the trapezoidal error, with the opposite sign, and far smaller than the left or right sum error.
Error ∝ 1/n. For x² on [0, 2] with n = 4, the left sum error is −0.9167.
Error ∝ 1/n², bound (b − a)³K / 12n². T4 error for x² on [0, 2]: +0.0833.
Error ∝ 1/n², bound (b − a)³K / 24n². M4 error for x² on [0, 2]: −0.0417.
(2Mn + Tn) / 3 cancels the leading errors; error ∝ 1/n⁴.
To calculate a midpoint sum by hand, take 5 steps: find Δx, list the n midpoints, evaluate f at each midpoint, add the values, and multiply by Δx. Here is M3 for f(x) = x² + 1 on [0, 3].
The error of a midpoint sum is at most (b − a)³K / (24n²), where K is the largest value of |f″(x)| on [a, b]. The bound is half the trapezoidal bound.
Solving for n gives n ≥ √((b − a)³K / 24ε). For x² on [0, 2] and ε = 0.001: n ≥ √(16 / 0.024) ≈ 25.8, so n = 26. For eˣ on [0, 1] and ε = 0.0001: K = e and n = 34, against 48 for the trapezoidal rule.
A midpoint sum underestimates when f is concave up (f″ > 0) and overestimates when f is concave down (f″ < 0), the opposite of the trapezoidal sum. On a linear function, the midpoint sum is exact.
Type f(x), set a, b and n, add a target error if you need one, and press Calculate. The result card shows Mn, the actual error, the error bound, Tn and Simpson's value; the tabs show each step, the rectangles with their midpoints and a table of every midpoint.
For example sqrt(x), e^(-x^2) or 1/x.
n is the number of rectangles, from 1 to 10,000.
Optional: 0.0001 returns the n that the bound guarantees.
The result rows include Tn and (2Mn + Tn) / 3.
Midpoint sums turn a reading taken at the middle of each time block into a total or an average. 4 common uses:
Common midpoint rule problems with exact integrals and errors.
| Integral | n | Mₙ | Exact | Error | Calculator |
|---|---|---|---|---|---|
| 4 | 2.625 | 2.6667 | −0.0417 | ||
| 4 | 2.0523 | 2 | +0.0523 | ||
| 4 | 1.0898 | 1.0986 | −0.0089 | ||
| 10 | 1.71757 | 1.71828 | −0.00072 | ||
| 4 | 3.875 | 4 | −0.125 | ||
| 3 | 2.5745 | 2.5452 | +0.0293 |
Work each one by hand, then reveal the answer or solve it in the calculator.
Midpoint sum of f(x) = x² + 1 on [0, 3] with n = 3.
Midpoint sum of f(x) = x³ on [0, 2] with n = 4.
Midpoint sum of f(x) = cos x on [0, π/2] with n = 3.
Midpoint sum of f(x) = x⁴ on [0, 1] with n = 5.
Smallest n that guarantees an error of at most 0.0001 for ∫₀¹ eˣ dx with the midpoint rule.
Midpoint sum of f(x) = 1/(1 + x²) on [0, 1] with n = 4. Multiply by 4 to estimate π.
Discover 67 free sum calculators across different categories. Find the right calculator for your needs.
Try a different name or choose another category.
A midpoint sum calculator is an online tool that estimates a definite integral with the midpoint rule. It evaluates f at the center of each of n subintervals, multiplies the sum by Δx, and reports the error, the error bound and a graph.
Mₙ = Δx[f(m₁) + f(m₂) + ⋯ + f(mₙ)], where Δx = (b − a) / n and mᵢ = a + (i − ½)Δx is the center of the i-th subinterval.
Yes, for most smooth functions the midpoint error is about half the trapezoidal error, and the error bound (b − a)³K / 24n² is half of (b − a)³K / 12n².
The midpoint rule underestimates a concave-up function and overestimates a concave-down function. It is exact for linear functions.
|E_M| ≤ (b − a)³K / (24n²), where K is the maximum of |f″(x)| on [a, b]. For x² on [0, 2] with n = 4, the bound is 16 / 384 ≈ 0.0417.
Use n ≥ √((b − a)³K / 24ε). For eˣ on [0, 1] and ε = 0.0001, n = 34.
Yes, the midpoint rule never evaluates f at a or b, so integrals such as ∫₀¹ 1/√x dx can be estimated, though the error bound does not apply there.
Simpson's rule with 2n subintervals equals (2Mₙ + Tₙ) / 3, a weighted average of the midpoint and trapezoidal sums with n subintervals.
A midpoint sum samples f at the center of each subinterval, and the midpoint sum calculator returns Mn, its error, the (b − a)³K / 24n² bound and the n for any target error. Expect an underestimate on concave-up curves, about half the trapezoidal error, and Simpson's accuracy from (2Mn + Tn) / 3.
Not sure the midpoint rule fits your problem? Answer the questions below.