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 \(\int_0^1 e^{-x^2} \, dx\) 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 \(n\) 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 \(f\) on an interval \([a,b]\) are given by

\begin{align}
\text{LEFT}(n) = f(x_0) \Delta x + f(x_1) \Delta x + \cdots + f(x_{n-1}) \Delta x \amp= \sum_{i = 0}^{n-1} f(x_i) \Delta x,\tag{5.15}\\
\text{RIGHT}(n) = f(x_1) \Delta x + f(x_2) \Delta x + \cdots + f(x_{n}) \Delta x \amp= \sum_{i = 1}^{n} f(x_i) \Delta x,\tag{5.16}\\
\text{MID}(n) = f(\overline{x}_1) \Delta x + f(\overline{x}_2) \Delta x + \cdots + f(\overline{x}_{n}) \Delta x \amp= \sum_{i = 1}^{n} f(\overline{x}_i) \Delta x\text{,}\tag{5.17}
\end{align}

where \(x_0 = a\text{,}\)\(x_i = a + i\Delta x\text{,}\)\(x_n = b\text{,}\) and \(\Delta x = \frac{b-a}{n}\text{.}\) For the middle sum, we defined \(\overline{x}_{i} = (x_{i-1} + x_i)/2\text{.}\)

A Riemann sum is a sum of (possibly signed) areas of rectangles. The value of \(n\) 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 \(f(x) = \frac{1}{20}(x-4)^3 + 7\) on the interval \([1,8]\text{,}\) and use 5 rectangles for each of the Riemann sums.

Part (d) of Example 4.35 explored how to determine if \(\text{LEFT}(n)\) and \(\text{RIGHT}(n)\) are underestimates or overestimates of \(\int_a^b f(x) \, dx\) when \(f(x)\) is increasing. Similar statements can be made when \(f(x)\) is decreasing. These are summarized next.

Error types when approximating area using left and right Riemann sums.

If \(f(x)\) is increasing on \([a,b] \text{,}\) then \(\text{LEFT}(n)\) underestimates \(\int_a^b f(x) \, dx\) and \(\text{RIGHT}(n)\) overestimates \(\int_a^b f(x) \, dx\text{.}\)

If \(f(x)\) is decreasing on \([a,b] \text{,}\) then \(\text{LEFT}(n)\) overestimates \(\int_a^b f(x) \, dx\) and \(\text{RIGHT}(n)\) underestimates \(\int_a^b f(x) \, dx\text{.}\)

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 \(\text{LEFT}(n)\text{,}\)\(\text{RIGHT}(n)\text{,}\) and \(\text{MID}(n)\text{.}\) 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 \(\int_0^3 x^3 \, dx\text{.}\)

with the function \(f(x) = x^3\) on the window of \(x\) values from \(0\) to \(3\) to compute \(\text{LEFT}(3)\text{,}\) the left Riemann sum with three subintervals.

Likewise, use the applet to compute \(\text{RIGHT}(3)\) and \(\text{MID}(3)\text{,}\) the right and middle Riemann sums with three subintervals, respectively.

Use the Fundamental Theorem of Calculus to compute the exact value of \(I = \int_0^3 x^3 \, dx\text{.}\)

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 \(\text{LEFT}(3)\text{?}\) From \(\text{RIGHT}(3)\text{?}\) From \(\text{MID}(3)\text{?}\)

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 \(b_1\) and \(b_2\) and height \(h\text{?}\)

Working by hand, estimate the area under \(f(x) = x^3\) on \([0,3]\) 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)?

In addition to changing \(f(x) \) to \(f(x)=x^3 \) and the number of subintervals to \(3 \text{,}\) 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 \(f(x) \) values from the left side of each sub-interval.

First change \(f(x) \) and the number of subintervals to \(f(x)=x^3\) and \(n=3\text{.}\) For \(\text{RIGHT}(3)\text{,}\) 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 \(f(x) \) values from the right side of each subinterval. For \(\text{MID}(3)\text{,}\) 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 \(f(x) \) values from the middle of each interval.

The left-most trapezoid has base lengths 0 and 1 and height 1, so the area of the first trapezoid is \(\frac{1}{2} (0+1)\cdot 1=\frac{1}{2}\text{.}\) The middle trapezoid has base lengths 1 and 8 and height 1, so the area of the second trapezoid is \(\frac{1}{2}(1+8) \cdot 1=\frac{9}{2} \text{.}\) The right-most trapezoid has base lengths 8 and 27 and height 1, so the area of the third trapezoid is \(\frac{1}{2}(8+27)\cdot 1=\frac{35}{2}\text{.}\) Therefore, the approximate area under the graph of \(f(x)=x^3 \) from \(0 \) to \(3 \) using the trapezoid rule with 3 subintervals is \(\text{TRAP}(3)= \frac{1}{2} + \frac{9}{2} + \frac{35}{2}=\frac{45}{2}=22.5\text{.}\)

