Nathan Wakefield, Christine Kelley, Marla Williams, Michelle Haver, Lawrence Seminario-Romero, Robert Huben, Aurora Marks, Stephanie Prahl, Based upon Active Calculus by Matthew Boelkins
How do we accurately evaluate a definite integral such as when we cannot use the First Fundamental Theorem of Calculus because the integrand lacks an elementary algebraic antiderivative? Are there ways to generate accurate estimates without using extremely large values of in Riemann sums?
What is the Trapezoid Rule, and how is it related to left, right, and middle Riemann sums?
How are the errors in the Trapezoid Rule and Midpoint Rule related, and how can they be used to develop an even more accurate rule?
When we first explored finding the net signed area bounded by a curve, we developed the concept of a Riemann sum 4.2 as a helpful estimation tool and a key step in the definition of the definite integral. Recall that the left, right, and middle Riemann sums of a function on an interval are given by
A Riemann sum is a sum of (possibly signed) areas of rectangles. The value of determines the number of rectangles, and our choice of left endpoints, right endpoints, or midpoints determines the heights of the rectangles. We can see the similarities and differences among these three options in Figure 5.74, where we consider the function on the interval , and use 5 rectangles for each of the Riemann sums.
Part (d) of Example 4.35 explored how to determine if LEFT and RIGHT are underestimates or overestimates of when is increasing. Similar statements can be made when is decreasing. These are summarized next.
While it is a good exercise to compute a few Riemann sums by hand, just to ensure that we understand how they work and how varying the function, the number of subintervals, and the choice of endpoints or midpoints affects the result, using computing technology is a quick way to determine LEFT,RIGHT, and MID. Any computer algebra system will offer this capability.
In this section we explore several different alternatives for estimating definite integrals. Our main goal is to develop formulas to estimate definite integrals accurately without using a large numbers of rectangles.
Example5.75.
As we begin to investigate ways to approximate definite integrals, it will be insightful to compare results to integrals whose exact values we know. To that end, the following sequence of questions centers on .
with the function on the window of values from to to compute LEFT, the left Riemann sum with three subintervals.
Likewise, use the applet to compute RIGHT and MID, the right and middle Riemann sums with three subintervals, respectively.
Use the Fundamental Theorem of Calculus to compute the exact value of .
We define the error in an approximation of a definite integral to be the difference between the integral’s exact value and the approximation’s value. What is the error that results from using LEFT? From RIGHT? From MID?
In what follows in this section, we will learn a new approach to estimating the value of a definite integral known as the Trapezoid Rule. The basic idea is to use trapezoids, rather than rectangles, to estimate the area under a curve. What is the formula for the area of a trapezoid with bases of length and and height ?
Working by hand, estimate the area under on using three subintervals and three corresponding trapezoids. What is the error in this approximation? How does it compare to the errors you calculated in (d)?
Figure5.76.Using 3 trapezoids to approximate
Answer.
LEFT
MIDRIGHT
The area of a trapezoid with bases of length and and height is
.
TRAP
Solution.
In addition to changing to and the number of subintervals to , make sure to change the Sample Point Placement so that "Relative" is checked and the slide bar is all the way to the left. You’ll see that now it is sampling values from the left side of each sub-interval.
LEFT
First change and the number of subintervals to and . For RIGHT, make sure to change the Sample Point Placement so that "Relative" is checked and the slide bar is all the way to the right. You’ll see that now it is sampling values from the right side of each subinterval. For MID, make sure to change the Sample Point Placement so that "Relative" is checked and the slide bar is in the middle and the "midpoint" label shows. You’ll see that now it is sampling values from the middle of each interval.
MIDRIGHT
Denote the error from each approximation and . Then
LEFT
RIGHT
MID
The area of a trapezoid with bases of length and and height is
.
The left-most trapezoid has base lengths 0 and 1 and height 1, so the area of the first trapezoid is . The middle trapezoid has base lengths 1 and 8 and height 1, so the area of the second trapezoid is . The right-most trapezoid has base lengths 8 and 27 and height 1, so the area of the third trapezoid is . Therefore, the approximate area under the graph of from to using the trapezoid rule with 3 subintervals is TRAP.
The error is . Using trapezoids creates a smaller error compared to LEFT and RIGHT. The magnitude of the error from approximating using MID is half the magnitude of the error from approximating using TRAP, but they have opposite signs.
So far, we have used the simplest possible quadrilaterals (that is, rectangles) to estimate areas. It is natural, however, to wonder if other familiar shapes might serve us even better.
An alternative to LEFT,RIGHT, and MID is called the Trapezoid Rule. Rather than using a rectangle to estimate the (signed) area bounded by on a small interval, we use a trapezoid. For example, in Figure 5.77, we estimate the area under the curve using three subintervals and the trapezoids that result from connecting the corresponding points on the curve with straight lines.
The biggest difference between the Trapezoid Rule and a Riemann sum is that on each subinterval, the Trapezoid Rule uses two function values, rather than one, to estimate the (signed) area bounded by the curve. For instance, to compute , the area of the trapezoid on , we observe that the left base has length , while the right base has length . The height of the trapezoid is . The area of a trapezoid is the average of the bases times the height, so we have
Because both left and right endpoints are being used, we recognize within the trapezoidal approximation the use of both left and right Riemann sums. Rearranging the expression for TRAP by removing factors of and , grouping the left endpoint and right endpoint evaluations of , we see that
We now observe that two familiar sums have arisen. The left Riemann sum LEFT is LEFT, and the right Riemann sum is RIGHT. Substituting LEFT and RIGHT for the corresponding expressions in Equation (5.18), it follows that TRAPLEFTRIGHT. We have thus seen a very important result: using trapezoids to estimate the (signed) area bounded by a curve is the same as averaging the estimates generated by using left and right endpoints.
In this example, we explore the relationships among the errors generated by left, right, midpoint, and trapezoid approximations to the definite integral
Use the First FTC to evaluate exactly.
Use appropriate computing technology to compute the following approximations for :TRAP,MID,TRAP, and MID.
Recall that the error of an approximation is the difference between the exact value of the definite integral and the resulting approximation. For instance, if we let ERROR represent the error that results from using the trapezoid rule with 4 subintervals to estimate the integral, we have
ERRORTRAP.
Similarly, we compute the error of the midpoint rule approximation with 8 subintervals by the formula
ERRORMID.
Based on your work in (a) and (b) above, compute ERROR,ERROR,ERROR,ERROR.
Which rule consistently over-estimates the exact value of the definite integral? Which rule consistently under-estimates the definite integral?
What behavior(s) of the function lead to your observations in (d)?
Hint.
.
Use a computational device.
Use a computational device.
Which estimate is larger than the true value of the definite integral?
Note that how the curve bends makes a big difference in whether the trapezoid rule over- or under-estimates the value of the definite integral.
Answer.
.
The table below gives values of the trapezoid rule and corresponding errors for different -values.
TRAP
ERROR
The table below gives values of the midpoint rule and corresponding errors for different -values.
MID
ERROR
The trapezoid rule overestimates; the midpoint rule underestimates.
is concave up on .
Solution.
.
The table below gives values of the trapezoid rule and corresponding errors for different -values.
TRAP
ERROR
The table below gives values of the midpoint rule and corresponding errors for different -values.
MID
ERROR
From the errors in comparison to the known exact value, we see that the trapezoid rule overestimates this definite integral and the midpoint rule underestimates this definite integral.
The graph of the function given by is concave up on the interval . Because of this fact, we can see graphically that the line forming the top of each trapezoid lies fully above the curve, and thus the trapezoid rule overestimates the true value of the definite integral. Later in this section we’ll see graphically why this concavity makes the midpoint rule an underestimate.
We know from the definition of the definite integral that if we let be large enough, we can make any of the approximations LEFT,RIGHT, and MID as close as we’d like (in theory) to the exact value of . Thus, it may be natural to wonder why we ever use any rule other than LEFT or RIGHT (with a sufficiently large value) to estimate a definite integral. One of the primary reasons is that as ,, and thus in a Riemann sum calculation with a large value, we end up multiplying by a number that is very close to zero. Doing so often generates roundoff error, because representing numbers close to zero accurately is a persistent challenge for computers.
Hence, we explore ways to estimate definite integrals to high levels of precision, but without using extremely large values of . Paying close attention to patterns in errors, such as those observed in Example 5.78, is one way to begin to see some alternate approaches.
To begin, we compare the errors in the Midpoint and Trapezoid rules. First, consider a function that is concave up on a given interval, and picture approximating the area bounded on that interval by both the Midpoint and Trapezoid rules using a single subinterval.
Figure5.79.Estimating using a single subinterval: at left, the trapezoid rule; in the middle, the midpoint rule; at right, a modified way to think about the midpoint rule.
As seen in Figure 5.79, it is evident that whenever the function is concave up on an interval, the Trapezoid Rule with one subinterval, TRAP, will overestimate the exact value of the definite integral on that interval. From a careful analysis of the line that bounds the top of the rectangle for the Midpoint Rule (shown in magenta), we see that if we rotate this line segment until it is tangent to the curve at the midpoint of the interval (as shown at right in Figure 5.79), the resulting trapezoid has the same area as MID, and this value is less than the exact value of the definite integral. Thus, when the function is concave up on the interval, MID underestimates the integral’s true value.
Figure5.80.Comparing the error in estimating using a single subinterval: in red, the error from the Trapezoid rule; in light red, the error from the Midpoint rule.
The preceding discussion explores how to determine if MID and TRAP are underestimates or overestimates of if is concave up. Similar statements can be made when is concave down. These are summarized next.
Next, we compare the size of the errors between MID and TRAP. Again, we focus on MID and TRAP on an interval where the concavity of is consistent. In Figure 5.80, where the error of the Trapezoid Rule is shaded in red, while the error of the Midpoint Rule is shaded lighter red, it is visually apparent that the error in the Trapezoid Rule is more significant. To see how much more significant, let’s consider two examples and some particular computations.
Using appropriate technology to compute MID,MID,TRAP, and TRAP, as well as the corresponding errors ERROR,ERROR,ERROR, and ERROR, as we did in Example 5.78, we find the results summarized in Table 5.81. We also include the approximations and their errors for the example from Example 5.78.
For a given function and interval ,ERRORTRAP calculates the difference between the exact value of the definite integral and the approximation generated by the Trapezoid Rule with . If we look at not only ERROR, but also the other errors generated by using TRAP and MID with and in the two examples noted in Table 5.81, we see an evident pattern. Not only is the sign of the error (which measures whether the rule generates an over- or under-estimate) tied to the rule used and the function’s concavity, but the magnitude of the errors generated by TRAP and MID seems closely connected. In particular, the errors generated by the Midpoint Rule seem to be about half the size of those generated by the Trapezoid Rule.
That is, we can observe in both examples that ERRORERROR and ERRORERROR. This property of the Midpoint and Trapezoid Rules turns out to hold in general: for a function of consistent concavity, the error in the Midpoint Rule has the opposite sign and approximately half the magnitude of the error of the Trapezoid Rule. Written symbolically,
This important relationship suggests a way to combine the Midpoint and Trapezoid Rules to create an even more accurate approximation to a definite integral.
If a function is always increasing or always decreasing on the interval , one of LEFT and RIGHT will over-estimate the true value of , while the other will under-estimate the integral. Thus, the errors found in LEFT and RIGHT will have opposite signs; so averaging LEFT and RIGHT eliminates a considerable amount of the error present in the respective approximations. In a similar way, it makes sense to think about averaging MID and TRAP in order to generate a still more accurate approximation.
We’ve just observed that MID is typically about twice as accurate as TRAP. This leads to an approximation method known as Simpson’s Rule 37
Thomas Simpson was an 18th century mathematician; his idea was to extend the Trapezoid rule, but rather than using straight lines to build trapezoids, to use quadratic functions to build regions whose area was bounded by parabolas (whose areas he could find exactly). Simpson’s Rule is often developed from the more sophisticated perspective of using interpolation by quadratic functions.
which is a weighted average of the Midpoint and Trapezoid approximations.
Note that we use “SIMP” rather that “SIMP” since the points the Midpoint Rule uses are different from the points the Trapezoid Rule uses, and thus Simpson’s Rule is using points at which to evaluate the function. We build upon the results in Table 5.81 to see the approximations generated by Simpson’s Rule. In particular, in Table 5.82, we include all of the results in Table 5.81, but include additional results for SIMPMIDTRAP and SIMPMIDTRAP.
The results seen in Table 5.82 are striking. If we consider the SIMP approximation of , the error is only ERROR. By contrast, LEFT, so the error of that estimate is ERROR. Moreover, we observe that generating the approximations for Simpson’s Rule is almost no additional work: once we have LEFT,RIGHT, and MID for a given value of , it is a simple exercise to generate TRAP, and from there to calculate SIMP. Finally, note that the error in the Simpson’s Rule approximations of is zero! 38
Similar to how the Midpoint and Trapezoid approximations are exact for linear functions, Simpson’s Rule approximations are exact for quadratic and cubic functions. See additional discussion on this issue later in the section and in the exercises.
These rules are not only useful for approximating definite integrals such as , for which we cannot find an elementary antiderivative of , but also for approximating definite integrals when we are given a function through a table of data.
Example5.83.
A car traveling along a straight road is braking and its velocity is measured at several different points in time, as given in the following table. Assume that is continuous, always decreasing, and always decreasing at a decreasing rate, as is suggested by the data.
seconds,
Velocity in ft/sec,
Table5.84.Data for the braking car.
Figure5.85.Axes for plotting the data in Example 5.83.
Plot the given data on the set of axes provided in Figure 5.85 with time on the horizontal axis and the velocity on the vertical axis.
What definite integral will give you the exact distance the car traveled on ?
Estimate the total distance traveled on by computing LEFT,RIGHT, and TRAP. Which of these under-estimates the true distance traveled?
Estimate the total distance traveled on by computing MID. Is this an over- or under-estimate? Why?
Using your results from (c) and (d), improve your estimate further by using Simpson’s Rule.
What is your best estimate of the average velocity of the car on ? Why? What are the units on this quantity?
Hint.
Plot the data.
What are the units of ?
Recall the standard rules for sums that produce LEFT,RIGHT,TRAP.
Think about concavity to decide if MID is an over- or under-estimate.
Recall how SIMP is a weighted average of TRAP and MID.
Simpson’s Rule gives the best estimate for a function of consistent concavity.
Answer.
Plot the data.
.
LEFT ft RIGHT ft TRAP ft .
RIGHT and TRAP are underestimates.
MID ft ; overestimate.
SIMP ft .
Simpson’s rule gives the best approximation of the distance traveled, ft .
Solution.
Plot the data.
Since the velocity is always positive, the definite integral that will give the exact distance traveled by the car on the interval is
.
The estimates of are
LEFT ft RIGHT ft TRAP ft .
RIGHT is an underestimate of the distance traveled since is decreasing. TRAP is an underestimate of the distance traveled since is concave down.
Another estimate of the distance traveled is
MID ft .
This is an overestimate since is concave down.
For Simpson’s Rule, we see that
SIMPMIDTRAP ft .
Simpson’s rule gives the best approximation of the distance traveled since it is a weighted average of the midpoint and trapezoid rules and uses more information about the velocity than the other methods. The units on each of the estimates, including Simpson’s Rule, are "feet", since ft/sec sec = ft. Thus, the best approximation we have generated is that ft .
As we conclude our discussion of numerical approximation of definite integrals, it is important to summarize general trends in how the various rules over- or under-estimate the true value of a definite integral, and by how much. To revisit some past observations and see some new ones, we consider the following example.
Example5.86.
Consider the functions ,, and , all on the interval . For each of the questions that require a numerical answer in what follows, write your answer exactly in fraction form.
On the three sets of axes provided in Figure 5.87, sketch a graph of each function on the interval , and compute LEFT and RIGHT for each. What do you observe?
Compute MID for each function to approximate ,, and , respectively.
Compute TRAP for each of the three functions, and hence compute SIMP for each of the three functions.
Evaluate each of the integrals ,, and exactly using the First FTC.
For each of the three functions ,, and , compare the results of LEFT,RIGHT,MID,TRAP, and SIMP to the true value of the corresponding definite integral. What patterns do you observe?
Figure5.87.Axes for plotting the functions in Example 5.86.
Hint.
For each estimate, just one function evaluation is needed.
Use the midpoint rule with .
Remember that both the trapezoid and Simpson’s rule can be executed using (weighted) averages of known values.
Find antiderivatives to evaluate the integrals exactly.
Think about trends in over- and under-estimates.
Answer.
For LEFT and TRAP:
Table5.88.Left and Trapezoid rules.
LEFT
LEFT
LEFT
RIGHT
RIGHT
RIGHT
The values of LEFT and RIGHT are the same for all three.
For the MID,
Table5.89.Midpoint Rule.
MID
MID
MID
For TRAP and SIMP,
Table5.90.Trapezoid and Simpson’s Rule.
TRAP
TRAP
TRAP
SIMP
SIMP
SIMP
Left endpoint rule results are overestimates; right endpoint rules are underestimates; midpoint rules are overestimates; trapezoid rules are underestimates. Simpson’s rule is exact for both and , while a slight overestimate of .
Solution.
For the left and right endpoint rules, we see that
Table5.91.Left and Trapezoid rules.
LEFT
LEFT
LEFT
RIGHT
RIGHT
RIGHT
Thus, we observe that despite the fact the functions are all different, the values of LEFT and RIGHT are the same for all three.
For the midpoint rule, we find that
Table5.92.Midpoint Rule.
MID
MID
MID
For the trapezoid rule and Simpson’s rule,
Table5.93.Trapezoid and Simpson’s Rule.
TRAP
TRAP
TRAP
SIMP
SIMP
SIMP
The exact values of the three definite integrals are
We observe that each of the left endpoint rule results are overestimates, each of the right endpoint rules are underestimates, each of the midpoint rules are overestimates, and each of the trapezoid rules are underestimates. These results hold because each of the three functions are both decreasing and concave down. For Simpson’s rule, we see that the result is exact for both and , while Simpson’s rule is a slight overestimate of .
The results seen in Example 5.86 generalize nicely. For instance, if is decreasing on ,LEFT will overestimate the exact value of , and if is concave down on ,MID will overestimate the exact value of the integral. An excellent exercise is to write a collection of scenarios of possible function behavior, and then categorize whether each of LEFT,RIGHT,TRAP, and MID is an over- or under-estimate.
Finally, we make two important notes about Simpson’s Rule. When T. Simpson first developed this rule, his idea was to replace the function on a given interval with a quadratic function that shared three values with the function . In so doing, he guaranteed that this new approximation rule would be exact for the definite integral of any quadratic polynomial. In one of the pleasant surprises of numerical analysis, it turns out that even though it was designed to be exact for quadratic polynomials, Simpson’s Rule is exact for any cubic polynomial: that is, if we are interested in an integral such as , the approximation SIMP will always be exact, regardless of the value of . This is just one more piece of evidence that shows how effective Simpson’s Rule is as an approximation tool for estimating definite integrals. 39
One reason that Simpson’s Rule is so effective is that SIMP benefits from using points of data. Because it combines MID, which uses midpoints, and TRAP, which uses the endpoints of the chosen subintervals, SIMP takes advantage of the maximum amount of information we have when we know function values at the endpoints and midpoints of subintervals.
For a definite integral such as when we cannot use the First Fundamental Theorem of Calculus because the integrand lacks an elementary algebraic antiderivative, we can estimate the integral’s value by using a sequence of Riemann sum approximations. Typically, we start by computing LEFT,RIGHT, and MID for one or more chosen values of .
The Trapezoid Rule, which estimates by using trapezoids, rather than rectangles, can also be viewed as the average of Left and Right Riemann sums. That is, TRAPLEFTRIGHT.
The Midpoint Rule is typically twice as accurate as the Trapezoid Rule, and the signs of the respective errors of these rules are opposites. Hence, by taking the weighted average SIMPMIDTRAP, we can build a much more accurate approximation to by using approximations we have already computed. The rule for SIMP is known as Simpson’s Rule, which can also be developed by approximating a given continuous function with pieces of quadratic polynomials.
By understanding the approximation rule chosen, and the properties of the function (i.e. whether it is increasing or decreasing, or concave up or down on the interval in question), we can say whether the approximation is an over or under-estimate of the actual value.
Note: for this problem, because later answers depend on earlier ones, you must enter answers for all answer blanks for the problem to be correctly graded. If you would like to get feedback before you completed all computations, enter a "1" for each answer you did not yet compute and then submit the problem. (But note that this will, obviously, result in a problem submission.)
For each rule in part (b), as goes from to , does the error go down approximately as you would expect? Explain by calculating the ratios of the errors:
PTX:ERROR: WeBWorK problem UNL-Problems/Library/WHFreeman/Rogawski_Calculus_Early_Transcendentals_Second_Edition/5_The_Integral/5.5_Net_Change_as_the_Integral_of_a_Rate/5.5.18.pg with seed 265 does not return valid XML It may not be PTX compatible Use -a to halt with returned content
The rate at which water flows through Table Rock Dam on the White River in Branson, MO, is measured in thousands of cubic feet per second (TCFS). As engineers open the floodgates, flow rates are recorded according to the following chart.
What definite integral measures the total volume of water to flow through the dam in the 60 second time period provided by the table above?
Use the given data to calculate MID for the largest possible value of to approximate the integral you stated in (a). Do you think MID over- or under-estimates the exact value of the integral? Why?
Approximate the integral stated in (a) by calculating SIMP for the largest possible value of , based on the given data.
Compute SIMP and . What quantity do both of these values estimate? Which is a more accurate approximation?