## Simpson’s Rule

### Learning Outcomes

• 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 ${\displaystyle\int }_{{x}_{0}}^{{x}_{2}}f\left(x\right)dx$ with ${\displaystyle\int }_{{x}_{0}}^{{x}_{2}}p\left(x\right)dx$, where $p\left(x\right)=A{x}^{2}+Bx+C$ is the quadratic function passing through $\left({x}_{0},f\left({x}_{0}\right)\right)$, $\left({x}_{1},f\left({x}_{1}\right)\right)$, and $\left({x}_{2},f\left({x}_{2}\right)\right)$ (Figure 4). Over the next pair of subintervals we approximate ${\displaystyle\int }_{{x}_{2}}^{{x}_{4}}f\left(x\right)dx$ with the integral of another quadratic function passing through $\left({x}_{2},f\left({x}_{2}\right)\right)$, $\left({x}_{3},f\left({x}_{3}\right)\right)$, and $\left({x}_{4},f\left({x}_{4}\right)\right)$. This process is continued with each successive pair of subintervals.

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:

$\begin{array}{c}f\left({x}_{0}\right)=p\left({x}_{0}\right)=A{x}_{0}{}^{2}+B{x}_{0}+C\hfill \\ f\left({x}_{1}\right)=p\left({x}_{1}\right)=A{x}_{1}{}^{2}+B{x}_{1}+C\hfill \\ f\left({x}_{2}\right)=p\left({x}_{2}\right)=A{x}_{2}{}^{2}+B{x}_{2}+C\hfill \end{array}$

${x}_{2}-{x}_{0}=2\Delta x$, where $\Delta x$ is the length of a subinterval.

${x}_{2}+{x}_{0}=2{x}_{1},\:\text{since}\:{x}_{1}=\frac{\left({x}_{2}+{x}_{0}\right)}{2}$.

Thus,

$\begin{array}{ccccc}\hfill {\displaystyle\int _{{x}_{0}}^{{x}_{2}}f(x)dx}& \approx {\displaystyle\int _{{x}_{0}}^{{x}_{2}}p(x)dx}\hfill & & & \\ & ={\displaystyle\int _{{x}_{0}}^{{x}_{2}}(A{x}^{2}+Bx+C)dx}\hfill & & & \\ & =\frac{A}{3}{x}^{3}+\frac{B}{2}{x}^{2}+Cx|\begin{array}{c}{}^{{x}_{2}} \\ {}_{{x}_{0}}\end{array}\hfill & & & \text{Find the antiderivative.}\hfill \\ & =\frac{A}{3}({x}_{2}{}^{3}-{x}_{0}{}^{3})+\frac{B}{2}({x}_{2}{}^{2}-{x}_{0}{}^{2})+C({x}_{2}-{x}_{0})\hfill & & & \text{Evaluate the antiderivative.}\hfill \\ & =\frac{A}{3}({x}_{2}-{x}_{0})({x}_{2}{}^{2}+{x}_{2}{x}_{0}+{x}_{0}{}^{2})\hfill & & & \\ & +\frac{B}{2}({x}_{2}-{x}_{0})({x}_{2}+{x}_{0})+C({x}_{2}-{x}_{0})\hfill & & & \\ & =\frac{{x}_{2}-{x}_{0}}{6}(2A({x}_{2}{}^{2}+{x}_{2}{x}_{0}+{x}_{0}{}^{2})+3B({x}_{2}+{x}_{0})+6C)\hfill & & & \text{Factor out}\frac{{x}_{2}-{x}_{0}}{6}.\hfill \\ & =\frac{\Delta x}{3}((Ax_{2}^{2}+B{x}_{2}+C)+(A{x}_{0}{}^{2}+B{x}_{0}+C)\hfill & & & \\ & +A({x}_{2}{}^{2}+2{x}_{2}{x}_{0}+{x}_{0}{}^{2})+2B({x}_{2}+{x}_{0})+4C)\hfill & & & \\ & =\frac{\Delta x}{3}(f({x}_{2})+f({x}_{0})+A{({x}_{2}+{x}_{0})}^{2}+2B({x}_{2}+{x}_{0})+4C)\hfill & & & \text{Rearrange the terms.}\hfill \\ & & & & \begin{array}{c}\text{Factor and substitute.}\hfill \\ f({x}_{2})=A{x}_{0}{}^{2}+B{x}_{0}+C\text{and}\hfill \\ f({x}_{0})=A{x}_{0}{}^{2}+B{x}_{0}+C.\hfill \end{array}\hfill \\ & =\frac{\Delta x}{3}(f({x}_{2})+f({x}_{0})+A{(2{x}_{1})}^{2}+2B(2{x}_{1})+4C)\hfill & & & \text{Substitute}{x}_{2}+{x}_{0}=2{x}_{1}.\hfill \\ & =\frac{\Delta x}{3}(f({x}_{2})+4f({x}_{1})+f({x}_{0})).\hfill & & & \begin{array}{c}\text{Expand and substitute}\hfill \\ f({x}_{1})=A{x}_{1}{}^{2}+B{x}_{1}\text{+}.\hfill \end{array}\hfill \end{array}$

