Chapter 10 TRAPEZOIDAL RULE
Chapter 10 TRAPEZOIDAL RULE
Chapter 10 TRAPEZOIDAL RULE
Chapter 10
Trapezoidal
Rule
At the end of this chapter, students should be able to:
Derive trapezoidal rule
Identify and apply trapezoidal rule
Determine error involved in trapezoidal rule
10.1 Introduction
From calculus books it is stated that the area under the graph bounded by the
x-axis, x=a and x=b for a given function f(x) can be computed by evaluating
the definite integral,
b
Area f ( x ) dx
a
There are other applications involving integration such as finding volume and
arc length.
b b
Volume xf ( x ) dx Arc length 1 f ' ( x ) dx
2
or
a a
b
The definite integral f ( x ) dx
a
can be computed once the function whose
151
NUMERICAL INTEGRATION Part 6
1 2 b cos x
x
e dx dx
0 and a x
(b) numerical integration may be easier or quicker than calculating from the
function obtained by formal integration
(c) no analytical expression for the function to be integrated may be available
since the available information is being restricted to tabulated values.
b
However, the definite integral f ( x ) dx is a number which represents the area
a
between y = f(x), the x-axis and the ordinates x = a and x = b. So, even if
b b
f ( x ) dx cannot be found, an approximate value for f ( x ) dx can be found by
a a
y = f(x)
b
f ( x ) dx
a
x
a b
Figure 10.1:
Trapezoidal rule
Simpson’s rule
Simpson’s 3/8 rule
152
NUMERICAL INTEGRATION Part 6
Definition
A trapezoid (trapezium) is a quadrilateral with one pair of opposite sides
parallel.
y0 y1
h
on [a, b].
y
y1
y2
y0
y3
y4
h h h h
x
a b
Figure 10.3:
b
If the area represented by f ( x ) dx is divided into 4 smaller subintervals, each
a
Using the sum of the areas of these subintervals as an approximation for the
actual value of the area we have
153
NUMERICAL INTEGRATION Part 6
b
f ( x ) dx A 1 A 2 A 3 A 4
a
1 1
where A1 ( f0 f1)h i.e. An (fn-1 fn )h
2 2
Therefore,
b
f ( x ) dx A 1 A 2 A 3 A 4
a
1 1 1 1
( f0 f1)h ( f1 f2 )h ( f2 f3 )h ( f3 f4 )h
2 2 2 2
h
(f0 2f1 2f2 2f3 f4 )
2
This method is known as the trapezoidal rule. The number of subintervals
(strips) used above is four and the number of ordinates (subscripts of y) is
five.
Note that the above subintervals must be evenly spaced. Generally, with n
number of subintervals or n+1 number of ordinates, the trapezoidal rule is
b h
f ( x ) dx ( f0 2f1 2f2 ... 2fn-1 fn )
a 2
Example 1
3
Use the trapezoidal rule with four subintervals to evaluate x 2 dx .
1
154
NUMERICAL INTEGRATION Part 6
Solution x^2
10
5 x^2
0
1 1.2 1.4 1.6 1.8 2 2.2 2.4 2.6 2.8 3
f ( x) x2
Apply the trapezoidal rule
h n-1
T ( y0 2 yi yn )
2 i1
0.5 3
T ( y 0 2 yi y 4 )
2 i1
0.251 2(2.25 4 6.25) 9
8.75
155
NUMERICAL INTEGRATION Part 6
Example 2
0.8 2
Evaluate e x dx with h = 0.2 by applying trapezoidal rule.
0
Solution
0 .2
1.00 2(1.0408 1.1735 1.4333) 1.8965
2
1.0192
2
i xi f(xi) = e xi coef coef*yi
0 0.00 1.0000 1 1.0000
1 0.20 1.0408 2 2.0816
2 0.40 1.1735 2 2.3470
3 0.60 1.4333 2 2.8667
4 0.80 1.8965 1 1.8965
156
NUMERICAL INTEGRATION Part 6
Example 3
The following points were found empirically.
x 2.1 2.4 2.7 3.0 3.3 3.6 3.9
y 2.5 2.8 3.0 3.3 3.6 3.9 4.1
3. 9
Use the trapezoidal rule to estimate y dx .
2.1
Solution
Note that the interval is [2.1, 3.9] while the step size; h = 0.3 and the
number of ordinates are 7. Therefore,
3.9
y dx
0.3
2.5 22.8 3.0 3.3 3.6 3.9 4.1
2.1 2
5.97
Warm up exercise
2 1
Consider the definite integral dx and divide the interval into 5
0 1 cos x
subintervals.
(i) Identify the interval.
(ii) Identify the step size.
(iii) Identify the function.
(iv) Approximate the definite integral above using trapezoidal rule with 6
ordinates.
157
NUMERICAL INTEGRATION Part 6
accurate is the approximation. Now let’s analyze the error incurred in using
b
the trapezoidal rule to estimate f ( x ) dx .
a
where f ' ' ( i ) is the second derivative at a point i located in segment i. This
result can be simplified by estimating the mean or average value of the
second derivative for the entire interval as
n
f ' ' ( i )
f ' ' i 1
n
n
Therefore nf ' ' f ' ' ( i ) and equation (1) can be written as
i 1
(b a)3
Ea f ' ' ( )
12n 2
158
NUMERICAL INTEGRATION Part 6
Same as before, the computed error is an approximate error since the mean
or average value of the second derivative was used.
Theorem
Since the number is not specified in this theorem, we are unable to use this
to determine the exact value of En for functions f(x) in general.
Example 4
2
If the trapezoidal rule is used to compute 2 sin x dx then use the error
0
formula to estimate the error incurred if 10 subintervals are used.
159
NUMERICAL INTEGRATION Part 6
Solution
f ' ( x ) 2 cos x
f ' ' x 2 sin x
Compute the average value of the second derivatives;
b
f ' ' ( x ) dx
f ' ' ( ) a
ba
2
2 sin x dx
f ' ' ( ) 0
2
1
2 cos x 02
2
cos 2 cos 0
1.4161
Compute the approximate error;
(b a)3
Ea f ' ' ( )
12n2
(2 0)3
1.4161
12(10)2
9.4407 x 103
0.0944 x 101
160
NUMERICAL INTEGRATION Part 6
Example 5
1 2
If the trapezoid rule is to be used to compute e x dx with an error of at
0
most 0.0005, how many points or nodes are required?
Solution
f '' ( x ) 2e x 4 x 2e x
2 2
2(1)e 1 2(0)e0
2 2
0.7358
161
NUMERICAL INTEGRATION Part 6
Example 6
0.4
Assume 1 x 2 dx is being estimated by trapezoid rule.
0
Solution
Note that the interval is [0, 0.4] with f ( x ) 1 x 2 then
1
2 2
f (x) 1 x
x
f ' (x)
1 x2
1 x2
f '' ( x )
3
1 x2 1 x2
Hence
0 .4
'' 1 x
f (x)
0.4 1 x 2
0
1 0 .4
0
0.4 0.9165
1.0911
(a) If 8 subintervals are used then the error incur is
(b a)3
Ea f ' ' ( )
12n 2
( 0.4 0 ) 3
1.0911
12(8)2
9.0925 x 10 5
0.0909 x 10 3
The estimation is accurate up to 3 decimal places.
162
NUMERICAL INTEGRATION Part 6
Ea 0.5 x 103 .
Theorem
If f '' ( x) is continuous in [a, b], then the error in the trapezoid rule is no larger
than
163
NUMERICAL INTEGRATION Part 6
Warm up exercise
3
Assume ln x dx is being estimated by trapezoid rule with 5 subintervals.
1
Exercise 10
1. Use the trapezoidal rule to estimate the following definite integral with n
subintervals.
2 1 1 .6
x
(a) dx ;n = 4 (d) xe dx ; n = 6
0 1 cos x 1
20 x 3
(b) dx ; n = 10 (e) 2 ln x dx ; n =8
0 5 1
sin t 2
(c) dt ;n=9 (f) 2x cos x dx ; n = 10
t 0
3. Refer to question (1), use the error estimate formula to approximate the error
if the given integral is approximated by trapezoidal rule with the given
subintervals, n.
4. The arc length of the curve y = f(x) over the interval a x b is
b
length 1 ( f ' ( x ))2 dx
a
164
NUMERICAL INTEGRATION Part 6
(a) Approximate the arc length of each function using trapezoidal rule with
n = 10.
(b) Approximate the error accuracy.
(c) How many ordinates are needed to estimate the integral with an accuracy
of 0.5 x103 .
(i) f ( x) x3 for 0 x 1
(ii) f ( x ) sin 2x for 0 x
8
5. Use the trapezoidal rule with n = 5 to estimate the area of the region under
the curve m( t ) 50 2t 2 and above the t-axis.
7. Stocking a Fish Pond As the fish and game warden of your township, you are
responsible for stocking the town pond with fish before the fishing season.
The average depth of the pond is 20 feet. Using the scaled map, you
measure distances across the pond at 200-foot intervals, as shown in the
diagram.
(a) Use the Trapezoidal Rule to estimate the volume of the pond.
(b) You plan to start the season with one fish per 100 cubic feet. You intend to
have at least 25% of the opening day’ fish population left at the end of the
165
NUMERICAL INTEGRATION Part 6
season. What is the maximum number of licenses the town can ell in the
average seasonal catch is 20 fish per license?
166
NUMERICAL INTEGRATION Part 6
http://www.math.dartmouth.edu/~calcsite/video1.html#406
Source: 1999 Addison Wesley Longman, Inc.
http://www.mathcs.emory.edu/ccs/ccs215/integral/node3.html
167