The error is \(E_{T,3}=20.25-22.5=-2.25 \text{.}\) Using trapezoids creates a smaller error compared to \(\text{LEFT}(3) \) and \(\text{RIGHT}(3) \text{.}\) The magnitude of the error from approximating using \(\text{MID}(3) \) is half the magnitude of the error from approximating using \(\text{TRAP}(3) \text{,}\) but they have opposite signs.

Subsection5.9.1The Trapezoid Rule

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 \(\text{LEFT}(n)\text{,}\)\(\text{RIGHT}(n)\text{,}\) and \(\text{MID}(n)\) is called the Trapezoid Rule. Rather than using a rectangle to estimate the (signed) area bounded by \(y = f(x)\) 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 \(D_1\text{,}\) the area of the trapezoid on \([x_0, x_1]\text{,}\) we observe that the left base has length \(f(x_0)\text{,}\) while the right base has length \(f(x_1)\text{.}\) The height of the trapezoid is \(x_1 - x_0 = \Delta x = \frac{b-a}{3}\text{.}\) The area of a trapezoid is the average of the bases times the height, so we have

Using similar computations for \(D_2\) and \(D_3\text{,}\) we find that \(\text{TRAP}(3)\text{,}\) the trapezoidal approximation to \(\int_a^b f(x) \, dx\) is given by

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 \(\text{TRAP}(3)\) by removing factors of \(\frac{1}{2}\) and \(\Delta x \text{,}\) grouping the left endpoint and right endpoint evaluations of \(f\text{,}\) we see that

We now observe that two familiar sums have arisen. The left Riemann sum \(\text{LEFT}(3)\) is \(\text{LEFT}(3) = f(x_0) \Delta x + f(x_1) \Delta x + f(x_2) \Delta x\text{,}\) and the right Riemann sum is \(\text{RIGHT}(3) = f(x_1) \Delta x + f(x_2) \Delta x + f(x_3) \Delta x\text{.}\) Substituting \(\text{LEFT}(3)\) and \(\text{RIGHT}(3)\) for the corresponding expressions in Equation (5.18), it follows that \(\text{TRAP}(3) = \frac{\text{LEFT}(3) + \text{RIGHT}(3)}{2} \text{.}\) 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.

The Trapezoid Rule.

The trapezoidal approximation, \(\text{TRAP}(n)\text{,}\) of the definite integral \(\int_a^b f(x) \, dx\) using \(n\) subintervals is given by the rule

In this example, we explore the relationships among the errors generated by left, right, midpoint, and trapezoid approximations to the definite integral \(\int_1^2 \frac{1}{x^2} \, dx\)

Use the First FTC to evaluate \(\int_1^2 \frac{1}{x^2} \, dx\) exactly.

Use appropriate computing technology to compute the following approximations for \(\int_1^2 \frac{1}{x^2} \, dx\text{:}\)\(\text{TRAP}(4)\text{,}\)\(\text{MID}(4)\text{,}\)\(\text{TRAP}(8)\text{,}\) and \(\text{MID}(8)\text{.}\)

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 \(\text{ERROR}(T,4)\) represent the error that results from using the trapezoid rule with 4 subintervals to estimate the integral, we have

Based on your work in (a) and (b) above, compute \(\text{ERROR}(T,4)\text{,}\)\(\text{ERROR}(T,8)\text{,}\)\(\text{ERROR}(M,4)\text{,}\)\(\text{ERROR}(M,8)\text{.}\)

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 \(f(x) = \frac{1}{x^2}\) lead to your observations in (d)?

Hint.

\(\frac{1}{x^2} = x^{-2}\text{.}\)

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.

The table below gives values of the trapezoid rule and corresponding errors for different \(n\)-values.

\(n\)

\(\text{TRAP}(n)\)

\(\text{ERROR}(T,n)\)

\(4\)

\(0.50899\)

\(-0.50899\)

\(8\)

\(0.50227\)

\(-0.50227\)

\(16\)

\(0.50057\)

\(-0.50057\)

The table below gives values of the midpoint rule and corresponding errors for different \(n\)-values.

\(n\)

\(\text{MID}(n)\)

\(\text{ERROR}(M,n)\)

\(4\)

\(0.49555\)

\(0.00445\)

\(8\)

\(0.49887\)

\(0.00113\)

\(16\)

\(0.49972\)