If we approximate ${\displaystyle\int }_{{x}_{2}}^{{x}_{4}}f\left(x\right)dx$ using the same method, we see that we have

${\displaystyle\int }_{{x}_{0}}^{{x}_{4}}f\left(x\right)dx\approx \frac{\Delta x}{3}\left(f\left({x}_{4}\right)+4f\left({x}_{3}\right)+f\left({x}_{2}\right)\right)$.

Combining these two approximations, we get

${\displaystyle\int }_{{x}_{0}}^{{x}_{4}}f\left(x\right)dx=\frac{\Delta x}{3}\left(f\left({x}_{0}\right)+4f\left({x}_{1}\right)+2f\left({x}_{2}\right)+4f\left({x}_{3}\right)+f\left({x}_{4}\right)\right)$.

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 $f\left(x\right)$ is continuous over $\left[a,b\right]$. Let n be a positive even integer and $\Delta x=\frac{b-a}{n}$. Let $\left[a,b\right]$ be divided into $n$ subintervals, each of length $\Delta x$, with endpoints at $P=\left\{{x}_{0},{x}_{1},{x}_{2},\ldots ,{x}_{n}\right\}$. Set

${S}_{n}=\frac{\Delta x}{3}\left(f\left({x}_{0}\right)+4f\left({x}_{1}\right)+2f\left({x}_{2}\right)+4f\left({x}_{3}\right)+2f\left({x}_{4}\right)+\cdots +2f\left({x}_{n - 2}\right)+4f\left({x}_{n - 1}\right)+f\left({x}_{n}\right)\right)$.

Then,

$\underset{n\to \text{+}\infty }{\text{lim}}{S}_{n}={\displaystyle\int }_{a}^{b}f\left(x\right)dx$.

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 ${S}_{2n}=\left(\frac{2}{3}\right){M}_{n}+\left(\frac{1}{3}\right){T}_{n}$.

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 $f\left(x\right)$ be a continuous function over $\left[a,b\right]$ having a fourth derivative, ${f}^{\left(4\right)}\left(x\right)$, over this interval. If $M$ is the maximum value of $|{f}^{\left(4\right)}\left(x\right)|$ over $\left[a,b\right]$, then the upper bound for the error in using ${S}_{n}$ to estimate ${\displaystyle\int }_{a}^{b}f\left(x\right)dx$ is given by

$\text{Error in}{S}_{n}\le \frac{M{\left(b-a\right)}^{5}}{180{n}^{4}}$.

### Example: Applying Simpson’s Rule 1

Use ${S}_{2}$ to approximate ${\displaystyle\int }_{0}^{1}{x}^{3}dx$. Estimate a bound for the error in ${S}_{2}$.

### Example: Applying Simpson’s Rule 2

Use ${S}_{6}$ to estimate the length of the curve $y=\frac{1}{2}{x}^{2}$ over $\left[1,4\right]$.

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.

### try it

Use ${S}_{2}$ to estimate ${\displaystyle\int }_{1}^{2}\frac{1}{x}dx$.