Simpson's Rule

We shall now apply our approximation theorem to the computation of definite integrals. This time we shall use a polynomial of third degree to approximate the function we are to integrate. But first let us prove a result about integrals of polynomials:

Theorem 1

Let f ( x ) be a polynomial of degree 5 . Let m be the midpoint of the interval a x b ( m = 1 2 ( a + b ) ). Then

a b f ( x ) d x = b a 6 ( f ( a ) + 4 f ( m ) + f ( b ) ) ( b a ) 5 2880 f ( i v ) ( m )

PROOF. Observe first of all that the assertion is linear in f . i.e., if it is true for f ( x ) and for g ( x ) , then it is true for f ( x ) + g ( x ) and for c f ( x ) , where c is a constant. Therefore it will be true for all polynomials of degree 5 , if we can show it is true for 1 , x , x 2 , x 3 , x 4 , x 5 , or if we can show it for 1 , ( x m ) , ( x m ) 2 , ( x m ) 3 , ( x m ) 4 , ( x m ) 5 . For

\begin{aligned} x^n &= ((x-m)+m)^n \\ &= (x-m)^n + n(x-m)^{n-1}m + \dots + n(x-m)m^{n-1} + m^n \end{aligned}

is a polynomial of degree n in ( x m ) for any n ; thus any polynomial in x of degree 5 is also a polynomial of degree 5 in ( x m ) .

First let f ( x ) = ( x m ) i , where i is odd: i = 1 , 3 , 5 . Then

\begin{aligned} \int_a^b (x-m)^i \, dx &= \left. \frac{1}{i+1} (x-m)^{i+1} \right|_a^b \\ &= \frac{1}{i+1} \left( (b-m)^{i+1} - (a-m)^{i+1} \right)\\ &= \frac{1}{i+1} \left( \left( \frac{b-a}{2} \right)^{i+1} - \left( \frac{a-b}{2} \right)^{i+1} \right) \cdot \end{aligned}

But i + 1 is even, so

( b a 2 ) i + 1 = ( a b 2 ) i + 1 ,

and

a b ( x m ) i d x = 0

On the right side, we have

b a 6 ( ( a m ) i + 4 ( m m ) i + ( b m ) i ) ( b a ) 5 2880 f ( i v ) ( m )

If i = 1 or 3 , the fourth derivative of ( x m ) i is 0 . If i = 5 , the fourth derivative is 5 ! ( x m ) , and f ( i v ) ( m ) = 0 . Thus the right side reduces to

b a 6 ( ( a m ) i + ( b m ) i ) = b a 6 ( ( a b 2 ) i + ( b a 2 ) i )

Since i is odd,

( a b 2 ) i = ( b a 2 ) i ,

and the right-hand side is 0 . So in this case, both sides of the equation are 0 , and we are done. It remains to treat f ( x ) = 1 , ( x m ) 2 and ( x m ) 4 .

In the first two cases, f ( i v ) ( x ) = 0 for all x , so we may omit the last term on the right. For f ( x ) = 1 ,

a b 1 d x = b a ,

while

b a 6 ( f ( a ) + 4 f ( m ) + f ( b ) ) = b a 6 6 = b a ,

Thus the assertion is true for f ( x ) = 1 . For f ( x ) = ( x m ) 2 :

\begin{aligned} \int_a^b (x-m)^2 \, dx &= \left. \frac{1}{3} (x-m)^3 \right|_a^b \\ &= \frac{1}{3} \left( \left( \frac{b-a}{2} \right)^3 - \left( \frac{a-b}{2} \right)^3 \right)\\ &= \frac{1}{3} \left( \left( \frac{b-a}{2} \right)^3 + \left( \frac{b-a}{2} \right)^3 \right) \\ &= \frac{(b-a)^3}{12} \cdot \end{aligned}

Meanwhile,

\begin{aligned} \frac{b-a}{6} (f(a) + 4f(m) + f(b)) &= \frac{b-a}{6} \left( (a-m)^2 + (b-m)^2 \right)\\ &= \frac{b-a}{6} \left( \left( \frac{a-b}{2} \right)^2 + \left( \frac{b-a}{2} \right)^2 \right) \\ &= \frac{(b-a)^3}{12} \\ &= \int_a^b f(x) \, dx \cdot \end{aligned}

Finally, let f ( x ) = ( x m ) 4 . Then f ( i v ) ( x ) = 24 for all x .

a b f ( x ) d x = 1 5 ( ( b a 2 ) 5 ( a b 2 ) 5 ) = 1 80 ( b a ) 5

On the other hand,

\begin{aligned} \frac{b-a}{6} (f(a) &+ 4f(m) + f(b)) - \frac{(b-a)^5}{2880} f^{\rm (iv)}(m)\\ &= \frac{b-a}{6} \left( \left( \frac{a-b}{2} \right)^4 + \left( \frac{b-a}{2} \right)^4 \right) - \frac{(b-a)^5}{2880} \cdot 24\\ &= \frac{(b-a)^5}{48} - \frac{(b-a)^5}{120} \\ &= \frac{(b-a)^5}{80} \\ &= \int_a^b f(x) \, dx \cdot \end{aligned}