\(0.00028\)

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 \(f(x) = \dfrac{1}{x^2}\) is concave up on the interval \([1, 2]\text{.}\) 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.

Subsection5.9.2Comparing the Midpoint and Trapezoid Rules

We know from the definition of the definite integral that if we let \(n\) be large enough, we can make any of the approximations \(\text{LEFT}(n)\text{,}\)\(\text{RIGHT}(n)\text{,}\) and \(\text{MID}(n)\) as close as we’d like (in theory) to the exact value of \(\int_a^b f(x) \, dx\text{.}\) Thus, it may be natural to wonder why we ever use any rule other than \(\text{LEFT}(n)\) or \(\text{RIGHT}(n)\) (with a sufficiently large \(n\) value) to estimate a definite integral. One of the primary reasons is that as \(n \to \infty\text{,}\)\(\Delta x = \frac{b-a}{n} \to 0\text{,}\) and thus in a Riemann sum calculation with a large \(n\) 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 \(n\text{.}\) 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.

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, \(\text{TRAP}(1)\text{,}\) 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 \(\text{MID}(1)\text{,}\) and this value is less than the exact value of the definite integral. Thus, when the function is concave up on the interval, \(\text{MID}(1)\) underestimates the integral’s true value.

The preceding discussion explores how to determine if \(\text{MID}(n)\) and \(\text{TRAP}(n)\) are underestimates or overestimates of \(\int_a^b f(x) \, dx\) if \(f(x)\) is concave up. Similar statements can be made when \(f(x)\) is concave down. These are summarized next.

Error types when approximating using Midpoint and Trapezoid Rules.

If \(f(x)\) is concave up on \([a,b] \text{,}\) then \(\text{MID}(n)\) underestimates \(\int_a^b f(x) \, dx\) and \(\text{TRAP}(n)\) overestimates \(\int_a^b f(x) \, dx\text{.}\)

If \(f(x)\) is concave down on \([a,b] \text{,}\) then \(\text{MID}(n)\) overestimates \(\int_a^b f(x) \, dx\) and \(\text{TRAP}(n)\) underestimates \(\int_a^b f(x) \, dx\text{.}\)

Next, we compare the size of the errors between \(\text{MID}(n)\) and \(\text{TRAP}(n)\text{.}\) Again, we focus on \(\text{MID}(1)\) and \(\text{TRAP}(1)\) on an interval where the concavity of \(f\) 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.

If we let \(f(x) = 1-x^2\) and consider \(\int_0^1 f(x) \,dx\text{,}\) we know by the First FTC that the exact value of the integral is

Using appropriate technology to compute \(\text{MID}(4)\text{,}\)\(\text{MID}(8)\text{,}\)\(\text{TRAP}(4)\text{,}\) and \(\text{TRAP}(8)\text{,}\) as well as the corresponding errors \(\text{ERROR}(M,4)\text{,}\)\(\text{ERROR}(M,8)\text{,}\)\(\text{ERROR}(T,4)\text{,}\) and \(\text{ERROR}(T,8)\text{,}\) 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 \(\int_1^2 \frac{1}{x^2} \, dx\) from Example 5.78.

Table5.81.Calculations of \(\text{TRAP}(4)\text{,}\)\(\text{MID}(4)\text{,}\)\(\text{TRAP}(8)\text{,}\) and \(\text{MID}(8)\text{,}\) along with corresponding errors, for the definite integrals \(\int_0^1 (1-x^2) \ dx\) and \(\int_1^2 \frac{1}{x^2} \ dx\text{.}\)

Rule

\(\int_0^1 (1-x^2) \,dx = 0.\overline{6}\)

error

\(\int_1^2 \frac{1}{x^2} \, dx = 0.5\)

error

\(\text{TRAP}(4)\)

\(0.65625\)

\(-0.0104166667\)

\(0.5089937642\)

\(0.0089937642\)

\(\text{MID}(4)\)

\(0.671875\)

\(0.0052083333\)

\(0.4955479365\)

\(-0.0044520635\)

\(\text{TRAP}(8)\)

\(0.6640625\)

\(-0.0026041667\)

\(0.5022708502\)

\(0.0022708502\)

\(\text{MID}(8)\)

\(0.66796875\)

\(0.0013020833\)

\(0.4988674899\)

\(-0.0011325101\)

