# Simpson’s Rule

Simpson’s Rule is a numerical method that approximates the value of a definite integral by using quadratic functions.

This method is named after the English mathematician Thomas Simpson $$\left( {1710 – 1761} \right).$$

Simpson’s Rule is based on the fact that given three points, we can find the equation of a quadratic through those points.

To obtain an approximation of the definite integral $$\int\limits_a^b {f\left( x \right)dx}$$ using Simpson’s Rule, we partition the interval $$\left[ {a,b} \right]$$ into an even number $$n$$ of subintervals, each of width

${\Delta x = \frac{{b – a}}{n}.}$

On each pair of consecutive subintervals $$\left[ {{x_{i – 1}},{x_i}} \right],$$ $$\left[ {{x_i},{x_{i + 1}}} \right],$$ we consider a quadratic function $$y = a{x^2} + bx + c$$ such that it passes through the points $$\left( {{x_{i – 1}},f\left( {{x_{i – 1}}} \right)} \right),$$ $$\left( {{x_i},f\left( {{x_i}} \right)} \right),$$ $$\left( {{x_{i + 1}},f\left( {{x_{i + 1}}} \right)} \right).$$

If the function $$f\left( x \right)$$ is continuous on $$\left[ {a,b} \right],$$ then

${\int\limits_a^b {f\left( x \right)dx} }\approx{ {\frac{{\Delta x}}{3}}\left[ {f\left( {{x_0}} \right) + 4f\left( {{x_1}} \right) }\right.}+{\left.{ 2f\left( {{x_2}} \right) + 4f\left( {{x_3}} \right) }\right.}+{\left.{ 2f\left( {{x_4}} \right) + \cdots }\right.}+{\left.{ 4f\left( {{x_{n – 1}}} \right) + f\left( {{x_n}} \right)} \right].}$

The coefficients in Simpson’s Rule have the following pattern:

${\underbrace {1,4,2,4,2, \ldots ,4,2,4,1}_{{n + 1}\;\text{points}}.}$

## Solved Problems

Click or tap a problem to see the solution.

### Example 1

Use Simpson’s Rule with $$n = 4$$ to approximate the integral $$\int\limits_0^8 {\sqrt x dx}.$$

### Example 2

A function $$f\left( x \right)$$ is given by the table of values. Approximate the area under the curve $$y = f\left( x \right)$$ between $$x = 0$$ and $$x = 4$$ using Simpson’s Rule with $$n = 4$$ subintervals.

### Example 3

A function $$f\left( x \right)$$ is given as a table of values. Approximate the area under the curve $$y = f\left( x \right)$$ from $$x = -4$$ and $$x = 8$$ using Simpson’s Rule with $$n = 6$$ subintervals.

### Example 4

Approximate the area under the curve $$y = f\left( x \right)$$ between $$x = -1$$ and $$x = 5$$ using Simpson’s Rule with $$n = 6$$ subintervals.

### Example 5

Approximate the area under the curve $$y = {3^x}$$ between $$x = -2$$ and $$x = 2$$ using Simpson’s Rule with $$n = 4$$ subintervals.

### Example 6

Approximate the integral $$\int\limits_1^2 {\large{\frac{{dx}}{x}}\normalsize}$$ using Simpson’s Rule with $$n = 2$$ subintervals.

### Example 7

Approximate the integral $$\int\limits_0^2 {{x^3}dx}$$ using Simpson’s Rule with $$n = 4$$ subintervals.

### Example 8

Using Simpson’s Rule with $$n = 4$$ subintervals, evaluate the integral $$\int\limits_0^1 {{e^x}dx}.$$ Round the answer to $$3$$ decimal places.

### Example 9

Using Simpson’s Rule with $$n = 2$$ subintervals, evaluate the integral $$\int\limits_1^3 {\ln xdx}.$$ Round the answer to $$3$$ decimal places.

### Example 10

Using Simpson’s Rule with $$n = 4$$ subintervals approximate the area under the sine curve $$f\left( x \right) = \sin x$$ between $$x = 0$$ and $$x = \pi.$$

### Example 11

Using Simpson’s Rule with $$n = 4$$ subintervals approximate the area under the inverse cosine curve $$f\left( x \right) = \arccos x$$ between $$x = -1$$ and $$x = 1.$$

