next up previous
Next: Simpson's Rule Up: Approximating the Definite Integral Previous: The Definite Integral

The Trapezoidal Rule

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, tex2html_wrap_inline2119, where tex2html_wrap_inline2121 for tex2html_wrap_inline2123. On each subinterval tex2html_wrap_inline1989 of P we approximate f(x) with a line segment. Here, instead of approximating f(x) with a horizontal line segment over tex2html_wrap_inline1989, we shall approximate f(x) with the line segment that has the points tex2html_wrap_inline2137 and tex2html_wrap_inline2139 as its endpoints--points that lie on the graph of y = f(x).

  figure77
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 tex2html_wrap_inline1989 we approximate f(x) with the unique line

displaymath2149

Therefore

displaymath2151

By evaluating the integral on the right, we obtain

displaymath2153

since tex2html_wrap_inline2155 for each i. Summing the definite integrals over each subinterval tex2html_wrap_inline1989 provides us with the approximation

displaymath2161

By simplifying this sum we obtain the approximation scheme

  equation108

This is the Trapezoidal Rule. It is known by this name because on each subinterval tex2html_wrap_inline1989 we are approximating the region bounded by the curve y = f(x), the x-axis, and the lines tex2html_wrap_inline2023 and tex2html_wrap_inline2025, with a region having a trapezoidal shape. We shall denote tex2html_wrap_inline2173 to be the sum given on the right side of (3):

displaymath2175

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

displaymath2177

by applying the Trapezoidal Rule with n = 3. Here we have tex2html_wrap_inline1931, with a = -1 and b = 1, so that tex2html_wrap_inline2187 with

displaymath2189

for i = 0, 1, 2, 3. When we apply the Trapezoidal Rule, we obtain

eqnarray129

to nine decimal places. Note that the actual value of this integral is 4/3 = 1.333333333. tex2html_wrap_inline2195

  figure148
Figure 3:   Approximating the area between the curve tex2html_wrap_inline1931 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

displaymath2207

In this case our function f(x) = 1/x, and we have tex2html_wrap_inline2211 with

displaymath2213

for tex2html_wrap_inline2215. Applying the Trapezoidal Rule then provides

displaymath2217

to nine decimal places. Note that the actual value of this integral is tex2html_wrap_inline2219. tex2html_wrap_inline2195

Example 3 Let us apply the Trapezoidal Rule with n = 9 to approximate the value of

displaymath2225

In this case our function tex2html_wrap_inline2227, and we have tex2html_wrap_inline2229 with

displaymath2231

for tex2html_wrap_inline2233. Rounded to nine decimal places, this yields the values

displaymath2235

Applying the Trapezoidal Rule then provides

eqnarray183

tex2html_wrap_inline2195

Example 4 We shall now apply the Trapezoidal Rule to approximate tex2html_wrap_inline2239 by approximating the value of the definite integral

displaymath2241

In this example we shall illustrate how well the method works by considering the Trapezoidal Rule for the cases tex2html_wrap_inline2243. The following table provides the values of tex2html_wrap_inline2173 along with the error of the approximation, tex2html_wrap_inline2247, for these values of n.

displaymath2251

Example 5 Let us now apply the Trapezoidal Rule to the definite integral

displaymath2253

Once again, we shall build a table of values of tex2html_wrap_inline2173 for the cases tex2html_wrap_inline2243.

displaymath2259

For each of the previous two examples we computed the values of tex2html_wrap_inline2173 for tex2html_wrap_inline2243 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 tex2html_wrap_inline2173 for larger and larger values of n is not very expedient if tex2html_wrap_inline2173 is computed for consecutive n. This requires that we repeat all aspects of the computation for each n. Instead, having already computed tex2html_wrap_inline2173 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 tex2html_wrap_inline2281 is minimized. To utilize the values of f(x) that we found in computing tex2html_wrap_inline2173, 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 tex2html_wrap_inline2293 from tex2html_wrap_inline2173 according to the scheme

  equation199

where

  equation209

and thus instead of having to evaluate f(x) at each of the 2n + 1 points tex2html_wrap_inline2301, given by (5), we need only evaluate f(x) at the additional n points tex2html_wrap_inline2307.

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 tex2html_wrap_inline2313 exists on [a,b]. Then for n a positive integer,

displaymath2319

where

displaymath2321

and the error tex2html_wrap_inline2323 is given by

displaymath2325

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 tex2html_wrap_inline2323 for functions f(x) in general. However, one of the implications here is that the magnitude of the error has the bounds

displaymath2337

Thus if tex2html_wrap_inline2313 is never 0 on [a,b], then the error tex2html_wrap_inline2323 must be non-zero.

Example 6 In Example 2 we used the Trapezoidal Rule to find tex2html_wrap_inline2345 as an approximation of the value of

displaymath2207

For our function f(x) = 1/x, we have tex2html_wrap_inline2351, so that

displaymath2353

Since tex2html_wrap_inline2313 is strictly decreasing for all x > 0, we see that

displaymath2359

Example 7 In Example 3 we incorporated the Trapezoidal Rule to find tex2html_wrap_inline2361 as an approximation of the value of

displaymath2225

For our function tex2html_wrap_inline2227, we have

displaymath2367

Note that

displaymath2369

which is positive for tex2html_wrap_inline2371. Therefore tex2html_wrap_inline2313 is increasing on [1,e], so that

displaymath2377

Example 8 In Example 4 we approximated the value of tex2html_wrap_inline2379 by means of the Trapezoidal Rule applied to the definite integral

displaymath2241

Here our function tex2html_wrap_inline2383, so that tex2html_wrap_inline2385. From this we can see that tex2html_wrap_inline2313 does not exist at x = 1. In fact, tex2html_wrap_inline2391 as tex2html_wrap_inline2393. Thus we cannot use Theorem 1.1 to bound the error tex2html_wrap_inline2323. However, this does not imply that we are unable to effectively approximate the value of tex2html_wrap_inline2379 by applying the Trapezoidal Rule to this definite integral. To obtain better and better approximations, we need only increase the value of n. tex2html_wrap_inline2195


next up previous
Next: Simpson's Rule Up: Approximating the Definite Integral Previous: The Definite Integral