For a given function \(f\) and interval \([a,b]\text{,}\)\(\text{ERROR}(T,4) = \int_a^b f(x) \,dx - \text{TRAP}(4)\) calculates the difference between the exact value of the definite integral and the approximation generated by the Trapezoid Rule with \(n = 4\text{.}\) If we look at not only \(\text{ERROR}(T,4)\text{,}\) but also the other errors generated by using \(\text{TRAP}(n)\) and \(\text{MID}(n)\) with \(n = 4\) and \(n = 8\) 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 \(\text{TRAP}(n)\) and \(\text{MID}(n)\) 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 \(\text{ERROR}(M,4) \approx -\frac{1}{2} \text{ERROR}(T,4)\) and \(\text{ERROR}(M,8) \approx -\frac{1}{2}\text{ERROR}(T,8)\text{.}\) 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.

Subsection5.9.3Simpson’s Rule

When we first developed the Trapezoid Rule, we observed that it is an average of the Left and Right Riemann sums:

If a function is always increasing or always decreasing on the interval \([a,b]\text{,}\) one of \(\text{LEFT}(n)\) and \(\text{RIGHT}(n)\) will over-estimate the true value of \(\int_a^b f(x) \, dx\text{,}\) while the other will under-estimate the integral. Thus, the errors found in \(\text{LEFT}(n)\) and \(\text{RIGHT}(n)\) will have opposite signs; so averaging \(\text{LEFT}(n)\) and \(\text{RIGHT}(n)\) eliminates a considerable amount of the error present in the respective approximations. In a similar way, it makes sense to think about averaging \(\text{MID}(n)\) and \(\text{TRAP}(n)\) in order to generate a still more accurate approximation.

We’ve just observed that \(\text{MID}(n)\) is typically about twice as accurate as \(\text{TRAP}(n)\text{.}\) 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.

Simpson’s Rule.

The Simpson’s Rule approximation \(\text{SIMP}(2n) \) of the area \(\int_a^b f(x) \ dx \) is the weighted average

where \(\text{MID}(n) \) and \(\text{TRAP}(n) \) are the Midpoint and Trapezoid rule approximations using \(n \) subintervals.

Note that we use “\(\text{SIMP}(2n)\)” rather that “\(\text{SIMP}(n)\)” since the \(n\) points the Midpoint Rule uses are different from the \(n\) points the Trapezoid Rule uses, and thus Simpson’s Rule is using \(2n\) 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 \(\text{SIMP}(8) = \frac{2\text{MID}(4) + \text{TRAP}(4)}{3}\) and \(\text{SIMP}(16) = \frac{2\text{MID}(8) + \text{TRAP}(8)}{3}\text{.}\)

Table5.82.Table 5.81 updated to include \(\text{SIMP}(8)\text{,}\)\(\text{SIMP}(16)\text{,}\) and the corresponding errors.

Rule

\(\int_0^1 (1-x^2) \,dx = 0.\overline{6}\)

error

\(\int_1^2 \frac{1}{x^2} \, dx = 0.5\)

error

\(\text{TRAP}(4)\)

\(0.65625\)

\(-0.0104166667\)

\(0.5089937642\)

\(0.0089937642\)

\(\text{MID}(4)\)

\(0.671875\)

\(0.0052083333\)

\(0.4955479365\)

\(-0.0044520635\)

\(\text{SIMP}(8)\)

\(0.6666666667\)

\(0\)

\(0.5000298792\)

\(0.0000298792\)

\(\text{TRAP}(8)\)

\(0.6640625\)

\(-0.0026041667\)

\(0.5022708502\)

\(0.0022708502\)

\(\text{MID}(8)\)

\(0.66796875\)

\(0.0013020833\)

\(0.4988674899\)

\(-0.0011325101\)

\(\text{SIMP}(16)\)

\(0.6666666667\)

\(0\)

\(0.5000019434\)

\(0.0000019434\)

The results seen in Table 5.82 are striking. If we consider the \(\text{SIMP}(16)\) approximation of \(\int_1^2 \frac{1}{x^2} \, dx\text{,}\) the error is only \(\text{ERROR}(S,16) = 0.0000019434\text{.}\) By contrast, \(\text{LEFT}(8) = 0.5491458502\text{,}\) so the error of that estimate is \(\text{ERROR}(L,8) = -0.0491458502\text{.}\) Moreover, we observe that generating the approximations for Simpson’s Rule is almost no additional work: once we have \(\text{LEFT}(n)\text{,}\)\(\text{RIGHT}(n)\text{,}\) and \(\text{MID}(n)\) for a given value of \(n\text{,}\) it is a simple exercise to generate \(\text{TRAP}(n)\text{,}\) and from there to calculate \(\text{SIMP}(2n)\text{.}\) Finally, note that the error in the Simpson’s Rule approximations of \(\int_0^1 (1-x^2) \, dx\) 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 \(\int_0^1 e^{-x^2} \, dx\text{,}\) for which we cannot find an elementary antiderivative of \(e^{-x^2}\text{,}\) 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 \(v\) is continuous, always decreasing, and always decreasing at a decreasing rate, as is suggested by the data.