### Example 1.

Use Simpson’s Rule with $$n = 4$$ to approximate the integral $$\int\limits_0^8 {\sqrt x dx}.$$

Solution.

It is easy to see that the width of each subinterval is

${\Delta x = \frac{{b – a}}{n} = \frac{{8 – 0}}{4} = 2,}$

and the endpoints $${x_i}$$ have coordinates

${x_i} = \left\{ {0,2,4,6,8} \right\}.$

Calculate the function values at the points $${x_i}:$$

${f\left( {{x_0}} \right) = f\left( 0 \right) = \sqrt 0 = 0;}$

${f\left( {{x_1}} \right) = f\left( 2 \right) = \sqrt 2 ;}$

${f\left( {{x_2}} \right) = f\left( 4 \right) = \sqrt 4 = 2;}$

${f\left( {{x_3}} \right) = f\left( 6 \right) = \sqrt 6 ;}$

${f\left( {{x_4}} \right) = f\left( 8 \right) = \sqrt 8 = 2\sqrt 2 .}$

Substitute all these values into the Simpson’s Rule formula:

${\int\limits_0^8 {\sqrt x dx} }\approx{ \frac{{\Delta x}}{3}\left[ {f\left( {{x_0}} \right) + 4f\left( {{x_1}} \right) }\right.}+{\left.{ 2f\left( {{x_2}} \right) + 4f\left( {{x_3}} \right) }\right.}+{\left.{ f\left( {{x_4}} \right)} \right] }={ \frac{2}{3}\left[ {0 + 4 \cdot \sqrt 2 + 2 \cdot 2 }\right.}+{\left.{ 4 \cdot \sqrt 6 + 2\sqrt 2 } \right] }={ \frac{2}{3}\left[ {6\sqrt 2 + 4 + 4\sqrt 6 } \right] }\approx{ 14.86}$

The true solution for the integral is

${\int\limits_0^8 {\sqrt x dx} }={ \int\limits_0^8 {{x^{\frac{1}{2}}}dx} }={ \left[ {\frac{{{x^{\frac{3}{2}}}}}{{\frac{3}{2}}}} \right]_0^8 }={ \frac{2}{3}\left[ {\sqrt {{x^3}} } \right]_0^8 }={ \frac{2}{3}\sqrt {{8^3}} }={ \frac{2}{3}\sqrt {{2^9}} }={ \frac{2}{3} \cdot 16\sqrt 2 }={ \frac{{32\sqrt 2 }}{3} }\approx{ 15.08}$

Hence, the error in approximating the integral is

${\left| \varepsilon \right| = \left| {\frac{{15.08 – 14.86}}{{15.08}}} \right| }\approx{ 0.015 }={ 1.5\%}$

### Example 2.

A function $$f\left( x \right)$$ is given by the table of values. Approximate the area under the curve $$y = f\left( x \right)$$ between $$x = 0$$ and $$x = 4$$ using Simpson’s Rule with $$n = 4$$ subintervals.

Solution.

For $$n= 4$$ subintervals, Simpson’s rule is given by the following equation:

${{S_4} = \frac{{\Delta x}}{3}\left[ {f\left( {{x_0}} \right) + 4f\left( {{x_1}} \right) }\right.}+{\left.{ 2f\left( {{x_2}} \right) + 4f\left( {{x_3}} \right) + f\left( {{x_4}} \right)} \right].}$

The width of the subinterval is

$\Delta x = \frac{{b – a}}{n} = \frac{{4 – 0}}{4} = 1.$

Substitute the values of the function from the table and calculate the approximate value of the area under the curve:

${A = {S_4} }\approx{ \frac{1}{3}\left[ {2 + 4 \cdot 7 + 2 \cdot 12 + 4 \cdot 10 + 5} \right] }={ \frac{1}{3}\left[ {2 + 28 + 24 + 40 + 5} \right] }={ \frac{1}{3} \cdot 99 }={ 33}$

### Example 3.

A function $$f\left( x \right)$$ is given as a table of values. Approximate the area under the curve $$y = f\left( x \right)$$ from $$x = -4$$ and $$x = 8$$ using Simpson’s Rule with $$n = 6$$ subintervals.

