<img src="https://d5nxst8fruw4z.cloudfront.net/atrk.gif?account=iA1Pi1a8Dy00ym" style="display:none" height="1" width="1" alt="" />
You are reading an older version of this FlexBook® textbook: CK-12 Calculus Go to the latest version.

# 4.8: Numerical Integration

Difficulty Level: At Grade Created by: CK-12

## Learning Objectives

• Use the Trapezoidal Rule to solve problems
• Estimate errors for the Trapezoidal Rule
• Use Simpson’s Rule to solve problems
• Estimate Errors for Simpson’s Rule

## Introduction

Recall that we used different ways to approximate the value of integrals. These included Riemann Sums using left and right endpoints, as well as midpoints for finding the length of each rectangular tile. In this lesson we will learn two other methods for approximating integrals. The first of these, the Trapezoidal Rule, uses areas of trapezoidal tiles to approximate the integral. The second method, Simpson’s Rule, uses parabolas to make the approximation.

Trapezoidal Rule

Let’s recall how we would use the midpoint rule with n=4\begin{align*}n = 4\end{align*} rectangles to approximate the area under the graph of f(x)=x2+1\begin{align*}f(x) = x^2 + 1\end{align*} from x=0\begin{align*}x = 0\end{align*} to x=1.\begin{align*}x = 1.\end{align*}

If instead of using the midpoint value within each sub-interval to find the length of the corresponding rectangle, we could have instead formed trapezoids by joining the maximum and minimum values of the function within each sub-interval:

The area of a trapezoid is A=h(b1+b2)2\begin{align*} A = \frac{h(b_1 + b_2)} {2}\end{align*} , where b1\begin{align*}b_1\end{align*} and b2\begin{align*}b_2\end{align*} are the lengths of the parallel sides and h\begin{align*}h\end{align*} is the height. In our trapezoids the height is x\begin{align*}\triangle x\end{align*} and b1\begin{align*}b_1\end{align*} and b2\begin{align*}b_2\end{align*} are the values of the function. Therefore in finding the areas of the trapezoids we actually average the left and right endpoints of each sub-interval. Therefore a typical trapezoid would have the area

A=x2(f(xi1)+f(xi)).

To approximate baf(x)dx\begin{align*} \int_a^b f(x)dx\end{align*} with n\begin{align*}n\end{align*} of these trapezoids, we have

baf(x)dx12[i=1nf(xi1)x+i=1nf(xi)x]=x2[f(x0)+f(x1)+f(x1)+f(x2)+f(x2)++f(xn1)+f(xn)]=x2[f(x0)+2f(x1)+2f(x2)++2f(xn1)+f(xn)],x=ban.

Example 1:

Use the Trapezoidal Rule to approximate \begin{align*}\int_{0}^{3} x^2 dx\end{align*} with \begin{align*}n = 6\end{align*}.

Solution:

We find \begin{align*}\triangle x = \frac{b-a}{n} = \frac{3-0}{6} = \frac{1}{2}.\end{align*}

Of course, this estimate is not nearly as accurate as we would like. For functions such as \begin{align*}f(x) = x^2,\end{align*} we can easily find an antiderivative with which we can apply the Fundamental Theorem that \begin{align*}\int_{0}^{3} x^2dx = \frac{x^3}{3}\Bigg]_0^3 = 9.\end{align*} But it is not always easy to find an antiderivative. Indeed, for many integrals it is impossible to find an antiderivative. Another issue concerns the questions about the accuracy of the approximation. In particular, how large should we take n so that the Trapezoidal Estimate for \begin{align*}\int_{0}^{3} x^2 dx\end{align*} is accurate to within a given value, say \begin{align*}0.001\end{align*}? As with our Linear Approximations in the Lesson on Approximation Errors, we can state a method that ensures our approximation to be within a specified value.

Error Estimates for Simpson's Rule

We would like to have confidence in the approximations we make. Hence we can choose \begin{align*}n\end{align*} to ensure that the errors are within acceptable boundaries. The following method illustrates how we can choose a sufficiently large \begin{align*}n.\end{align*}

