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

and Simpson’s Rule (if is even)

.

All of the above approximations to are precisely that — approximations. That begs the obvious question: how can we get better approximations. One obvious answer is taking more subintervals. The figures below show the left-endpoint approximations using and subintervals. Geometrically, it’s clear that the orange rectangles in the second picture do a better job of approximating the area under the curve. Unfortunately, simply taking more subintervals has its limitations. Using a spreadsheet as in the previous post in this series, one can implement 100 or even 1000 subintervals without much difficult. However, as demonstrated in the video below, implementing any of these methods with 10,000 subintervals is pretty time-consuming. (Tl/dw: It can take literally a couple of minutes.)

Instead of relying on sheer computational firepower, let’s instead investigate how good these numerical methods actually are. To begin, let’s explore the left-endpoint rule applied to using different numbers of subintervals. The results are summarized in the table below. As increases, the left endpoint approximations are indeed getting closer and closer to the actual value of . Interestingly, when the width is plotted with these approximations, the data points fall almost exactly on a straight line. The same phenomenon occurs when using right endpoints: So, it appears that the errors in both the left- and right-endpoint rules are a linear function of the size of the subintervals. Said another way, if twice as many subintervals are taken, then the error appears to go down by a factor of 2. If ten times as many subintervals are used, then the error should go down by a factor of 10. As we’ll see in the next few posts, the errors for the Midpoint Rule, the Trapezoid Rule, and especially Simpson’s Rule are much better than the errors from these two methods.