= Midpoint quadrature rule
{title2=$M(f)=(b-a)f((a+b)/2)$}
The <midpoint quadrature rule> replaces the <integrand> on $[a,b]$, $a<b$, by its value halfway across the interval:
$$
I(f)=\int_a^bf(x)\,dx\approx M(f)=(b-a)f\left(\frac{a+b}{2}\right).
$$
Geometrically, $M(f)$ is the signed area of a <rectangle> with width $b-a$ and height $f((a+b)/2)$. Its single <quadrature node> is $(a+b)/2$ and its <quadrature weight> is $b-a$. Sampling in the interior is useful when endpoint evaluation is inconvenient, although an endpoint singularity can invalidate the <quadrature error> estimates below.
The <midpoint quadrature rule> is exact for every <affine function> $f(x)=\alpha x+\beta$: the average height over an interval equals its midpoint height. For example, on $[0,2]$, $f(x)=2x+1$ gives $I(f)=6$ and $M(f)=2f(1)=6$. Positive and negative area discrepancies cancel for a sloping straight line. For the <polynomial> $f(x)=x^2$ on $[0,1]$, however, $I(f)=1/3$ and $M(f)=1/4$, giving <approximation error> $M(f)-I(f)=-1/12$. Thus its <degree of precision of a quadrature rule> is exactly one.<Calculus by Gilbert Strang/5.8 Numerical Integration>[§5.8, printed p. 223: midpoint rectangles, linear exactness and signed quadratic errors]{ref}
\Image[/midpoint-trapezoidal-quadratic-areas.png]
{title=Midpoint rectangles and trapezoids approximate the area under a quadratic}
For the <polynomial> $f(x)=x^2$ on $[0,1]$, four panels give <composite midpoint quadrature rule> value $21/64$ and <composite trapezoidal rule> value $11/32$, bracketing the exact <integral> $1/3$. Individual midpoint rectangles can cross the curve; it is their total signed area that underestimates the <integral>.
For $f\in C^2[a,b]$, meaning that its first two <derivatives> exist and are <continuous functions> on the closed interval, the signed <approximation error> has the form
$$
M(f)-I(f)=-\frac{(b-a)^3}{24}f''(\xi_M),\qquad a<\xi_M<b.
$$
Hence a <convex function> with $f''\geq0$ is underestimated, and a <concave function> with $f''\leq0$ is overestimated. A short justification uses the <Taylor formula with integral remainder>: writing $m=(a+b)/2$, it gives $I(f)-M(f)=\int_a^b k(t)f''(t)\,dt$, where $k(t)=(t-a)^2/2$ for $a\leq t\leq m$ and $k(t)=(b-t)^2/2$ for $m\leq t\leq b$. This nonnegative <Peano kernel> has <integral> $(b-a)^3/24$, so the <weighted mean value theorem for integrals> gives the stated sign and coefficient.
Back to article page