seconds, \(t\)

Velocity in ft/sec, \(v(t)\)

\(0\)

\(100\)

\(0.3\)

\(99\)

\(0.6\)

\(96\)

\(0.9\)

\(90\)

\(1.2\)

\(80\)

\(1.5\)

\(50\)

\(1.8\)

\(0\)

Table5.84.Data for the braking car.

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 \([0,1.8]\text{?}\)

Estimate the total distance traveled on \([0,1.8]\) by computing \(\text{LEFT}(3)\text{,}\)\(\text{RIGHT}(3)\text{,}\) and \(\text{TRAP}(3)\text{.}\) Which of these under-estimates the true distance traveled?

Estimate the total distance traveled on \([0,1.8]\) by computing \(\text{MID}(3)\text{.}\) 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 \([0,1.8]\text{?}\) Why? What are the units on this quantity?

Hint.

Plot the data.

What are the units of \(v(t) \cdot \Delta t\text{?}\)

Recall the standard rules for sums that produce \(\text{LEFT}(3)\text{,}\)\(\text{RIGHT}(3)\text{,}\)\(\text{TRAP}(3)\text{.}\)

Think about concavity to decide if \(\text{MID}(3)\) is an over- or under-estimate.

Recall how \(\text{SIMP}(3)\) is a weighted average of \(\text{TRAP}(3)\) and \(\text{MID}(3)\text{.}\)

Simpson’s Rule gives the best estimate for a function of consistent concavity.

Answer.

Plot the data.

\(\int_0^{1.8} v(t) dt\text{.}\)

\begin{align*}
\text{LEFT}(3) \amp = 165.6 \text{ ft } \amp \text{RIGHT}(3) \amp = 105.6 \text{ ft } \amp \text{TRAP}(3) \amp = 135.6 \text{ ft }\text{.}
\end{align*}

\(\text{RIGHT}(3)\) and \(\text{TRAP}(3)\) are underestimates.

\(\text{MID}(3) = 143.4 \text{ ft } \) ; overestimate.

\(\text{SIMP}(6) = 140.8 \text{ ft } \text{.}\)

Simpson’s rule gives the best approximation of the distance traveled, \(\int_0^{1.8} v(t) dt \approx 140.8 \text{ ft }\text{.}\)

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 \([0, 1.8]\) is

\begin{align*}
\text{LEFT}(3) \amp = 165.6 \text{ ft } \amp \text{RIGHT}(3) \amp = 105.6 \text{ ft } \amp \text{TRAP}(3) \amp = 135.6 \text{ ft }\text{.}
\end{align*}

\(\text{RIGHT}(3)\) is an underestimate of the distance traveled since \(v(t)\) is decreasing. \(\text{TRAP}(3)\) is an underestimate of the distance traveled since \(v(t)\) is concave down.

Another estimate of the distance traveled is

\begin{equation*}
\text{MID}(3) = 143.4 \text{ ft }\text{.}
\end{equation*}

This is an overestimate since \(v(t)\) is concave down.

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 \(\cdot\) sec = ft. Thus, the best approximation we have generated is that \(\int_0^{1.8} v(t) dt \approx 140.8 \text{ ft }\text{.}\)

Subsection5.9.4Comparing \(\text{LEFT}(n)\text{,}\)\(\text{RIGHT}(n)\text{,}\)\(\text{TRAP}(n)\text{,}\)\(\text{MID}(n)\text{,}\) and \(\text{SIMP}(2n)\text{.}\)

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 \(f(x) = 2-x^2\text{,}\)\(g(x) = 2-x^3\text{,}\) and \(h(x) = 2-x^4\text{,}\) all on the interval \([0,1]\text{.}\) 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 \([0,1]\text{,}\) and compute \(\text{LEFT}(1)\) and \(\text{RIGHT}(1)\) for each. What do you observe?

Compute \(\text{MID}(1)\) for each function to approximate \(\int_0^1 f(x) \,dx\text{,}\)\(\int_0^1 g(x) \,dx\text{,}\) and \(\int_0^1 h(x) \,dx\text{,}\) respectively.

Compute \(\text{TRAP}(1)\) for each of the three functions, and hence compute \(\text{SIMP}(2)\) for each of the three functions.

Evaluate each of the integrals \(\int_0^1 f(x) \,dx\text{,}\)\(\int_0^1 g(x) \,dx\text{,}\) and \(\int_0^1 h(x) \,dx\) exactly using the First FTC.