Solution.

We use Simpson’s rule formula which has the following form for $$n = 6$$ subintervals:

${{S_6} = \frac{{\Delta x}}{3}\left[ {f\left( {{x_0}} \right) + 4f\left( {{x_1}} \right) }\right.}+{\left.{ 2f\left( {{x_2}} \right) + 4f\left( {{x_3}} \right) + 2f\left( {{x_4}} \right) }\right.}+{\left.{ 4f\left( {{x_5}} \right) + f\left( {{x_6}} \right)} \right].}$

Determine the width $$\Delta x$$ of the subinterval:

$\Delta x = \frac{{b – a}}{n} = \frac{{8 – \left( { – 4} \right)}}{6} = 2.$

Using the values of the function given in the table, we calculate the approximate value of the area under the curve.

${A = {S_6} \approx \frac{2}{3}\left[ {1 + 4 \cdot 3 + 2 \cdot 4 }\right.}+{\left.{ 4 \cdot 4 + 2 \cdot 6 }\right.}+{\left.{ 4 \cdot 9 + 14} \right] }={ \frac{2}{3}\left[ {1 + 12 + 8 + 16 }\right.}+{\left.{ 12 + 36 + 14} \right] }={ \frac{2}{3} \cdot 99 }={ 66}$

### Example 4.

Approximate the area under the curve $$y = f\left( x \right)$$ between $$x = -1$$ and $$x = 5$$ using Simpson’s Rule with $$n = 6$$ subintervals.

Solution.

The Simpson’s Rule formula for $$n = 6$$ subintervals is given by

${{S_6} = \frac{{\Delta x}}{3}\left[ {f\left( {{x_0}} \right) + 4f\left( {{x_1}} \right) }\right.}+{\left.{ 2f\left( {{x_2}} \right) + 4f\left( {{x_3}} \right) + 2f\left( {{x_4}} \right) }\right.}+{\left.{ 4f\left( {{x_5}} \right) + f\left( {{x_6}} \right)} \right].}$

It follows from the figure that $$\Delta x = 1.$$ The function values at the endpoints of the intervals are

$f\left( {{x_0}} \right) = f\left( -1 \right) = 4;$

$f\left( {{x_1}} \right) = f\left( 0 \right) = 3;$

$f\left( {{x_2}} \right) = f\left( 1 \right) = 2;$

$f\left( {{x_3}} \right) = f\left( 2 \right) = 3;$

$f\left( {{x_4}} \right) = f\left( 3 \right) = 6;$

$f\left( {{x_5}} \right) = f\left( 4 \right) = 6;$

$f\left( {{x_6}} \right) = f\left( 5 \right) = 4.$

So, the approximate value of the area under the curve is

${A = {S_6} \approx \frac{1}{3}\left[ {4 + 4 \cdot 3 + 2 \cdot 2 }\right.}+{\left.{ 4 \cdot 3 + 2 \cdot 6 }\right.}+{\left.{ 4 \cdot 6 + 4} \right] }={ \frac{1}{3}\left[ {4 + 12 + 4 + 12 }\right.}+{\left.{ 12 + 24 + 4} \right] }={ \frac{1}{3} \cdot 72 }={ 24}$

### Example 5.

Approximate the area under the curve $$y = {3^x}$$ between $$x = -2$$ and $$x = 2$$ using Simpson’s Rule with $$n = 4$$ subintervals.

Solution.

The Simpson’s Rule formula formula for $$n = 4$$ is written in the form

${{S_4} = \frac{{\Delta x}}{3}\left[ {f\left( {{x_0}} \right) + 4f\left( {{x_1}} \right) }\right.}+{\left.{ 2f\left( {{x_2}} \right) + 4f\left( {{x_3}} \right) }\right.}+{\left.{ f\left( {{x_4}} \right)} \right].}$

We calculate the function values $$f\left( {{x_i}} \right):$$

$f\left( {{x_0}} \right) = f\left( {-2} \right) = {3^{ – 2}} = \frac{1}{9};$

$f\left( {{x_1}} \right) = f\left( {-1} \right) = {3^{ – 1}} = \frac{1}{3};$

$f\left( {{x_2}} \right) = f\left( 0 \right) = {3^0} = 1;$

