The midpoint rule is a method of numerical integration that approximates a definite integral by evaluating the integrand at the midpoint of an interval and multiplying by the interval’s width. Its composite form divides the integration interval into smaller subintervals and adds their midpoint approximations. For sufficiently smooth functions, the composite rule has second-order accuracy: halving the subinterval width reduces the leading error by a factor of four. The name is also used for related methods for solving differential equations, which are distinct from quadrature.
Definition
For a real-valued function on an interval , with , the single-interval midpoint rule is
Geometrically, it replaces the area under the graph by the signed area of a rectangle. The rectangle has width and height equal to the function value at the interval’s midpoint. Values below the horizontal axis contribute negative signed area.
For the composite midpoint rule, partition the interval into equal parts of width
Their midpoints are
The approximation is then
This is a Riemann sum with midpoint sample points. If is Riemann integrable, converges to its integral as . This convergence does not, by itself, imply the second-order error rate available for smooth functions.
Unequal subintervals
Equal spacing is not essential. Given a partition
write
The nonuniform composite rule is
Unequal widths allow finer resolution where the integrand changes rapidly and coarser resolution where it is smoother.
Exactness and the role of symmetry
The midpoint rule integrates every polynomial of degree at most one exactly. For
the average value of over an interval equals its value at the midpoint. The rule’s degree of precision is therefore one: it is exact for all constant and linear polynomials, but not for all quadratic polynomials.
Its improved accuracy over left- or right-endpoint rectangle rules comes from symmetry. Let
A Taylor expansion about gives
Integration over the symmetric interval eliminates odd powers of . Consequently, for a sufficiently smooth function,
The cancellation of the first-derivative term explains why midpoint sampling is more accurate than one-sided endpoint sampling at the same subinterval width. Here uses big-O notation to describe the size of the omitted terms.
Error bounds and convergence order
Define the error as the exact integral minus the approximation:
If the second derivative is continuous on , then for some ,
Thus, if
then
The error on a single subinterval is . Summing over equal subintervals produces a total error of , making the composite rule a second-order method.
For a nonuniform partition, the corresponding bound is
Direction of the error
For a convex function, the midpoint value is no greater than the average value over the interval. The midpoint rule therefore underestimates the integral. For a concave function, it overestimates it.
If changes sign, errors from different subintervals can cancel. The resulting approximation may be much more accurate than the general error bound suggests.
For sufficiently smooth , the leading composite error can also be written as
If , the leading second-order term vanishes, allowing faster convergence.
Example
Consider
With one interval,
With two equal subintervals,
The errors are
Doubling the number of subintervals reduces the error by exactly a factor of four. More generally, since ,
Relationship to other quadrature rules
Endpoint rectangle rules
Left- and right-endpoint rules use one endpoint rather than the midpoint of each subinterval. For general smooth functions, their composite errors are first order, . The midpoint rule uses the same number of function evaluations but ordinarily achieves second-order accuracy.
Trapezoidal rule
The trapezoidal rule approximates the integrand by straight lines joining endpoint values. On a uniform grid,
It is also second order. With the same subinterval width and sufficient smoothness, its leading error is
Thus its leading error is opposite in sign and twice as large as that of the midpoint rule when the displayed derivative difference is nonzero. This is an asymptotic comparison, not a universal ranking for arbitrary functions or grids.
Simpson’s rule
Combining endpoint and midpoint information gives Simpson’s rule:
If and denote the single-interval midpoint and trapezoidal approximations, this expression is
The combination cancels their leading error terms. Simpson’s rule is exact for polynomials of degree at most three and has fourth-order composite accuracy under suitable smoothness assumptions.
Gaussian quadrature
The midpoint rule is the one-node Gauss–Legendre rule, a special case of Gaussian quadrature. On , it reads
It is the unique one-node quadrature rule on this interval that integrates every linear polynomial exactly.
Error estimation and implementation
A basic implementation evaluates the function at midpoints and accumulates the weighted sum. It requires function evaluations and constant additional storage.
When the leading error behaves as , comparing two resolutions gives the practical estimate
The extrapolated value
cancels the leading second-order error and is fourth-order accurate when the required smooth error expansion holds.
Such estimates are not guaranteed bounds without additional assumptions. A narrow peak or unresolved oscillation may be missed by both grids, making their agreement misleading. Also, ordinary midpoint grids with and subintervals are not nested: the old midpoints are not sample points on the refined grid.
In floating-point arithmetic, rounding errors can eventually limit the benefit of refinement. Summing many values, especially values with substantial cancellation, introduces errors separate from the quadrature error.
Applications and limitations
The midpoint rule is useful when integrand evaluations are inexpensive, moderate accuracy is sufficient, or sampled values naturally represent cell centers. It appears in finite volume methods, where a cell integral may be approximated by the cell’s volume multiplied by a representative midpoint value.
It does not sample interval endpoints. This can be convenient when an endpoint value is undefined, but it does not remove the effects of a singularity: the usual second-order error bound may fail if derivatives become unbounded near an endpoint.
Other limitations include:
- Limited smoothness. Discontinuities, corners, or unbounded derivatives can reduce the convergence rate.
- Unresolved structure. Narrow peaks and rapid oscillations may require specialized grids or methods.
- Fixed sample locations. Existing data cannot generally be used directly unless their locations match the needed midpoints; interpolation introduces additional error.
- High-dimensional cost. A product midpoint rule using points in each of coordinates requires evaluations, illustrating the curse of dimensionality.
Midpoint methods for differential equations
In the numerical solution of an ordinary differential equation
“midpoint method” commonly refers to either an explicit or an implicit second-order time-stepping method.
The explicit midpoint method, a Runge–Kutta method, first estimates the state halfway through a step:
then advances using
The implicit midpoint method instead satisfies
It generally requires solving an equation for . Although both methods use midpoint evaluations, their stability properties differ substantially. When depends only on , both reduce to applying midpoint quadrature to the integral over a time step.