Most definite integrals have no elementary antiderivative, and even when one exists it may be easier to approximate the integral directly. The previous unit introduced the midpoint and trapezoid rules and their error bounds, both of which replace the integrand on each subinterval by a polynomial of degree at most one. This unit raises the degree to two. The resulting Simpson's rule is exact for all cubic polynomials, and its error decreases like rather than . We use the definition of the definite integral and its linearity, and the trapezoid rule.
Definition of the composite rule
Definition 5.11.1
(Simpson's rule)
Let be continuous on , let be a positive even integer, and put and for . Write . Simpson's rule with subintervals is
The weights are : the two end values have weight , the odd-indexed values weight , and the interior even-indexed values weight . The number of subintervals must be even because the rule works on consecutive pairs of subintervals , and each pair has the midpoint as its middle node.
Why the rule is natural: exactness for cubics
Lemma 5.11.2
(Exactness on a symmetric pair)
For every polynomial of degree at most and every ,
Proof
(Check four monomials)
Both sides are linear in , so it suffices to check . For : the left side is and the right side is . For : the left side is (odd integrand) and the right side is . For : the left side is , the right side is . For : the left side is and the right side is .
Proof X-ray
Why three weights are forced and a fourth power comes free
The lemma checks four monomials, but they do different jobs. The constants, and determine the rule. If the weights at are , then gives , gives , and gives . Hence and : the weights are forced, not chosen. The non-obvious fact is that costs nothing: it is odd, and the nodes are symmetric about the center, so both sides of the identity vanish. Linearity then extends the identity from the four monomials to every polynomial of degree at most three. The argument cannot be pushed further, because is even and breaks the identity.
By translation , the same identity holds on every pair :
For a general , Simpson's rule replaces on each pair by the unique quadratic through the three points , , and integrates it exactly by the lemma. Adding the pair contributions, the shared nodes receive times , and this produces the weights above.
Theorem 5.11.3
(Exactness for cubics)
If is a polynomial of degree at most , then for every even .
Proof
(Add the pair identities)
This follows by applying the lemma on each pair of subintervals and adding.
Counterexample mode
Exactness stops at degree three
Claim: because is exact for cubics, it is exact for every polynomial of low degree, in particular for quartics. Test the lemma's identity on with . The left side is . The right side is . These differ by , so the rule is not exact for . This agrees with the error bound, which involves and gives on this pair. The repair is to state exactness only for degree at most .
Relation with the trapezoid rule
Write for the trapezoid rule with subintervals.
Theorem 5.11.4
(Simpson's rule from two trapezoid rules)
For every even , .
Proof
(Compare one pair in both grids)
Consider one pair of subintervals of width in the grid for , with node values . Its trapezoid contribution is (the middle value is counted twice because it belongs to both subintervals). In the grid for this pair is a single subinterval of width , contributing . Then
which is the Simpson contribution of the pair. Summing over pairs proves the claim.
Thus Simpson's rule is a weighted average of two trapezoid approximations that is designed to cancel the leading error term.
The error bound
Theorem 5.11.5
(Simpson error bound)
Suppose has a continuous fourth derivative on and for all . Then for every even ,
The proof uses an error formula for quadratic interpolation and is not given here. Two features should be noted. First, the bound involves , not , which is why the rule is exact for cubics. Second, halving divides the bound by , whereas for the trapezoid and midpoint rules it divides the bound by .
Worked examples
Worked example 5.11.6
(An integral with known value)
Approximate with , so . The values are
Then
The error is about . For comparison, the trapezoid rule with the same nodes gives , with error about . The relation between the two rules can be checked: and .
Worked example 5.11.7
(Exactness for a cubic)
Let on , with and . The exact value is . The nodes give , , , so , agreeing with the exact value as exactness for cubics predicts.
Worked example 5.11.8
(Choosing the number of subintervals in advance)
Find an even for which approximates with error at most .
Here on , so we can take and . The error bound gives error . We require , that is , so and . The smallest even is . Check: with the bound is , while gives , which is not enough to guarantee the target. The bound is a guarantee, not an estimate of the actual error; the actual error is smaller.
Common mistakes and subtle points
Common mistake
(Odd number of subintervals, or counting nodes)
Simpson's rule requires an even number of subintervals. With an odd number there is a leftover subinterval and the weight pattern breaks. There are nodes .
Common mistake
(Wrong weights or prefactor)
The prefactor is , not or , and the weights alternate starting with at . A quick check is that the weights sum to , so that gives .
Common mistake
(Bounding with the second derivative)
The error bound of Simpson's rule needs a bound for . If is unbounded near an endpoint (for example on ), the error bound does not apply, and convergence is slower.
Simpson's rule is better for smooth integrands. For an integrand with a corner or discontinuity, its advantage disappears.
Exercises
Quick check
(Compute for , find the actual error, and compare with the error bound.)
Solution · Answer
Here and , , , so . The exact value is , so the error is . The fourth derivative of is the constant , so and the bound is . The bound is attained exactly, which shows that the constant cannot be improved.
Quick check
(Compute for and explain the result.)
Solution · Answer
With the nodes are and the values . Then , which equals . This is expected from exactness for cubics, since has degree at most .
Quick check
(Find an even guaranteeing .)
Solution · Answer
For we have , which is at most on , so . We need , that is , so and . The smallest even integer is . As a check, gives , which is just above the tolerance.
Quick check
(Compute for and its error.)
Solution · Answer
With the nodes are and . Then . The exact value is , so the error is . The bound is , consistent with the actual error.