$f\left( {{x_3}} \right) = f\left( 1 \right) = {3^1} = 3;$

$f\left( {{x_4}} \right) = f\left( 2 \right) = {3^2} = 9.$

As $$\Delta x = 1,$$ we obtain

${A = {S_4} }\approx{ \frac{1}{3}\left[ {\frac{1}{9} + 4 \cdot \frac{1}{3} + 2 \cdot 1 }\right.}+{\left.{ 4 \cdot 3 + 9} \right] }={ \frac{1}{3}\left[ {\frac{1}{9} + \frac{4}{3} + 23} \right] }={ \frac{1}{3} \cdot \frac{{1 + 12 + 207}}{9} }={ \frac{{220}}{{27}} }={ 8\frac{4}{{27}}.}$

### Example 6.

Approximate the integral $$\int\limits_1^2 {\large{\frac{{dx}}{x}}\normalsize}$$ using Simpson’s Rule with $$n = 2$$ subintervals.

Solution.

The Simpson’s Rule formula with $$n = 2$$ subintervals is given by

${{S_2} = \frac{{\Delta x}}{3}\left[ {f\left( {{x_0}} \right) + 4f\left( {{x_1}} \right) }\right.}+{\left.{ f\left( {{x_2}} \right)} \right].}$

The width of the subinterval is

${\Delta x = \frac{{b – a}}{n} }={ \frac{{2 – 1}}{2} }={ \frac{1}{2}.}$

Calculate the values of the function at the points $${x_i} = \left\{ {1,\large{\frac{3}{2}}\normalsize,2} \right\}:$$

$f\left( {{x_0}} \right) = f\left( 1 \right) = \frac{1}{1} = 1;$

$f\left( {{x_1}} \right) = f\left( {\frac{3}{2}} \right) = \frac{1}{{\frac{3}{2}}} = \frac{2}{3};$

$f\left( {{x_2}} \right) = f\left( 2 \right) = \frac{1}{2}.$

Then

${\int\limits_1^2 {\frac{{dx}}{x}} \approx {S_2} \text{ = }}\kern0pt{ \frac{{\Delta x}}{3}\left[ {f\left( {{x_0}} \right) + 4f\left( {{x_1}} \right) + f\left( {{x_2}} \right)} \right] }={ \frac{1}{6}\left[ {1 + 4 \cdot \frac{2}{3} + \frac{1}{2}} \right] }={ \frac{1}{6} \cdot \frac{{6 + 16 + 3}}{6} }={ \frac{{25}}{{36}}.}$

### Example 7.

Approximate the integral $$\int\limits_0^2 {{x^3}dx}$$ using Simpson’s Rule with $$n = 4$$ subintervals.

Solution.

The Simpson’s Rule formula for $$n = 4$$ subintervals has the form

${{S_4} = \frac{{\Delta x}}{3}\left[ {f\left( {{x_0}} \right) + 4f\left( {{x_1}} \right) }\right.}+{\left.{ 2f\left( {{x_2}} \right) + 4f\left( {{x_3}} \right) + 2\left( {{x_4}} \right)} \right].}$

Determine the width of the subinterval:

${\Delta x = \frac{{b – a}}{n} }={ \frac{{2 – 0}}{4} }={ \frac{1}{2}.}$

The values of the cubic function at the points $${x_i} = \left\{ {0,\large{\frac{1}{2}}\normalsize,1,\large{\frac{3}{2}}\normalsize,2} \right\}$$ are

$f\left( {{x_0}} \right) = f\left( 0 \right) = {0^3} = 0;$

$f\left( {{x_1}} \right) = f\left( {\frac{1}{2}} \right) = {\left( {\frac{1}{2}} \right)^3} = \frac{1}{8};$

$f\left( {{x_2}} \right) = f\left( 1 \right) = {1^3} = 1;$

$f\left( {{x_3}} \right) = f\left( {\frac{3}{2}} \right) = {\left( {\frac{3}{2}} \right)^3} = \frac{{27}}{8};$

$f\left( {{x_4}} \right) = f\left( 2 \right) = {2^3} = 8.$

Hence