Suppose \begin{align*}|f''(x)| \le k\end{align*} for \begin{align*}a \le x \le b.\end{align*} Then the error estimate is given by

Example 2:

Find \begin{align*}n\end{align*} so that the Trapezoidal Estimate for \begin{align*}\int_{0}^{3}x^2dx\end{align*} is accurate to \begin{align*}0.001.\end{align*}

Solution:

We need to find \begin{align*}n\end{align*} such that \begin{align*}|Error_{Trapezoidal}| \le 0.001.\end{align*} We start by noting that \begin{align*}|f''(x)| = 2\end{align*} for \begin{align*}0 \le x \le 3.\end{align*} Hence we can take \begin{align*}k = 2\end{align*} to find our error bound.

We need to solve the following inequality for \begin{align*}n\end{align*}:

Hence we must take \begin{align*}n = 68\end{align*} to achieve the desired accuracy.

From the last example, we see one of the weaknesses of the Trapezoidal Rule—it is not very accurate for functions where straight line segments (and trapezoid tiles) do not lead to a good estimate of area. It is reasonable to think that other methods of approximating curves might be more applicable for some functions. Simpson’s Rule is a method that uses parabolas to approximate the curve.

Simpson’s Rule:

As was true with the Trapezoidal Rule, we divide the interval \begin{align*}[a,b]\end{align*} into \begin{align*}n\end{align*} sub-intervals of length \begin{align*}\triangle x = \frac{b-a}{n}.\end{align*} We then construct parabolas through each group of three consecutive points on the graph. The graph below shows this process for the first three such parabolas for the case of \begin{align*}n = 6\end{align*} sub-intervals. You can see that every interval except the first and last contains two estimates, one too high and one too low, so the resulting estimate will be more accurate.

Using parabolas in this way produces the following estimate of the area from Simpson’s Rule:

We note that it has a similar appearance to the Trapezoidal Rule. However, there is one distinction we need to note. The process of using three consecutive \begin{align*}x_i\end{align*} to approximate parabolas will require that we assume that \begin{align*}n\end{align*} must always be an even number.

Error Estimates for the Trapezoidal Rule

As with the Trapezoidal Rule, we have a formula that suggests how we can choose \begin{align*}n\end{align*} to ensure that the errors are within acceptable boundaries. The following method illustrates how we can choose a sufficiently large \begin{align*}n.\end{align*}

Suppose \begin{align*}|f^4(x)| \le k\end{align*} for \begin{align*}a \le x \le b.\end{align*} Then the error estimate is given by

Example 3:

a. Use Simpson’s Rule to approximate \begin{align*}\int_{1}^{4}\frac{1}{x}dx\end{align*} with \begin{align*}n = 6\end{align*}.

Solution:

We find \begin{align*}\triangle x = \frac{b-a}{n} = \frac{4-1}{6} = \frac{1}{2}.\end{align*}

This turns out to be a pretty good estimate, since we know that

Therefore the error is less than \begin{align*}0.01\end{align*}.

b. Find \begin{align*}n\end{align*} so that the Simpson Rule Estimate for \begin{align*}\int_{1}^{4} \frac{1}{x}dx\end{align*} is accurate to \begin{align*}0.001.\end{align*}

Solution:

We need to find \begin{align*}n\end{align*} such that \begin{align*}|Error_{simpson}| \le 0.001.\end{align*} We start by noting that \begin{align*}\left|f^4(x)\right| = \left|\frac{24}{x^5}\right|\end{align*} for \begin{align*}1 \le x \le 4.\end{align*} Hence we can take \begin{align*}K = 24\end{align*} to find our error bound:

Hence we need to solve the following inequality for \begin{align*}n\end{align*}:

We find that

Hence we must take \begin{align*}n = 14\end{align*} to achieve the desired accuracy.

Technology Note: Estimating a Definite Integral with a TI-83/84 Calculator

We will estimate the value of \begin{align*} \int_1^4 \frac{1} {x}dx\end{align*} .