For each of the three functions \(f\text{,}\)\(g\text{,}\) and \(h\text{,}\) compare the results of \(\text{LEFT}(1)\text{,}\)\(\text{RIGHT}(1)\text{,}\)\(\text{MID}(1)\text{,}\)\(\text{TRAP}(1)\text{,}\) and \(\text{SIMP}(2)\) to the true value of the corresponding definite integral. What patterns do you observe?

Hint.

For each estimate, just one function evaluation is needed.

Use the midpoint rule with \(n=1\text{.}\)

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 \(\text{LEFT}(1)\) and \(\text{TRAP}(1)\text{:}\)

Table5.88.Left and Trapezoid rules.

\(f\)

\(g\)

\(h\)

\(\text{LEFT}(1)=2\)

\(\text{LEFT}(1)=2\)

\(\text{LEFT}(1)=2\)

\(\text{RIGHT}(1)=1\)

\(\text{RIGHT}(1)=1\)

\(\text{RIGHT}(1)=1\)

The values of \(\text{LEFT}(1)\) and \(\text{RIGHT}(1)\) are the same for all three.

For the \(\text{MID}(1)\text{,}\)

Table5.89.Midpoint Rule.

\(f\)

\(g\)

\(h\)

\(\text{MID}(1)=\frac{7}{4}\)

\(\text{MID}(1)=\frac{15}{8}\)

\(\text{MID}(1)=\frac{31}{16}\)

For \(\text{TRAP}(1)\) and \(\text{SIMP}(2)\text{,}\)

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 \(f\) and \(g\text{,}\) while a slight overestimate of \(\int_0^1 h(x) dx\text{.}\)

Solution.

For the left and right endpoint rules, we see that

Table5.91.Left and Trapezoid rules.

\(f\)

\(g\)

\(h\)

\(\text{LEFT}(1)=2\)

\(\text{LEFT}(1)=2\)

\(\text{LEFT}(1)=2\)

\(\text{RIGHT}(1)=1\)

\(\text{RIGHT}(1)=1\)

\(\text{RIGHT}(1)=1\)

Thus, we observe that despite the fact the functions are all different, the values of \(\text{LEFT}(1)\) and \(\text{RIGHT}(1)\) are the same for all three.

For the midpoint rule, we find that

Table5.92.Midpoint Rule.

\(f\)

\(g\)

\(h\)

\(\text{MID}(1)=\frac{7}{4}\)

\(\text{MID}(1)=\frac{15}{8}\)

\(\text{MID}(1)=\frac{31}{16}\)

For the trapezoid rule and Simpson’s rule,

Table5.93.Trapezoid and Simpson’s Rule.

\(f\)

\(g\)

\(h\)

\(\text{TRAP}(1)=\frac{3}{2}\)

\(\text{TRAP}(1)=\frac{3}{2}\)

\(\text{TRAP}(1)=\frac{3}{2}\)

\(\text{SIMP}(2)=\frac{5}{3} \approx 1.6667\)

\(\text{SIMP}(2)=\frac{7}{4}\)

\(\text{SIMP}(2)=\frac{43}{24} \approx 1.79167\)

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 \(f\) and \(g\text{,}\) while Simpson’s rule is a slight overestimate of \(\int_0^1 h(x) dx\text{.}\)

The results seen in Example 5.86 generalize nicely. For instance, if \(f\) is decreasing on \([a,b]\text{,}\)\(\text{LEFT}(n)\) will overestimate the exact value of \(\int_a^b f(x) \,dx\text{,}\) and if \(f\) is concave down on \([a,b]\text{,}\)\(\text{MID}(n)\) 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 \(\text{LEFT}(n)\text{,}\)\(\text{RIGHT}(n)\text{,}\)\(\text{TRAP}(n)\text{,}\) and \(\text{MID}(n)\) 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 \(f\) on a given interval with a quadratic function that shared three values with the function \(f\text{.}\) 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 \(\int_2^5 (5x^3 - 2x^2 + 7x - 4)\, dx\text{,}\) the approximation \(\text{SIMP}(2n)\) will always be exact, regardless of the value of \(n\text{.}\) 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 \(\text{SIMP}(2n)\) benefits from using \(2n+1\) points of data. Because it combines \(\text{MID}(n)\text{,}\) which uses \(n\) midpoints, and \(\text{TRAP}(n)\text{,}\) which uses the \(n+1\) endpoints of the chosen subintervals, \(\text{SIMP}(2n)\) takes advantage of the maximum amount of information we have when we know function values at the endpoints and midpoints of \(n\) subintervals.