${\int\limits_0^2 {{x^3}dx} \approx {S_4} \text{ = }}\kern0pt{ \frac{1}{6}\left[ {0 + 4 \cdot \frac{1}{8} + 2 \cdot 1 + 4 \cdot \frac{{27}}{8} + 8} \right] }={ \frac{1}{6}\left[ {\frac{1}{2} + 2 + \frac{{27}}{2} + 8} \right] }={ \frac{{24}}{6} }={ 4.}$

### Example 8.

Using Simpson’s Rule with $$n = 4$$ subintervals, evaluate the integral $$\int\limits_0^1 {{e^x}dx}.$$ Round the answer to $$3$$ decimal places.

Solution.

We evaluate the given integral by the formula

${{S_4} = \frac{{\Delta x}}{3}\left[ {f\left( {{x_0}} \right) + 4f\left( {{x_1}} \right) }\right.}+{\left.{ 2f\left( {{x_2}} \right) + 4f\left( {{x_3}} \right) }\right.}+{\left.{ 2\left( {{x_4}} \right)} \right].}$

Determine the width of the subinterval:

$\Delta x = \frac{{b – a}}{n} = \frac{{1 – 0}}{{4}} = \frac{1}{4}.$

Compute the function values at the endpoints of the subintervals:

$f\left( {{x_0}} \right) = f\left( 0 \right) = {e^0} = 1;$

${f\left( {{x_1}} \right) = f\left( {\frac{1}{4}} \right) = {e^{\frac{1}{4}}} = \sqrt[4]{e} }\approx{ 1.2840;}$

${f\left( {{x_2}} \right) = f\left( {\frac{1}{2}} \right) = {e^{\frac{1}{2}}} = \sqrt e }\approx{ 1.6487;}$

${f\left( {{x_3}} \right) = f\left( {\frac{3}{4}} \right) = {e^{\frac{3}{4}}} = \sqrt[4]{{{e^3}}} }\approx{ 2.1170;}$

$f\left( {{x_4}} \right) = f\left( 1 \right) = {e^1} = e \approx 2.7183;$

Plugging in the function values into our equation, we get:

${\int\limits_0^1 {{e^x}dx} \approx {S_4} }={ \frac{1}{{12}}\left[ {1 + 4 \times 1.2840 }\right.}+{\left.{ 2 \times 1.6487 }\right.}+{\left.{ 4 \times 2.1170 }\right.}+{\left.{ 2.7183} \right] }={ \frac{1}{{12}} \times 20.6197 }={ 1.7183 }\approx{ 1.718}$

### Example 9.

Using Simpson’s Rule with $$n = 2$$ subintervals, evaluate the integral $$\int\limits_1^3 {\ln xdx}.$$ Round the answer to $$3$$ decimal places.

Solution.

We evaluate the integral by the following approximate formula:

${{S_2} \text{ = }}\kern0pt{\frac{{\Delta x}}{3}\left[ {f\left( {{x_0}} \right) + 4f\left( {{x_1}} \right) + f\left( {{x_2}} \right)} \right].}$

The width of the subinterval is

$\Delta x = \frac{{b – a}}{n} = \frac{{2 – 0}}{{2}} = 1.$

Calculate the function values at the points $${x_i} = \left\{ {1,2,3} \right\}:$$

$f\left( {{x_0}} \right) = f\left( 1 \right) = \ln 1 = 0;$

$f\left( {{x_1}} \right) = f\left( 2 \right) = \ln 2 \approx 0.6931;$

$f\left( {{x_2}} \right) = f\left( 3 \right) = \ln 3 \approx 1.0986;$

Hence

${\int\limits_1^3 {\ln xdx} \approx {S_2} }={ \frac{1}{3}\left[ {1 + 4\ln 2 + \ln 3} \right] }\approx{ \frac{1}{3}\left[ {1 + 4 \times 0.6931 + 1.0986} \right] }={ \frac{1}{3} \times 5.8710 }={ 1.957}$

### Example 10.

Using Simpson’s Rule with $$n = 4$$ subintervals approximate the area under the sine curve $$f\left( x \right) = \sin x$$ between $$x = 0$$ and $$x = \pi.$$

Solution.

The Simpson’s Rule formula with $$n = 4$$ segments is written in the form

