Trapezoidal Rule of Integration
What is integration?
Integration is the process of measuring the area under a function plotted on a graph.
Sometimes, the evaluation of expressions involving these integrals can become daunting, if
not indeterminate. For this reason, a wide variety of numerical methods has been developed
to simplify the integral.
Here, we will discuss the trapezoidal rule of approximating integrals of the form
where
is called the integrand,
lower limit of integration
upper limit of integration
What is the trapezoidal rule?
The trapezoidal rule is based on the Newton-Cotes formula that if one approximates the
integrand by an order polynomial, then the integral of the function is approximated by the
integral of that order polynomial. Integrating polynomials is simple and is based on the
calculus formula.
Figure 1 Integration of a function
(1)
So if we want to approximate the integral
07.02.1
2
(2)
to find the value of the above integral, one assumes
(3)
where
. (4)
where is a order polynomial. The trapezoidal rule assumes , that is,
approximating the integral by a linear polynomial (straight line),
b b
f ( x)dx f ( x)dx
a a
1
Derivation of the Trapezoidal Rule
Method 1: Derived from Calculus
(5)
But what is and ? Now if one chooses, and as the two points to
approximate by a straight line from to ,
(6)
(7)
Solving the above two equations for and ,
(8a)
Hence from Equation (5),
(8b)
(9)
Example 1
The vertical distance covered by a rocket from to seconds is given by
a) Use the single segment trapezoidal rule to find the distance covered for to
seconds.
b) Find the true error, for part (a).
c) Find the absolute relative true error for part (a).
Solution
a) , where
m/s
m/s
b) The exact value of the above integral is
m
so the true error is
True Value – Approximate Value
m
c) The absolute relative true error, , would then be
Multiple-Segment Trapezoidal Rule
In Example 1, the true error using a single segment trapezoidal rule was large. We can
divide the interval into and intervals and apply the trapezoidal rule
over each segment.
4
m/s
m/s
m/s
Hence
m
The true error, is
m
The true error now is reduced from m to m. Extending this procedure to dividing
into equal segments and applying the trapezoidal rule over each segment, the sum of
the results obtained for each segment is the approximate value of the integral.
Divide into equal segments as shown in Figure 4. Then the width of each segment
is
(26)
The integral can be broken into integrals as
(27)
Figure 4 Multiple ( ) segment trapezoidal rule
I (28)
Example 2
The vertical distance covered by a rocket from to seconds is given by
a) Use the two-segment trapezoidal rule to find the distance covered from to
seconds.
b) Find the true error, for part (a).
c) Find the absolute relative true error for part (a).
Solution
a) The solution using 2-segment Trapezoidal rule is
b) The exact value of the above integral is
m
so the true error is
Approximate Value
6
c) The absolute relative true error, , would then be
Table 1 Values obtained using multiple-segment trapezoidal rule for
Approximate
Value
1 11868 -807 7.296 ---
2 11266 -205 1.853 5.343
3 11153 -91.4 0.8265 1.019
4 11113 -51.5 0.4655 0.3594
5 11094 -33.0 0.2981 0.1669
6 11084 -22.9 0.2070 0.09082
7 11078 -16.8 0.1521 0.05482
8 11074 -12.9 0.1165 0.03560
Example 3
Use the multiple-segment trapezoidal rule to find the area under the curve
from to .
Solution
Using two segments, we get
So what is the true value of this integral?
Making the absolute relative true error
Why is the true value so far away from the approximate values? Just take a look at Figure 5.
As you can see, the area under the “trapezoids” (yeah, they really look like triangles now)
covers a small portion of the area under the curve. As we add more segments, the
approximated value quickly approaches the true value.
Figure 5 2-segment trapezoidal rule approximation.
Table 2 Values obtained using multiple-segment trapezoidal rule for .
Approximate
Value
1 0.681 245.91 99.724%
2 50.535 196.05 79.505%
8
4 170.61 75.978 30.812%
8 227.04 19.546 7.927%
16 241.70 4.887 1.982%
32 245.37 1.222 0.495%
64 246.28 0.305 0.124%
Error in Multiple-segment Trapezoidal Rule
The true error for a single segment Trapezoidal rule is given by
Where is some point in .
What is the error then in the multiple-segment trapezoidal rule? It will be simply the sum of
the errors from each segment, where the error in each segment is that of the single segment
trapezoidal rule. The error in each segment is
.
.
.
.
.
.
Hence the total error in the multiple-segment trapezoidal rule is
The term is an approximate average
value of the second derivative .
Hence
In Table 4, the approximate value of the integral
is given as a function of the number of segments. You can visualize that as the number of
segments are doubled, the true error gets approximately quartered.
Table 4 Values obtained using multiple-segment trapezoidal rule for
Approximate
Value
2 11266 -205 1.853 5.343
4 11113 -52 0.4701 0.3594
8 11074 -13 0.1175 0.03560