2 The simple trapezium rule

The first approximation we shall look at involves finding the area under a straight line, rather than the area under a curve f . Figure 6 shows it best.

Figure 6

No alt text was set. Please request alt text from the person who provided you with this resource.

We approximate as follows

a b f ( x ) d x = grey shaded area area of the trapezium surrounding the shaded region = width of trapezium  ×  average height of the two sides = 1 2 ( b a ) f ( a ) + f ( b )
Key Point 5

Simple Trapezium Rule

The simple trapezium rule for approximating a b f ( x ) d x is given by approximating the area under the graph of f by the area of a trapezium.



The formula is:

a b f ( x ) d x 1 2 ( b a ) f ( a ) + f ( b )

Or, to put it another way that may prove helpful a little later on,

a b f ( x ) d x 1 2 × ( interval width ) × f ( left-hand end ) + f ( right-hand end )

Next we show some instances of implementing this method.

Example 10

Approximate each of these integrals using the simple trapezium rule

  1. 0 π 4 sin ( x ) d x
  2. 1 2 e x 2 2 d x
  3. 0 2 cosh ( x ) d x
Solution
  1. 0 π 4 sin ( x ) d x 1 2 ( b a ) ( sin ( a ) + sin ( b ) ) = 1 2 π 4 0 0 + 1 2 = 0.27768 ,

  2. 1 2 e x 2 2 d x 1 2 ( b a ) e a 2 2 + e b 2 2 = 1 2 1 0 e 1 2 + e 2 = 0.37093 ,

  3. 0 2 cosh ( x ) d x 1 2 ( b a ) cosh ( a ) + cosh ( b ) = 1 2 2 0 1 + cosh ( 2 ) = 4.76220 ,

    where all three answers are given to 5 decimal places.

It is important to note that, although we have given these integral approximations to 5 decimal places, this does not mean that they are accurate to that many places. We will deal with the accuracy of our approximations later in this Section. Next are some Tasks for you to try.

Task!

Approximate the following integrals using the simple trapezium method

  1. 1 5 x d x
  2. 1 2 ln ( x ) d x
  1. 1 5 x d x 1 2 ( b a ) a + b = 1 2 5 1 1 + 5 = 6.47214

  2. 1 2 ln ( x ) d x 1 2 ( b a ) ( ln ( a ) + ln ( b ) ) = 1 2 1 0 0 + ln ( 2 ) = 0.34657

The answer you obtain for this next Task can be checked against the table of results in HELM booklet  39 concerning the Normal distribution or in a standard statistics textbook.

Task!

Use the simple trapezium method to approximate 0 1 1 2 π e x 2 2 d x

We find that

0 1 1 2 π e x 2 2 d x 1 2 ( 1 0 ) 1 2 π ( 1 + e 1 2 ) = 0.32046

to 5 decimal places.

So we have a means of approximating a b f ( x ) d x . The question remains whether or not it is a good approximation.

2.1 How good is the simple trapezium rule?

We define e T , the error in the simple trapezium rule to be the difference between the actual value of the integral and our approximation to it, that is

e T = a b f ( x ) d x 1 2 ( b a ) f ( a ) + f ( b )

It is enough for our purposes here to omit some theory and skip straight to the result of interest. In many different textbooks on the subject it is shown that

e T = 1 12 ( b a ) 3 f ( c )

where c is some number between a and b . (The principal drawback with this expression for e T is that we do not know what c is, but we will find a way to work around that difficulty later.)

It is worth pausing to ask what meaning we can attach to this expression for e T . There are two factors which can influence e T :

  1. If b a is small then, clearly, e T will most probably also be small. This seems sensible enough - if the integration interval is a small one then there is “less room" to accumulate a large error. (This observation forms part of the motivation for the composite trapezium rule discussed later in this Section.)
  2. If f is small everywhere in a < x < b then e T will be small. This reflects the fact that we worked out the integral of a straight line function, instead of the integral of f . If f is a long way from being a straight line then f will be large and so we must expect the error e T to be large too.

We noted above that the expression for e T is less useful than it might be because it involves the unknown quantity c . We perform a trade-off to get around this problem. The expression above gives an exact value for e T , but we do not know enough to evaluate it. So we replace the expression with one we can evaluate, but it will not be exact. We replace f ( c ) with a worst case value to obtain an upper bound on e T . This worst case value is the largest (positive or negative) value that f ( x ) achieves for a x b . This leads to

e T max a x b f ( x ) ( b a ) 3 12 .

We summarise this in Key Point 6.

Key Point 6

Error in the Simple Trapezium Rule

The error, e T , in the simple trapezium approximation to a b f ( x ) d x is bounded above by

max a x b f ( x ) ( b a ) 3 12

Example 11

Work out the error bound (to 6 decimal places) for the simple trapezium method approximations to

  1. 0 π 4 sin ( x ) d x
  2. 0 2 cosh ( x ) d x
Solution

In each case the trickiest part is working out the maximum value of f ( x ) .

  1. Here f ( x ) = sin ( x ) , therefore f ( x ) = cos ( x ) and f ( x ) = sin ( x ) . The function sin ( x ) takes values between 0 and 1 2 when x varies between 0 and π 4 . Hence

    e T < 1 2 × ( π 4 ) 2 12 = 0.028548  to 6 decimal places.

  2. If f ( x ) = cosh ( x ) then f ( x ) = cosh ( x ) too. The maximum value of cosh ( x ) for x between 0 and 2 will be cosh ( 2 ) = 3.762196 , to 6 decimal places. Hence, in this case,

    e T < ( 3.762196 ) × ( 2 0 ) 3 12 = 2.508130  to 6 decimal places.

(In Example 11 we used a rounded value of cosh ( 2 ) . To be on the safe side, it is best to round this number up to make sure that we still have an upper bound on e T . In this case, of course, rounding up is what we would naturally do, because the seventh decimal place was a 6.)

Task!

Work out the error bound (to 5 significant figures) for the simple trapezium method approximations to

  1. 1 5 x d x
  2. 1 2 ln ( x ) d x

If f ( x ) = x = x 1 2 then f ( x ) = 1 2 x 1 2 and f ( x ) = 1 4 x 3 2 .

The negative power here means that f takes its biggest value in magnitude at the left-hand end of the interval [ 1 , 5 ] and we see that max 1 x 5 f ( x ) = f ( 1 ) = 1 4 . Therefore

e T < 1 4 × 4 3 12 = 1.3333  to 5 s.f.

Here f ( x ) = ln ( x ) hence f ( x ) = 1 x and f ( x ) = 1 x 2 .

It follows then that max 1 x 2 f ( x ) = 1 and we conclude that

e T < 1 × 1 3 12 = 0.083333  to 5 s.f.

One deficiency in the simple trapezium rule is that there is nothing we can do to improve it. Having computed an error bound to measure the quality of the approximation we have no way to go back and work out a better approximation to the integral. It would be preferable if there were a parameter we could alter to tune the accuracy of the method. The following approach uses the simple trapezium method in a way that allows us to improve the accuracy of the answer we obtain.