Beginner

Midpoint Rule Calculator

Estimate the value of a definite integral by summing the areas of rectangles whose heights are taken at the midpoint of each subinterval.

Function f(x)

Curve to integrate
Number of rectangles
Integral approximation
2.6250

Midpoint rule estimate

Δx (width)
0.5
Rectangles
4
Interval
[0, 2]
Midpoint rectangle heights
Step by step
  1. 1

    Subinterval width Δx = (b − a) ÷ n

    (2 − 0) ÷ 4 = 0.5
  2. 2

    Sum of 4 midpoint heights Σf(mᵢ)

    5.25
  3. 3

    Integral ≈ Δx × Σf(mᵢ)

    0.5 × 5.25 = 2.6250
    The midpoint rule evaluates the function at the centre of each strip, balancing over- and under-estimates.
Results are estimates for general information only and are not professional advice — always verify important results independently before relying on them. Read the full disclaimer.
Quick answer

How does this calculator work?

The midpoint rule approximates a definite integral by dividing [a, b] into n equal strips of width Δx = (b − a)/n, evaluating the function at each strip's midpoint, and summing those heights times Δx. It is exact for linear functions and its error falls off like 1/n², so larger n gives sharper estimates.

Formula
∫ₐᵇ f(x) dx ≈ Δx · Σ f(a + (i + 0.5)·Δx), Δx = (b − a) / n
How this is calculated

The midpoint rule is a Riemann-sum method for numerical integration. You choose a function f(x), the lower limit a, the upper limit b, and the number of equal subintervals n. The calculator first computes the common width Δx = (b − a) / n, splitting [a, b] into n strips.

For each strip i (from 0 to n − 1) it evaluates the function at the midpoint mₚ = a + (i + 0.5)·Δx and treats f(mₚ) as the rectangle height. Multiplying each height by Δx gives a rectangle area, and adding all rectangles yields the approximation Δx · Σ f(mₚ). Using the midpoint rather than a left or right endpoint typically cancels overshoot and undershoot, so the midpoint rule is exact for linear functions and second-order accurate overall.

Limits may be given in either order, but the integral keeps the sign convention of a → b. The error shrinks roughly as 1/n² as you raise n, while functions with sharp curvature or singularities (for example 1/x crossing zero) need more subintervals or a domain that avoids the singular point. The angle-based options (sin, cos) use radians.

Frequently asked questions

Sampling at the midpoint balances the parts of the rectangle that are above and below the curve, so the midpoint rule is more accurate than the left or right Riemann sum for the same n and is exact for straight lines.

Increase the number of subintervals n. The midpoint-rule error decreases approximately in proportion to 1/n², so doubling n cuts the error by about a factor of four.

Yes. If a is greater than b the width Δx becomes negative and the approximation carries the correct sign, matching ∫ₐᵇ = −∫_bᵃ.

Also known as

midpoint riemann sum
rectangle approximation
numerical integration
midpoint approximation

APA

TG we-Calculate Editorial Team. (2026). Midpoint Rule Calculator [Online calculator]. TG we-Calculate. https://we-calculate.com/calculator/midpoint-rule-calculator

Chicago

TG we-Calculate Editorial Team. "Midpoint Rule Calculator." TG we-Calculate. 2026. https://we-calculate.com/calculator/midpoint-rule-calculator.

IEEE

TG we-Calculate Editorial Team, "Midpoint Rule Calculator," TG we-Calculate, 2026. [Online]. Available: https://we-calculate.com/calculator/midpoint-rule-calculator

BibTeX

@misc{wecalculate_midpoint_rule_calculator, title = {Midpoint Rule Calculator}, author = {{TG we-Calculate Editorial Team}}, howpublished = {\url{https://we-calculate.com/calculator/midpoint-rule-calculator}}, year = {2026}, note = {TG we-Calculate} }

Did this calculator help you?