1. Graph the function \begin{align*} f(x) = \frac{1} {x}\end{align*} with the [WINDOW] setting shown below.
2. The graph is shown in the second screen.
3. Press 2nd [CALC] and choose option 7 (see menu below)
4. When the fourth screen appears, press [1] [ENTER] then [4] [ENTER] to enter the lower and upper limits.
5. The final screen gives the estimate, which is accurate to 7 decimal places.

## Lesson Summary

1. We used the Trapezoidal Rule to solve problems.
2. We estimated errors for the Trapezoidal Rule.
3. We used Simpson’s Rule to solve problems.
4. We estimated Errors for Simpson’s Rule.

For video presentations of Simpson's Rule (21.0), see Simpson's Rule, Approximate Integration (7:21)

## Review Questions

1. Use the Trapezoidal Rule to approximate \begin{align*}\int_{0}^{1}x^2 e^{-x} dx\end{align*} with \begin{align*}n = 8.\end{align*}
2. Use the Trapezoidal Rule to approximate \begin{align*}\int_{1}^{4}{ \ln}\sqrt {x} dx \end{align*} with \begin{align*}n = 6.\end{align*}
3. Use the Trapezoidal Rule to approximate \begin{align*}\int_{0}^{1}\sqrt {1+x^4} dx \end{align*} with \begin{align*}n = 4.\end{align*}
4. Use the Trapezoidal Rule to approximate \begin{align*}\int_{1}^{3}\frac {1}{x} dx \end{align*} with \begin{align*}n = 8.\end{align*}
5. How large should you take \begin{align*}n\end{align*} so that the Trapezoidal Estimate for \begin{align*}\int_{1}^{3}\frac {1}{x} dx \end{align*} is accurate to within \begin{align*}0.001\end{align*}?
6. Use Simpson’s Rule to approximate \begin{align*}\int_{0}^{1}x^2 e^{-x} dx\end{align*} with \begin{align*}n = 8.\end{align*}
7. Use Simpson’s Rule to approximate \begin{align*}\int_{1}^{4}\sqrt {x}\ {\ln}\ x dx \end{align*} with \begin{align*}n = 6.\end{align*}
8. Use Simpson’s Rule to approximate \begin{align*}\int_{0}^{2}\frac {1}{\sqrt {x^4+1}} dx \end{align*} with \begin{align*}n = 6.\end{align*}
9. Use Simpson’s Rule to approximate \begin{align*}\int_{0}^{1} \sqrt {1+x^4} dx \end{align*} with \begin{align*}n = 4.\end{align*}
10. How large should you take \begin{align*}n\end{align*} so that the Simpson Estimate for \begin{align*}\int_{0}^{2} {e} dx \end{align*} is accurate to within \begin{align*}0.00001\end{align*}?

1. \begin{align*}\int_{0}^{1}x^2 e^{-x} dx \approx 0.16\end{align*}
2. \begin{align*}\int_{1}^{4}{ \ln}\sqrt {x} dx \approx 1.26\end{align*}
3. \begin{align*}\int_{0}^{1}\sqrt {1+x^4} dx \approx 1.10\end{align*}
4. \begin{align*}\int_{1}^{3}\frac {1}{x} dx \approx 1.10\end{align*}
5. Take \begin{align*}n = 37\end{align*}
6. \begin{align*}\int_{0}^{1}x^2 e^{-x} dx \approx 0.16\end{align*}
7. \begin{align*}\int_{1}^{4}\sqrt {x} { \ln}\ x dx \approx 4.28 \end{align*}
8. \begin{align*}\int_{0}^{2}\frac {1}{\sqrt {x^4+1}} dx \approx 1.36\end{align*}
9. \begin{align*}\int_{0}^{1} \sqrt {1+x^4} dx \approx 1.09 \end{align*}
10. Take \begin{align*}n = 1\end{align*}

## Texas Instruments Resources

In the CK-12 Texas Instruments Calculus FlexBook, there are graphing calculator activities designed to supplement the objectives for some of the lessons in this chapter. See http://www.ck12.org/flexr/chapter/9729.

## Date Created:

Feb 23, 2012

Aug 19, 2015
Files can only be attached to the latest version of section

# Reviews

Help us create better content by rating and reviewing this modality.