Use Simpson’s rule to approximate the value of a definite integral to a given accuracy
With the midpoint rule, we estimated areas of regions under curves by using rectangles. In a sense, we approximated the curve with piecewise constant functions. With the trapezoidal rule, we approximated the curve by using piecewise linear functions. What if we were, instead, to approximate a curve using piecewise quadratic functions? With Simpson’s rule, we do just this. We partition the interval into an even number of subintervals, each of equal width. Over the first pair of subintervals we approximate [latex]{\displaystyle\int }_{{x}_{0}}^{{x}_{2}}f\left(x\right)dx[/latex] with [latex]{\displaystyle\int }_{{x}_{0}}^{{x}_{2}}p\left(x\right)dx[/latex], where [latex]p\left(x\right)=A{x}^{2}+Bx+C[/latex] is the quadratic function passing through [latex]\left({x}_{0},f\left({x}_{0}\right)\right)[/latex], [latex]\left({x}_{1},f\left({x}_{1}\right)\right)[/latex], and [latex]\left({x}_{2},f\left({x}_{2}\right)\right)[/latex] (Figure 4). Over the next pair of subintervals we approximate [latex]{\displaystyle\int }_{{x}_{2}}^{{x}_{4}}f\left(x\right)dx[/latex] with the integral of another quadratic function passing through [latex]\left({x}_{2},f\left({x}_{2}\right)\right)[/latex], [latex]\left({x}_{3},f\left({x}_{3}\right)\right)[/latex], and [latex]\left({x}_{4},f\left({x}_{4}\right)\right)[/latex]. This process is continued with each successive pair of subintervals.
Figure 4. With Simpson’s rule, we approximate a definite integral by integrating a piecewise quadratic function.
To understand the formula that we obtain for Simpson’s rule, we begin by deriving a formula for this approximation over the first two subintervals. As we go through the derivation, we need to keep in mind the following relationships:
The pattern continues as we add pairs of subintervals to our approximation. The general rule may be stated as follows.
Simpson’s Rule
Assume that [latex]f\left(x\right)[/latex] is continuous over [latex]\left[a,b\right][/latex]. Let n be a positive even integer and [latex]\Delta x=\frac{b-a}{n}[/latex]. Let [latex]\left[a,b\right][/latex] be divided into [latex]n[/latex] subintervals, each of length [latex]\Delta x[/latex], with endpoints at [latex]P=\left\{{x}_{0},{x}_{1},{x}_{2},\ldots ,{x}_{n}\right\}[/latex]. Set
Just as the trapezoidal rule is the average of the left-hand and right-hand rules for estimating definite integrals, Simpson’s rule may be obtained from the midpoint and trapezoidal rules by using a weighted average. It can be shown that [latex]{S}_{2n}=\left(\frac{2}{3}\right){M}_{n}+\left(\frac{1}{3}\right){T}_{n}[/latex].
It is also possible to put a bound on the error when using Simpson’s rule to approximate a definite integral. The bound in the error is given by the following rule:
Rule: Error Bound for Simpson’s Rule
Let [latex]f\left(x\right)[/latex] be a continuous function over [latex]\left[a,b\right][/latex] having a fourth derivative, [latex]{f}^{\left(4\right)}\left(x\right)[/latex], over this interval. If [latex]M[/latex] is the maximum value of [latex]|{f}^{\left(4\right)}\left(x\right)|[/latex] over [latex]\left[a,b\right][/latex], then the upper bound for the error in using [latex]{S}_{n}[/latex] to estimate [latex]{\displaystyle\int }_{a}^{b}f\left(x\right)dx[/latex] is given by
Use [latex]{S}_{2}[/latex] to approximate [latex]{\displaystyle\int }_{0}^{1}{x}^{3}dx[/latex]. Estimate a bound for the error in [latex]{S}_{2}[/latex].
Show Solution
Since [latex]\left[0,1\right][/latex] is divided into two intervals, each subinterval has length [latex]\Delta x=\frac{1 - 0}{2}=\frac{1}{2}[/latex]. The endpoints of these subintervals are [latex]\left\{0,\frac{1}{2},1\right\}[/latex]. If we set [latex]f\left(x\right)={x}^{3}[/latex], then
[latex]{S}_{4}=\frac{1}{3}\cdot \frac{1}{2}\left(f\left(0\right)+4f\left(\frac{1}{2}\right)+f\left(1\right)\right)=\frac{1}{6}\left(0+4\cdot \frac{1}{8}+1\right)=\frac{1}{4}[/latex]. Since [latex]{f}^{\left(4\right)}\left(x\right)=0[/latex] and consequently [latex]M=0[/latex], we see that
[latex]\text{Error in }{S}_{2}\le \frac{0{\left(1\right)}^{5}}{180\cdot {2}^{4}}=0[/latex].
This bound indicates that the value obtained through Simpson’s rule is exact. A quick check will verify that, in fact, [latex]{\displaystyle\int }_{0}^{1}{x}^{3}dx=\frac{1}{4}[/latex].
Example: Applying Simpson’s Rule 2
Use [latex]{S}_{6}[/latex] to estimate the length of the curve [latex]y=\frac{1}{2}{x}^{2}[/latex] over [latex]\left[1,4\right][/latex].
Show Solution
The length of [latex]y=\frac{1}{2}{x}^{2}[/latex] over [latex]\left[1,4\right][/latex] is [latex]{\displaystyle\int }_{1}^{4}\sqrt{1+{x}^{2}}dx[/latex]. If we divide [latex]\left[1,4\right][/latex] into six subintervals, then each subinterval has length [latex]\Delta x=\frac{4 - 1}{6}=\frac{1}{2}[/latex], and the endpoints of the subintervals are [latex]\left\{1,\frac{3}{2},2,\frac{5}{2},3,\frac{7}{2},4\right\}[/latex]. Setting [latex]f\left(x\right)=\sqrt{1+{x}^{2}}[/latex],
Watch the following video to see the worked solution to Example: Applying Simpson’s Rule 2
For closed captioning, open the video on its original page by clicking the Youtube logo in the lower right-hand corner of the video display. In YouTube, the video will begin at the same starting point as this clip, but will continue playing until the very end.