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

This figure has two graphs, both of the same non-negative function in the first quadrant. The function increases and decreases. The quadrant is divided into a grid. The first graph, beginning on the x-axis at the point labeled x sub 0, there are trapezoids shaded whose heights are represented by the function p(x), which is a curve following an approximate path of the original graph. The x-axis is scaled by increments of x sub 0, x sub 1, x sub 2. The second graph has on the x-axis at the point labeled x sub 0. There are shaded regions under the curve, divided by x sub 0, x sub 1, x sub 2, x sub 3, and x sub 4. The curve is sectioned into two different parts above the shaded areas. These two parts are labeled p sub 1(x) and p sub 2(x).

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:

[latex]\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}[/latex]


[latex]{x}_{2}-{x}_{0}=2\Delta x[/latex], where [latex]\Delta x[/latex] is the length of a subinterval.




[latex]\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}[/latex]


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

[latex]{\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)[/latex].


Combining these two approximations, we get

[latex]{\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)[/latex].


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

[latex]{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)[/latex].



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


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

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


Example: Applying Simpson’s Rule 1

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

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

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.

You can view the transcript for this segmented clip of “3.6.5” here (opens in new window).

try it

Use [latex]{S}_{2}[/latex] to estimate [latex]{\displaystyle\int }_{1}^{2}\frac{1}{x}dx[/latex].

Try It