Numerical integration is a standard topic in first-semester calculus. From time to time, I have received questions from students on various aspects of this topic, including:
- Why is numerical integration necessary in the first place?
- Where do these formulas come from (especially Simpson’s Rule)?
- How can I do all of these formulas quickly?
- Is there a reason why the Midpoint Rule is better than the Trapezoid Rule?
- Is there a reason why both the Midpoint Rule and the Trapezoid Rule converge quadratically?
- Is there a reason why Simpson’s Rule converges like the fourth power of the number of subintervals?
In this series, I hope to answer these questions. While these are standard questions in a introductory college course in numerical analysis, and full and rigorous proofs can be found on Wikipedia and Mathworld, I will approach these questions from the point of view of a bright student who is currently enrolled in calculus and hasn’t yet taken real analysis or numerical analysis.
In the previous post in this series, I discussed three different ways of numerically approximating the definite integral , the area under a curve between and .
In this series, we’ll choose equal-sized subintervals of the interval . If is the width of each subinterval so that , then the integral may be approximated as
using left endpoints,
using right endpoints, and
using the midpoints of the subintervals. We have also derived the Trapezoid Rule:
This last approximation was obtained by connecting adjacent points on the curve by line segments, creating trapezoids:
In this post, we will derive Simpson’s Rule. Instead of connecting two adjacent points with line segments, we will connect three adjacent points with a parabola. In the picture below, the points , and are connected with one parabola, while the points , and are connected with a different second parabola.
Clearly, for this to work, there has to be an even number of subintervals. (By contrast, for the Trapezoid Rule, the Midpoint Rule, or the endpoint rules, the number of subintervals could be even or odd.)
The derivation of Simpson’s Rule is more complicated than the derivation of the Trapezoid Rule because we need to use calculus to find the area under these parabolas. To begin, we make the simplifying assumption that . Since each subinterval has width , this means that and .
While most 3×3 systems are cumbersome to solve, this system is straightforward. Clearly, . Also, subtracting the first equation from the third equation yields
Finally, we solve for by substituting into the third equation:
Next, we find the integral of between and :
We now turn to the more general case of finding the area under the parabola passing through , , and , where and . Geometrically, it should be clear that this parabola can be obtained from the above parabola by a horizontal translation. Since the area under the curve is not changed by a horizontal translation, the area (and the formula) will be the same.
More formally, if passes through the points , , and , then will pass through the points , , and . The area under this curve is
After using the substitution , this becomes
which is the same integral that we saw earlier. Therefore,
Finally, we need to find the sum of the areas under all of these parabolas. Similarly, the area under the parabola passing through , , and will be . So, for the particular example shown above, the total area under the parabolas will be
The coefficients of 4 arose from the above integrals, while the coefficient of 2 came from combining the two areas. In general, if there are subintervals and is even, then Simpson’s Rule gives the approximation