Subsection5.9.5Summary

For a definite integral such as \(\int_0^1 e^{-x^2} \, dx\) 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 \(\text{LEFT}(n)\text{,}\)\(\text{RIGHT}(n)\text{,}\) and \(\text{MID}(n)\) for one or more chosen values of \(n\text{.}\)

The Trapezoid Rule, which estimates \(\int_a^b f(x) \, dx\) by using trapezoids, rather than rectangles, can also be viewed as the average of Left and Right Riemann sums. That is, \(\text{TRAP}(n) = \frac{\text{LEFT}(n) + \text{RIGHT}(n)}{2}\text{.}\)

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 \(\text{SIMP}(2n) = \frac{2\text{MID}(n) + \text{TRAP}(n)}{3}\text{,}\) we can build a much more accurate approximation to \(\int_a^b f(x) \, dx\) by using approximations we have already computed. The rule for \(\text{SIMP}(2n)\) 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.

Exercises5.9.6Exercises

1.Various methods for \(e^x\) numerically.

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.)

(a) What is the exact value of \(\int_{0}^{5}\,e^x\,dx\text{?}\)

\(\int_{0}^{5}\,e^x\,dx =\)

(b)

Find LEFT(2), RIGHT(2), TRAP(2), MID(2), and SIMP(2); compute the error for each.

LEFT(2)

RIGHT(2)

TRAP(2)

MID(2)

SIMP(2)

value

error

(c)

Repeat part (b) with \(n=4\) (instead of \(n=2\)).

LEFT(4)

RIGHT(4)

TRAP(4)

MID(4)

SIMP(4)

value

error

(d)

For each rule in part (b), as \(n\) goes from \(n=2\) to \(n=4\text{,}\) does the error go down approximately as you would expect? Explain by calculating the ratios of the errors:

Error LEFT(2)/Error LEFT(4) =

Error RIGHT(2)/Error RIGHT(4) =

Error TRAP(2)/Error TRAP(4) =

Error MID(2)/Error MID(4) =

Error SIMP(2)/Error SIMP(4) =

(Be sure that you can explain in words why these do (or don’t) make sense.)

2.Comparison of methods for increasing concave down function.

Using the figure showing \(f(x)\) below, order the following approximations to the integral \(\int_0^3\,f(x)\,dx\) and its exact value from smallest to largest.

(Click on the graph for a larger version.)

Enter each of "LEFT(n)", "RIGHT(n)", "TRAP(n)", "MID(n)" and "Exact" in one of the following answer blanks to indicate the correct ordering:

\(\lt \)\(\lt \)\(\lt \)\(\lt \)

3.Comparing accuracy for two similar functions.

Using a fixed number of subdivisions, we approximate the integrals of \(f\) and \(g\) on the interval shown in the figure below.

(The function \(f(x)\) is shown in blue, and \(g(x)\) in black; click on the graph to get a larger version.)

For which function, \(f\) or \(g\) is LEFT more accurate?

\(\displaystyle f\)

\(\displaystyle g\)

For which function, \(f\) or \(g\) is RIGHT more accurate?

\(\displaystyle f\)

\(\displaystyle g\)

For which function, \(f\) or \(g\) is MID more accurate?

\(\displaystyle f\)

\(\displaystyle g\)

For which function, \(f\) or \(g\) is TRAP more accurate?

\(\displaystyle f\)

\(\displaystyle g\)

4.Identifying and comparing methods.

Consider the four functions shown below. On the first two, an approximation for \(\int_a^b\,f(x)\,dx\) is shown.

1.

2.

3.

4.

(Click on any graph to get a larger version.)

1. For graph number 1, Which integration method is shown?

left rule

right rule

midpoint rule

trapezoid rule

Is this method an over- or underestimate?

under

over

2. For graph number 2, Which integration method is shown?

midpoint rule

trapezoid rule

right rule

left rule

Is this method an over- or underestimate?

over

under

3. On a copy of graph number 3, sketch an estimate with \(n=2\) subdivisions using the midpoint rule.

Is this method an over- or underestimate?

over

under

4. On a copy of graph number 4, sketch an estimate with \(n=2\) subdivisions using the trapezoid rule.

Is this method an over- or underestimate?

under

over

5.Identifying types of Riemann sums.

a) The rectangles in the graph below illustrate a

left endpoint

right endpoint

midpoint

Riemann sum for \(\displaystyle f(x) = \frac{x^2}{8}\) on the interval \(\lbrack 2, 6 \rbrack\text{.}\)

The value of this Riemann sum is , and this Riemann sum is an

overestimate of

equal to

underestimate of

there is ambiguity

