278 Integrals
course, we should try to minimize errors by choosing the heights of the
rectangles in such a way that, in each strip, the area of the set which lies
in the region but outside the rectangle is nearly equal to the area of the
set which lies inside the rectangle but outside the region.
This paragraph introduces the trapezoidal formula
fb[o
(4.94) .f (x) dx = e -f - h + Yn-I +
the derivation of which will help us to understand the much better
formula (4.95) which will appear in the next paragraph. We sepa-
rate the interval a < x < b into n equal subintervals of length h, where
h = (b - a)/n, by points xo, x1,. , xsuch that xo = a, xn. = b, and
xk = xk-1 + h for each k = 1, 2, ,n. As in Figure 4.943, where
n = 4, we let Yk = f(xk) for each k. As an approximation to f x'f(x) dxxo
we use L' L(x) dx, where L(x) = Ax + B and the constants are chosen
such that the graph of L(x) = Ax + B is a line passing through the two
points Po(xo,yo) and Pi(xl,yl). The details of the calculation
(4.941) dx = `o+ ' yo (x- xo) dx = h Yo 2 '
fox,
fZIL()
L
are easily supplied; in case yo and yl are positive, the details are super-
fluous because the quantities are equal to the area of a trapezoid and ele-
mentary geometry shows that the formula is correct. Using (4.941) and
analogous formulas, we see that
(4.942) fxkf (x) dx = ek + hYk-12 Yk,
xkl
where the "error term" Ek will be "relatively small" if the graph of f over
the interval xk_1 < x < xk
is "near" the chord joining
P Pk_1 and Pk. Summing
the members of (4.942)
Y4 h 'd if
a=xo x1
Figure 4.943
x2 x3 x4 = b
glues L. e trapezol a or-
mula (4.94).
_ To derive the trape-
x zoidal formula (4.94), we
began by approximating
f(x) over the interval
xo S x 5 x1 by the function L(x) whose graph is a line passing through
the two points Po and P1. To derive the more useful Simpson formula
b
(4.95)= e+[yo+4y1+2y2+4ya+2y4+ff(x)
+ 4yn-1 + yn],