## Appendix

### A comparison of area estimates, and Simpson's rule

We have mentioned several different ways of estimating the area under a curve: left-endpoint, right-endpoint, midpoint and trapezoidal estimates. It's interesting to compare them.

Recall that we consider the function $$f(x)$$ over the interval $$[a,b]$$ and divide the interval into $$n$$ subintervals $$[x_0, x_1], [x_1, x_2], \dots, [x_{n-1}, x_n]$$ each of width $$\Delta x = \frac{1}{n} (b-a)$$.

All of the estimates discussed give the approximate area under $$y=f(x)$$ in the form of a sum of products of values of $$f$$ with the width $$\Delta x$$. In fact, the left-endpoint, right-endpoint and trapezoidal estimates are all of the form

$\big[ c_0 f(x_0) + c_1 f(x_1) + c_2 f(x_2) + \dots + c_{n-1} f(x_{n-1}) + c_n f(x_n) \big] \, \Delta x.$

(The midpoint rule is slightly different, since it evaluates the function $$f$$ at the midpoints of subintervals.) The coefficients $$c_j$$ are compared in the following table.

The coefficients in the formulas for area estimates
Estimate $$c_0$$ $$c_1$$ $$c_2$$ $$c_3$$ $$c_4$$ $$\dots$$ $$c_{n-2}$$ $$c_{n-1}$$ $$c_n$$
left endpoint 1 1 1 1 1 $$\dots$$ 1 1 0
right endpoint 0 1 1 1 1 $$\dots$$ 1 1 1
trapezoidal $$\frac{1}{2}$$ 1 1 1 1 $$\dots$$ 1 1 $$\frac{1}{2}$$
Simpson $$\frac{1}{3}$$ $$\frac{4}{3}$$ $$\frac{2}{3}$$ $$\frac{4}{3}$$ $$\frac{2}{3}$$ $$\dots$$ $$\frac{2}{3}$$ $$\frac{4}{3}$$ $$\frac{1}{3}$$

There is another estimate, called Simpson's rule, which takes a slightly different set of coefficients, as shown in the table. It requires that the number of subintervals $$n$$ is even. The coefficients start at $$\frac{1}{3}$$, then alternate between $$\frac{4}{3}$$ and $$\frac{2}{3}$$, before ending again at $$\frac{1}{3}$$. (It is as if every second coefficient in the list for the trapezoidal estimate donated $$\frac{1}{6}$$ to its~neighbours.)

Explicitly, the estimate from Simpson's rule for the area under $$y=f(x)$$ between $$x=a$$ and $$x=b$$ is

$\Big[ \frac{1}{3} f(x_0) + \frac{4}{3} f(x_1) + \frac{2}{3} f(x_2) + \frac{4}{3} f(x_3) + \frac{2}{3} f(x_4) + \dots + \frac{2}{3} f(x_{n-2}) + \frac{4}{3} f(x_{n-1}) + \frac{1}{3} f(x_n) \Big] \Delta x.$

Although the coefficients may appear somewhat bizarre, Simpson's rule almost always gives a much more accurate answer than any of the other estimates mentioned. We'll see why in the next section.

Next page - Appendix - Exactness of area estimates