Calculus

Integration of Functions

Integration of Functions Logo

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).\)

Simpson's method of integration
Figure 1.

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) + 2f\left( {{x_2}} \right) + 4f\left( {{x_3}} \right) + 2f\left( {{x_4}} \right) + \cdots + 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 {\frac{{dx}}{x}}\] using Simpson's Rule with \(n = 2\) subintervals.

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) + 2f\left( {{x_2}} \right) + 4f\left( {{x_3}} \right) + f\left( {{x_4}} \right)} \right] = \frac{2}{3}\left[ {0 + 4 \cdot \sqrt 2 + 2 \cdot 2 + 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.

A function given by the table

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) + 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.

A function given as a table of values

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) + 2f\left( {{x_2}} \right) + 4f\left( {{x_3}} \right) + 2f\left( {{x_4}} \right) + 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 + 4 \cdot 4 + 2 \cdot 6 + 4 \cdot 9 + 14} \right] = \frac{2}{3}\left[ {1 + 12 + 8 + 16 + 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.

Area under the curve y=f(x)
Figure 2.

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) + 2f\left( {{x_2}} \right) + 4f\left( {{x_3}} \right) + 2f\left( {{x_4}} \right) + 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 + 4 \cdot 3 + 2 \cdot 6 + 4 \cdot 6 + 4} \right] = \frac{1}{3}\left[ {4 + 12 + 4 + 12 + 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.

Area under the curve y=3^x
Figure 3.

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) + 2f\left( {{x_2}} \right) + 4f\left( {{x_3}} \right) + 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 + 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 {\frac{{dx}}{x}}\] 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) + 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,\frac{3}{2},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} = \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}}.\]

See more problems on Page 2.

Page 1 Page 2