Integration by trapezoid and Simpson's rule
- CSIR NET · advanced
- UP Assistant Professor
4 minute read · Updated 2026-11-15
Picking up from
In Roots of functions, interpolation, extrapolation, we saw that interpolation replaces unknown behavior by simple functions through data points. Can the same local approximation estimate an accumulated area?
In one line
Numerical quadrature estimates an integral by replacing the integrand with simple shapes through sampled values.
The idea, explained
An integral measures accumulated area, but its integrand may be known only at sampled points or lack a useful antiderivative. The trapezoidal rule joins neighboring samples by straight lines. Simpson’s rule uses parabolas through pairs of equal-width subintervals. Smoothness and spacing control accuracy; smaller spacing usually improves the result when the derivatives remain well behaved. Exactness for a polynomial is a property of the rule, not evidence that every curved function is integrated exactly. Check endpoint weights and the number of subintervals before substituting values.
The weights express how often a sampled point contributes to neighboring pieces. In the trapezoidal rule, interior samples belong to two adjacent trapezoids, while endpoints belong to only one. Simpson’s alternating weights arise from integrating a quadratic interpolant over pairs of subintervals. Error-order statements describe how the leading error changes as a uniform grid is refined on a fixed interval. They assume enough smooth derivatives; a singularity, discontinuity or unresolved sharp feature can spoil the expected scaling even when all arithmetic weights are correct.
Core ideas
- Composite rules combine local estimates over a uniform grid with a fixed spacing.
- The trapezoidal rule is exact for a linear polynomial but usually not for a quadratic.
- Composite Simpson’s one-third rule requires an even number of equal subintervals.
- Simpson’s rule is exact through cubic polynomials despite being constructed from quadratic pieces.
- For sufficiently smooth functions on a fixed interval, global trapezoid and Simpson errors scale as spacing squared and fourth power, respectively.
- Distinguish the number of sample points from the number of subintervals. With both endpoints included, there is one more point than subintervals, which matters when checking Simpson’s even-subinterval condition.
- Halving the spacing reduces the leading smooth-function trapezoidal error by about four and Simpson error by about sixteen. This compares errors, not the integral values themselves.
Key formulas
Composite trapezoidal rule
and ; endpoint weights are half those of interior samples.
Composite Simpson’s one-third rule
For even n on a uniform grid, Simpson weights alternate four and two between endpoints.
List the grid, calculate the spacing, and mark the weights before summing function values. Keep the common prefactor outside the weighted sum. If two grid refinements give very different results, inspect smoothness and sampling before trusting the nominal error order. For a polynomial test, compare with an exact antiderivative to check the implementation of the weights.
Quick worked example
Integrate on with samples at . Simpson gives . The trapezoid estimate is , showing that equal sampling does not make the rules equivalent.
Where this leads
Continue to Runge-Kutta for first-order ODEs, because time evolution can likewise be advanced by sampling slopes within each step.
Related: Roots of functions, interpolation, extrapolation — local interpolation through sampled data.
Practice this topic
Practice this topic13 questions in Assistant Professor · Physics · Physics. Sign in and practice access may be required.