The first method we shall develop is known as the Trapezoidal Rule. In this method we approximate f(x) with a collection of line segments and integrate across each of these.
Let P be a partition of [a,b] into n subintervals of equal width,
, where
for
. On each subinterval
of P we
approximate f(x) with a line segment. Here, instead of approximating
f(x) with a horizontal line segment over
, we shall
approximate f(x) with the line segment that has the points
and
as its endpoints--points that
lie on the graph of y = f(x).
Figure 2: Approximating the graph of y = f(x) with
line segments across successive intervals to obtain the Trapezoidal Rule.
Since exactly one line can pass through two distinct points, we see
that any line that interpolates these points must be unique. Thus
on
we approximate f(x) with the unique line
Therefore
By evaluating the integral on the right, we obtain
since
for each i. Summing the definite
integrals over each subinterval
provides us with
the approximation
By simplifying this sum we obtain the approximation scheme
This is the Trapezoidal Rule. It is known by this name because on
each subinterval
we are approximating the region
bounded by the curve y = f(x), the x-axis, and the lines
and
, with a region having a trapezoidal shape.
We shall denote
to be the sum given on the right side of
(3):
Note that the result in (3) is actually an average of the results in (1) and (2).
Example 1 Let us consider how to approximate the value of the definite integral
by applying the Trapezoidal Rule with n = 3. Here we have
, with a = -1 and b = 1, so that
with
for i = 0, 1, 2, 3. When we apply the Trapezoidal Rule, we obtain
to nine decimal places. Note that the actual value of this
integral is 4/3 = 1.333333333.
Figure 3: Approximating the area between the curve
and the x-axis on [-1,1] by using the Trapezoidal
Rule with n = 3.
Example 2 Let us apply the Trapezoidal Rule with n = 6 to approximate the value of
In this case our function f(x) = 1/x, and we have
with
for
. Applying the Trapezoidal Rule then provides
to nine decimal places. Note that the actual value of this integral
is
.
Example 3 Let us apply the Trapezoidal Rule with n = 9 to approximate the value of
In this case our function
, and we have
with
for
. Rounded to nine decimal places, this yields
the values
Applying the Trapezoidal Rule then provides
Example 4 We shall now apply the Trapezoidal Rule
to approximate
by approximating the value of the
definite integral
In this example we shall illustrate how well the method works by
considering the Trapezoidal Rule for the cases
.
The following table provides the values of
along with the
error of the approximation,
, for these values of n.
Example 5 Let us now apply the Trapezoidal Rule to the definite integral
Once again, we shall build a table of values of
for the
cases
.
For each of the previous two examples we computed the values of
for
for the purpose of illustrating the rate at
which the Trapezoidal Rule converges to the exact value of the
respective definite integral. However when applying an approximation
scheme such as, in this case, the Trapezoidal Rule, the effort to
produce successively better approximations by means of computing
for larger and larger values of n is not very expedient if
is
computed for consecutive n. This requires that we repeat all
aspects of the computation for each n. Instead, having already
computed
for some n, we wish to be able to find the next
larger N > n such that the amount of additional work required to
compute
is minimized. To utilize the values of f(x) that we
found in computing
, this requires that N be a multiple of n,
and thus we take N = 2 n to minimize the necessary additional work.
We can compute
from
according to the scheme
where
and thus instead of having to evaluate f(x) at each of the 2n + 1
points
, given by (5), we need only
evaluate f(x) at the additional n points
.
The question now arises as to how accurately the Trapezoidal Rule approximates the definite integral of a function f(x) on an interval [a,b]. There is a possibility that the approximation will be exact, meaning that the amount of error, which is the difference between the exact value and the approximation, is 0. However, this is not true in general, and, in fact, for some functions this is impossible on particular intervals, an example of which will be given later on. We study the accuracy of an approximation by considering the error that it produces. Note that if we cannot find the exact value of a definite integral with a finite number of algebraic operations involving elementary functions, then neither can we find the exact value of the error of such an approximation scheme. However for some methods of approximation we can determine bounds for the magnitude of the error. While this does not explicitly give us the value of the error, it can still give us an estimate of how well we are able to approximate a given definite integral using such a method. For the Trapezoidal Rule we have the following
Theorem 1.1 Suppose that
exists on [a,b]. Then for n a positive integer,
where
and the error
is given by
for some point c in [a,b].
Since the number c is not specified in this theorem, we are unable
to use this to determine the exact value of
for functions f(x)
in general. However, one of the implications here is that the
magnitude of the error has the bounds
Thus if
is never 0 on [a,b], then the error
must be non-zero.
Example 6 In Example 2 we used the Trapezoidal Rule
to find
as an approximation of the value of
For our function f(x) = 1/x, we have
, so that
Since
is strictly decreasing for all x > 0, we see
that
Example 7 In Example 3 we incorporated the
Trapezoidal Rule to find
as an approximation of the
value of
For our function
, we have
Note that
which is positive for
. Therefore
is
increasing on [1,e], so that
Example 8 In Example 4 we approximated the
value of
by means of the Trapezoidal Rule applied to the
definite integral
Here our function
, so that
. From this we can see that
does not exist at x = 1. In fact,
as
. Thus we cannot
use Theorem 1.1 to bound the error
. However, this does
not imply that we are unable to effectively approximate the value of
by applying the Trapezoidal Rule to this definite integral.
To obtain better and better approximations, we need only increase the
value of n.