${{S_4} = \frac{{\Delta x}}{3}\left[ {f\left( {{x_0}} \right) + 4f\left( {{x_1}} \right) }\right.}+{\left.{ 2f\left( {{x_2}} \right) + 4f\left( {{x_3}} \right) }\right.}+{\left.{ \left( {{x_4}} \right)} \right].}$

The width of the subinterval is

${\Delta x = \frac{{b – a}}{n} }={ \frac{{\pi – 0}}{4} }={ \frac{\pi }{4}.}$

Calculate the values of the sine function at the points $${x_i} = \left\{ {0,\large{\frac{\pi }{4}}\normalsize, \large{\frac{\pi }{2}}\normalsize, \large{\frac{{3\pi }}{4}}\normalsize, \pi } \right\}:$$

${f\left( {{x_0}} \right) = f\left( 0 \right) }={ \sin 0 }={ 0;}$

${f\left( {{x_1}} \right) = f\left( {\frac{\pi }{4}} \right) }={ \sin \frac{\pi }{4} }={ \frac{{\sqrt 2 }}{2};}$

${f\left( {{x_2}} \right) = f\left( {\frac{\pi }{2}} \right) }={ \sin \frac{\pi }{2} }={ 1;}$

${f\left( {{x_3}} \right) = f\left( {\frac{{3\pi }}{4}} \right) }={ \sin \frac{{3\pi }}{4} }={ \frac{{\sqrt 2 }}{2};}$

${f\left( {{x_4}} \right) = f\left( \pi \right) }={ \sin \pi }={ 0.}$

Now we can substitute these values into our equation and find the approximate value of the area:

${A = \int\limits_0^\pi {\sin xdx} \approx {S_4} }={ \frac{\pi }{{12}}\left[ {0 + 4 \cdot \frac{{\sqrt 2 }}{2} + 2 \cdot 1 }\right.}+{\left.{ 4 \cdot \frac{{\sqrt 2 }}{2} + 0} \right] }={ \frac{\pi }{{12}}\left( {4\sqrt 2 + 2} \right) }={ \frac{\pi }{6}\left( {2\sqrt 2 + 1} \right).}$

### Example 11.

Using Simpson’s Rule with $$n = 4$$ subintervals approximate the area under the inverse cosine curve $$f\left( x \right) = \arccos x$$ between $$x = -1$$ and $$x = 1.$$

Solution.

The Simpson’s Rule formula with $$n = 4$$ segments has the form

${{S_4} = \frac{{\Delta x}}{3}\left[ {f\left( {{x_0}} \right) + 4f\left( {{x_1}} \right) }\right.}+{\left.{ 2f\left( {{x_2}} \right) + 4f\left( {{x_3}} \right) }\right.}+{\left.{ \left( {{x_4}} \right)} \right].}$

Determine the width of the subinterval:

${\Delta x = \frac{{b – a}}{n} }={ \frac{{1 – \left({-1}\right)}}{4} }={ \frac{1}{2}.}$

Calculate the values of the inverse cosine at the endpoints of the subintervals:

${f\left( {{x_0}} \right) = f\left( { – 1} \right) }={ \arccos \left( { – 1} \right) }={ \pi ;}$

${f\left( {{x_1}} \right) = f\left( { – \frac{1}{2}} \right) }={ \arccos \left( { – \frac{1}{2}} \right) }={ \frac{{2\pi }}{3};}$

${f\left( {{x_2}} \right) = f\left( 0 \right) }={ \arccos 0 }={ \frac{\pi }{2};}$

${f\left( {{x_3}} \right) = f\left( {\frac{1}{2}} \right) }={ \arccos \frac{1}{2} }={ \frac{\pi }{3};}$

${f\left( {{x_4}} \right) = f\left( 1 \right) }={ \arccos 1 }={ 0.}$

Substituting these values into our equation, we find the area under the curve:

${A = \int\limits_{ – 1}^1 {\arccos xdx} \approx {S_4} }={ \frac{1}{6}\left[ {\pi + 4 \cdot \frac{{2\pi }}{3} + 2 \cdot \frac{\pi }{2} }\right.}+{\left.{ 4 \cdot \frac{\pi }{3} + 0} \right] }={ \frac{1}{6} \cdot 6\pi }={ \pi }$