the area of the region enclosed by \(\displaystyle y = f(x)\text{,}\) the x-axis, and the vertical lines x = 2 and x = 6.

Left endpoint Riemann sum for \(y = \frac{x^2}{8}\) on \(\lbrack 2, 6 \rbrack\)

b) The rectangles in the graph below illustrate a

left endpoint

right endpoint

midpoint

Riemann sum for \(\displaystyle f(x) = \frac{x^2}{8}\) on the interval \(\lbrack 2, 6 \rbrack\text{.}\)

The value of this Riemann sum is , and this Riemann sum is an

overestimate of

equal to

underestimate of

there is ambiguity

the area of the region enclosed by \(\displaystyle y = f(x)\text{,}\) the x-axis, and the vertical lines x = 2 and x = 6.

Right endpoint Riemann sum for \(y = \frac{x^2}{8}\) on \(\lbrack 2, 6 \rbrack\)

6.Identifying types of Riemann sums.

The five rectangles in the graph below illustrate a

???

left endpoint

right endpoint

midpoint

(select a description)

Riemann sum for \(\displaystyle f(x) = 2^{x}\) on the interval \([0, 3]\text{.}\)

The value of this Riemann sum is .

Riemann sum for \(y = 2^{x}\) on \(\lbrack 0, 3 \rbrack\)

7.Computing left and right Riemann sums.

On a sketch of \(y = e^{x}\text{,}\) represent the left Riemann sum with \(n = 2\) approximating \(\int_{1}^{2}\,e^{x}\,dx\text{.}\) Write out the terms of the sum, but do not evaluate it:

Sum = +

On another sketch, represent the right Riemann sum with \(n = 2\) approximating \(\int_{1}^{2}\,e^{x}\,dx\text{.}\) Write out the terms of the sum, but do not evaluate it:

Sum = +

Which sum is an overestimate?

the left Riemann sum

the right Riemann sum

neither sum

Which sum is an underestimate?

the right Riemann sum

the left Riemann sum

neither sum

8.Trapezoid rule using data from a table.

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

9.Comparing methods and identifying whether each is an overestimate or underestimate.

Consider the definite integral \(\int_0^1 x \tan(x) \, dx\text{.}\)

Explain why this integral cannot be evaluated exactly by using either \(u\)-substitution or by integrating by parts.

Using appropriate subintervals, compute \(\text{LEFT}(4)\text{,}\)\(\text{RIGHT}(4)\text{,}\)\(\text{MID}(4)\text{,}\)\(\text{TRAP}(4)\text{,}\) and \(\text{SIMP}(8)\text{.}\)

Which of the approximations in (b) is an over-estimate to the true value of \(\int_0^1 x \tan(x) \, dx\text{?}\) Which is an under-estimate? How do you know?

10.Relation of function properties to approximation methods.

For an unknown function \(f(x)\text{,}\) the following information is known.

\(f\) is continuous on \([3,6]\text{;}\)

\(f\) is either always increasing or always decreasing on \([3,6]\text{;}\)

\(f\) has the same concavity throughout the interval \([3,6]\text{;}\)

As approximations to \(\in\text{TRAP}(3)^6 f(x) \, dx\text{,}\)\(\text{LEFT}(4) = 7.23\text{,}\)\(\text{RIGHT}(4) = 6.75\text{,}\) and \(\text{MID}(4) = 7.05\text{.}\)

Is \(f\) increasing or decreasing on \([3,6]\text{?}\) What data tells you?

Is \(f\) concave up or concave down on \([3,6]\text{?}\) Why?

Determine the best possible estimate you can for \(\in\text{TRAP}(3)^6 f(x) \, dx\text{,}\) based on the given information.

11.Modeling flow rate using an integral and approximating solution.

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.

Table5.94.Water flow data.

seconds, \(t\)

\(0\)

\(10\)

\(20\)

\(30\)

\(40\)

\(50\)

\(60\)

flow in TCFS, \(r(t)\)

\(2000\)

\(2100\)

\(2400\)

\(3000\)

\(3900\)

\(5100\)

\(6500\)

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 \(\text{MID}(n)\) for the largest possible value of \(n\) to approximate the integral you stated in (a). Do you think \(\text{MID}(n)\) over- or under-estimates the exact value of the integral? Why?

Approximate the integral stated in (a) by calculating \(\text{SIMP}(n)\) for the largest possible value of \(n\text{,}\) based on the given data.

Compute \(\frac{1}{60} \text{SIMP}(n)\) and \(\frac{2000+2100+2400+3000+3900+5100+6500}{7}\text{.}\) What quantity do both of these values estimate? Which is a more accurate approximation?