Thus the assertion is true for all ( x m ) i , i 5 , and therefore for all polynomials of degree 5 .

Now suppose we are given a function f ( x ) having four derivatives, and suppose we have found a polynomial P ( x ) of degree 3 such that: P ( a ) = f ( a ) , P ( b ) = f ( b ) , P ( m ) = f ( m ) , P'(m) = f'(m). (We shall show later how P ( x ) can be constructed. Then f ( x ) P ( x ) has at x = a and at x = b a zero of multiplicity at least one, and at x = m a zero of multiplicity at least 2 . Therefore we take the n of the approximation theorem to be 4 , and H ( x ) = ( x a ) ( x m ) 2 ( x b ) . Then

f ( x ) P ( x ) = H ( x ) 4 ! ( f ( i v ) ( ξ ) P ( i v ) ( ξ ) ) , a < ξ < b

But P ( i v ) ( x ) = 0 , since P ( x ) is of degree 3 . Now H ( x ) 0 whenever a x b , and if Max. denotes the maximum of f ( i v ) ( x ) for a x b , Min. its minimum, we have

\frac{H(x)}{24} \cdot \text{Max.} \le f(x) - P(x) \le \frac{H(x)}{24} \cdot \text{Min.} \tag{**}

Since H ( x ) is a polynomial of degree 5 , and since H ( a ) = H ( b ) = H ( m ) = 0 , we see by our theorem that

a b H ( x ) d x = ( b a ) 5 2880 H ( i v ) ( m ) = ( b a ) 5 2880 24.

Taking the integrals in the inequality (**), we have

( b a ) 5 2880 Max. a b f ( x ) d x a b P ( x ) d x ( b a ) 5 2880 Min.

If we assume, as we already have in discussing its maximum and minimum, that f ( i v ) is continuous for a x b , then by the theorem we quoted in Chapter 12,

a b f ( x ) d x a b P ( x ) d x = ( b a ) 5 2880 f ( i v ) ( ξ )

for some ξ , a ξ b . Now since P ( i v ) ( x ) = 0 , we know by our theorem that

\begin{aligned} \int_a^b P(x) \, dx &= \frac{b-a}{6} (P(a) + 4P(m) + P(b)) \\ &= \frac{b-a}{6} (f(a) + 4f(m) + f(b)). \end{aligned}

Finally, we have Simpson's rule:

\int_{a}^{b} f(x) \, dx = \frac{b-a}{6} (f(a) + 4f(m) + f(b)) - \frac{(b-a)^5}{2880} f^{\rm (iv)}(\xi) \tag{*}

for some ξ , a ξ b .

The way in which this rule is used is by using the first term on the right as an approximation to

a b f ( x ) d x .

The second term gives an estimate of the error introduced by making this approximation. The error is at most

( b a ) 5 2880 | Max . | or ( b a ) 5 2880 | Min . | ,

whichever is larger.

Finally, we must show that a polynomial P ( x ) can always be found satisfying our requirements. Let Q = ( a , f ( a ) ) , R = ( b , f ( b ) ) , S = ( m , f ( m ) ) . Then we can find a straight line y = A x + B through Q and R (here A and B are simply numbers). Set

g ( x ) = A x + B + C ( x a ) ( x b ) ,

where C is so chosen that g ( m ) = f ( m ) . This is always possible because ( m a ) ( m b ) 0 . We still have g ( a ) = f ( a ) , g ( b ) = f ( b ) . Now set

P ( x ) = g ( x ) + D ( x a ) ( x b ) ( x m ) .

Then

P'(m) = g'(m) + D(m-a)(m-b).

Since ( m a ) ( m b ) 0 , we can choose the constant D so that P'(m) = f'(m). Then P ( a ) = g ( a ) = f ( a ) , P ( b ) = g ( b ) = f ( b ) , P ( m ) = g ( m ) = f ( m ) and P'(m) = f'(m); moreover, P ( x ) is of degree 3 . Therefore P ( x ) is our required polynomial. (Note that in applying Simpson's rule, one need not compute anything about P ( x ) .)

EXERCISES

Exercise 1. 1) Use Simpson's rule to compute 0 1 d x 1 + x 2 ; compare with the result you get by direct integration.
Exercise 2.
  1. Compute 1 1 e x 2 d x : a) for a = 1 , b = 1 ;
    b) by using the fact that it is 2 0 1 e x 2 d x and using a = 0 , b = 1 . Compare your estimates of error in each case.
Exercise 3.
  1. Use Simpson's rule to approximate, with error, 1 / 2 1 / 2 d x 1 x 4

No direct means is known of finding indefinite integrals in Exercises 2 and 3; therefore approximate methods assume great importance in these cases. The integral in Exercise 2 is called the error integral, and in Exercise 3 is an elliptic integral.