Midpoint Rule Calculator

Sample each slice at its centre. Enter f(x), [a, b] and n to get Mₙ with every rectangle drawn, the midpoint table and the error compared with the exact integral.

Reads as x2x^{2}
Try:

Midpoint sum with n = 6

8.9375

Exact ∫03x2 dx=9\int_{0}^{3} x^{2}\,dx = 9 · error -0.0625

0.511.522.5324681012

The formula

M6=∑i=16f ⁣(xi−1+xi2)Δx,Δx=3−06=0.5M_{6} = \sum_{i=1}^{6} f\!\left(\tfrac{x_{i-1}+x_i}{2}\right)\Delta x,\quad \Delta x = \frac{3 - 0}{6} = 0.5
Each slice
iisample xxheightarea
00.250.06250.03125
10.750.56250.28125
21.251.56250.78125
31.753.06251.53125
42.255.06252.53125
52.757.56253.78125

All five methods, n = 6

MethodEstimateError
Left6.875-2.13
Right11.3752.38
Midpoint8.9375-0.0625
Trapezoid9.1250.125
Simpson90

Still stuck? Ask the tutor

An AI tutor reads the problem and steps above and explains them in plain words. It can make mistakes, so check it against the worked steps.

The midpoint rule formula

Mn=Δx[f(m1)+f(m2)+⋯+f(mn)],mi=xi−1+xi2M_n = \Delta x\left[f(m_1) + f(m_2) + \cdots + f(m_n)\right],\quad m_i = \frac{x_{i-1} + x_i}{2}

The midpoint rule is a Riemann sum whose sample point is the centre of each slice. On a slope, the bit of rectangle that sticks out above the curve on one side nearly cancels the gap on the other, which is why it beats left and right sums.

Error bound: if ∣f′′(x)∣≤K|f''(x)| \le K on [a,b][a,b], then ∣EM∣≤K(b−a)324n2|E_M| \le \frac{K(b-a)^3}{24n^2}, half the trapezoidal bound.

For a concave-up function the midpoint rule underestimates; for concave-down it overestimates (the opposite of the trapezoidal rule).

Compare all five methods side by side on the Riemann sum calculator, or try another single rule: Trapezoidal rule, Simpson’s rule, Left Riemann sum, Right Riemann sum.

Questions students ask

How do you do the midpoint rule?

Find Δx=b−an\Delta x = \frac{b-a}{n}, list the midpoints mi=a+(i−12)Δxm_i = a + (i - \tfrac12)\Delta x, evaluate ff at each, add them and multiply by Δx\Delta x.

What is the error bound for the midpoint rule?

∣EM∣≤K(b−a)324n2|E_M| \le \frac{K(b-a)^3}{24n^2} where KK bounds ∣f′′∣|f''| on [a,b][a,b].

Is the midpoint rule an over- or underestimate?

An underestimate where ff is concave up and an overestimate where it is concave down.

Midpoint rule vs trapezoidal rule: which is better?

For smooth functions the midpoint rule is about twice as accurate, and it needs one fewer function evaluation.