Riemann sum and Trapezoidal rule approximate the graph between two adjacent points on the graph by the straight line joining them. This against Simpson's Rule makes use of the parabola joining the three adjacent points to approximate the graph. A parabola can be drawn through any three non collinear points. The Simpson formula is also arrived at by dividing the given interval [a,b] into 'n' sub intervals of equal length $\Delta x$ = $\frac{b  a}{n}$. But, n in this case is an even integer. Then, on each consecutive pair of intervals, we approximate the curve y = f(x) $\neq$ 0, by parabolas as shown in the diagram here. A general parabola passes through the consecutive points P_{i}, P_{i+1} and P_{i+2}.The definite integral is then approximated to the sum of the areas under all such parabolas 

Simpson's Rule  Formula

$\int_{a}^{b}f(x)dx\approx S_{n}=\frac{\Delta x}{3}[f(x_{0})+4f(x_{1})+2f(x_{2})+4f(x_{3})+.....+2f(x_{n2})+4f(x_{n1})+f(x_{n})]$

Let us first approximate for the division consisting of three points x
_{0} = h, x
_{1} = 0 and x
_{2} = h.
An equation to the parabola passing through the Points P
_{0}, P
_{1} and P
_{2} can be assumed in the form Ax
^{2} + Bx + C = 0. Hence, the area under the parabola from x = h to x = h is given by the definite Integral,
$\int_{h}^{h}(Ax^{2} + Bx + C)dx = 2\int_{0}^{h}Ax^{2}dx + C$
Applying properties of definite Integral for odd and even functions
$= 2[A\frac{x^{3}}{3} + Cx]_{0}^{h}$
$= 2[A\frac{h^{3}}{3} + Ch] = \frac{h}{3} (2Ah^{2} + 6C)$
Since the parabola passes through the point (h,y
_{0}), (0.y
_{1}) and (h,y
_{2})
$y_{0} = A(h)^{2} + B(h) + C = Ah^{2}  Bh + C$
$y_{1} = C$
$y_{2} = Ah^{2} + Bh + C$
From the above three equations, we get
$y_{0} + 4y_{1} + y_{2} = 2Ah^{2} + 6C$
Hence, the area under the parabola = $\frac{h}{3}(y_{0} + 4y_{1} + y_{2})$
Shifting the parabola horizontally to three other values of x with the same interval will not alter the area under the parabola. Thus, the area under the parabola passing through the points P
_{0}, P
_{1} and P
_{2} from x = x
_{0} to x = x
_{2} as shown in the first diagram is $\frac{h}{3}(y_{0} + 4y_{1} + y_{2})$
Similarly, the area under the parabola passing through P
_{2}, P
_{3} and P
_{4} from x = x
_{2} to x = x
_{4} is
$\frac{h}{3}(y_{2} + 4y_{3} + y_{4})$
Extending this computations to other consecutive double intervals, the composite Simpson's rule is given as,
$\int_{a}^{b}\approx \frac{h}{3}(y_{0} + 4y_{1} + y_{2}) + \frac{h}{3}(y_{2} + 4y_{3} + y_{4}) + ........ \frac{h}{3}(y_{n  2} + 4y_{n  1} + y_{n})$
$= \frac{h}{3}(y_{0} + 4y_{1} + 2y_{2} + 4y_{3}2y_{4} + ..........2y_{n  2} + 4y_{n  1} + y_{n})$
Even though, we have derived the rule for f(x) â‰¥ 0, this approximation holds good for any continuous function f. The formula can be easily memorized noting the pattern of the coefficients, 1,4,2,4,2,4.......4,2,4,1.
$\int_{a}^{b}f(x)dx\approx S_{n}$
$= \frac{h}{3}(\sum y_{ends} + 4\sum y_{odds} + 2\sum y_{evens})$
Given below are some of the examples on Simpson's Rule.
Solved Examples
Question 1: Evaluate $\int_{0}^{1}$
$\frac{dx}{1 + x^{2}}$ using Simpson's 1/3 and 3/8 rule.
Solution:
Divided the range into six equal parts of with h = 1/6 and compute the value of y = $\frac{1}{1 + x^{2}}$ at each point of subdivision.
x_{0} = 0 then y_{0} = 1
x_{1} = x_{0 }+ h = $\frac{1}{6}$ then y_{1} = $\frac{36}{37}$ = 0.97297
x_{2} = x_{0 }+ 2h = $\frac{2}{6}$ then y_{2} = $\frac{36}{40}$ = 0.90007
x_{3} = x_{0} + 3h = $\frac{3}{6}$ then y_{3} = $\frac{36}{45}$ = 0.8000
x_{4} = x_{0 }+ 4h = $\frac{4}{6}$ then y_{4 }= $\frac{36}{52}$ = 0.6923
x_{5} = x_{0 }+ 5h = $\frac{5}{6}$ then y_{5} = $\frac{36}{61}$ = 0.5901
x_{6 }= x_{0 }+ 6h = $\frac{6}{6}$ = 1 then y_{6} = $\frac{1}{2}$ = 0.5
Then, by Simpson's 1/3 rule
$\int_{a}^{b}f(x) dx $ = $\frac{h}{3}\left [ \left (y _{0} +y_{n}\right ) +4\left (y
_{1}+y_{3}+y_{5}+...+y_{n1} \right )+2\left (y
_{2}+y_{4}+y_{6}+....+y_{n2} \right )\right ]$
= $\frac{1}{18}[(1 + 0.5) + 4(0.97297 + 0.8 + 0.5901) + 2(0.9 + 0.6923)]$
= $\frac{1}{18}[1.5 + 9.4525 + 3.1846]$
= $(0.055)[1.5 + 9.4525 + 3.1846]$
= 0.7853
By Simpson's 3/8 rule
$\int_{a}^{b}f(x) dx $ = $\frac{3h}{8}\left [ \left (y _{0} +y_{n}\right ) +3\left (y
_{1}+y_{2}+y_{4}+y_{5}+...+y_{n1} \right )+2\left (y
_{3}+y_{6}+y_{9}+....+y_{n3} \right )\right ]$
= $\frac{3}{48}[(1 + 0.5) + 3(0.97297 + 0.9 + 0.6923 + 0.5901) + 2(0.8)]$
= $\frac{1}{16}[1.5 + 9.4663 + 1.6]$
= 0.78539
Question 2: Evaluate the integral $\int_{0}^{1}e^{x}dx$, using Simpson's 1/3 rule.
Solution:
Divide the whole range (0,1) into six equal parts by taking h = 1/6.
x_{0} = 0 then y_{0} =e^{0} = 1
x_{1} = x_{0 }+ h = $\frac{1}{6}$ then y_{1} = $e^{\frac{1}{6}}$ = 1.1813
x_{2} = x_{0 }+ 2h = $\frac{2}{6}$ then y_{2} = $e^{\frac{1}{3}}$ = 1.3956
x_{3} = x_{0 }+ 3h = $\frac{3}{6}$ then y_{3} = $e^{\frac{1}{2}}$ = 1.6487
x_{4} = x_{0 }+ 4h = $\frac{4}{6}$ then y_{4 }= $e^{\frac{4}{6}}$ = 1.9477
x_{5} = x_{0 }+ 5h = $\frac{5}{6}$ then y_{5} = $e^{\frac{5}{6}}$ = 2.3009
x_{6 }= x_{0 }+ 6h = $\frac{6}{6}$ = 1 then y_{6} = 2.7182
By Simpson's 1/3 rule
$\int_{a}^{b}f(x) dx $ = $\frac{h}{3}\left [ \left (y _{0} +y_{n}\right ) +4\left (y
_{1}+y_{3}+y_{5}+...+y_{n1} \right )+2\left (y
_{2}+y_{4}+y_{6}+....+y_{n2} \right )\right ]$
= $\frac{1}{18} [(1 + 2.718) + 4(1.1813 + 1.6487 + 2.3009) + 2(1.39561 + 1.9477)]$
= 0.055[3.7182 + 20.52422 + 6.6866]
= 1.71828
Simpson's 1/3 Rule for Integration:
A quick approximation for definite integrals can be got by taking 2
partitions for a small interval [a,b]. When two partitions are made we
have $x_{0}=a$, $x_{1}=\frac{a+b}{2}$ and $x_{2}=b$. Hence the approximation is written as $\int_{a}^{b}f(x)dx\approx S_{2}=\frac{h}{3}[f(x_{0})+4f(x_{1})+f(x_{2})]$ $=\frac{h}{3}[f(a)+4f(\frac{a+b}{2})+f(b)]$ where $h=\frac{ba}{2}$
This is known as Simpson's $\frac{1}{3}^{rd}$ Rule of Integration.


Simpson's $\frac{1}{3}^{rd}$ Rule  ExampleApproximate $I= \int_{0}^{\frac{\pi }{2}}Sin(x)dx$ and compare with the exact value of definite integral.
Here, $a = 0$ and $b = \frac{\pi}{2}$
$h = \frac{b  a}{2} = \frac{\pi}{4}$
Using Simpson's $\frac{1}{3}^{rd}$ Rule,
$I\approx S_{2}=\frac{\pi}{4}[f(0)+4f(\frac{\pi}{4})+f(\frac{\pi}{2})]$
$I\approx 1.341$
Applying fundamental theorem of calculus, we get$I =1$.
The approximation is not close enough, as the interval is not really small here. Using composite Simpson's formula with larger partitions would give more accurate results.
Simpson's 3/8 Rule for Integration:
The Simpson's rule stated above can be used only when the number of
intervals is an even number. Simpson's rule also exist when the number
of divisions made is a multiple of 3.
Thomas Simpson gave the initial
formula for 3 partitions which is known as Simpson's $\frac{3}{8}$ rule
and it is given as follows:
$\int_{a}^{b}f(x)dx\approx \frac{3h}{8}[f(a) + 3f(a + h) + 3f(a + 2h) + f(b)]$
where, $h = \frac{b  a}{3}$
Extending this the composite Simpson's $\frac{3}{8}$ rule for 3m partitions is written as
$\int_{a}^{b}f(x)dx\approx \frac{3h}{8}\sum_{k = 1}^{m}(f(x_{3k  3}) + 3f(x_{3k  2}) + 3f(x_{3k  1}) + f(x_{3k}))$
where, $h = \frac{b  a}{3m}$
Consider the given data of a set of (n + 1) values of x and y, namely (x
_{0},y
_{0}),(x
_{1},y
_{1}),(x
_{2},y
_{2})........,(x
_{n},y
_{n}) with x
_{i} = x
_{0}+ih where i = 1,2,3,....n. If it is required to calculate $\int_{x_{0}}^{x_{n}}f(x) dx$, where y = f(x) is tabulated function. For the proof of Simpson's formula, we can use forward difference interpolation formula
I = $\int_{x_{0}}^{x_{n}}f(x) dx$
= $\int_{x_{0}}^{x_{n}}P_{n}(x) dx$
= $\int_{0}^{n}P_{n}(x_{0}+hu)hdu$
= h$\int_{0}^{n}P_{n}(x_{0}+hu)du$ ........................(i)
Since x = x
_{0} ^{ }+ h u, dx = h du (x
_{0} and h are constant)
So, u =
$\frac{x  x_{0}}{h}$ and x
_{i} = x
_{0 }+ ih
Now, if n = 2 i.e. the data consists of just three values as (x
_{0},y
_{0}),(x
_{1},y
_{1}),(x
_{2},y
_{2}), so that differences of order higher than second do not exists.
$ \int_{x_{0}}^{x_{2}}f(x) dx= h\int_{0}^{2}\left [ y_{0}+ u\Delta y_{0}+ \frac{u(u1)}{2!} \Delta ^{2}y_{0}\right ]$
= $\frac{h}{3}$$[y_0 + 4y_1 + y_2]$ ................................(ii)
Again $\int_{x_{2}}^{x_{4}}f(x) dx$ = $\frac{h}{3}$$[y_2 + 4y_3 + y_4]$ ..........................(iii)
If we continue this process, then we get
$\int_{x_{2n  2}}^{x_{2n}}f(x) dx$ = $\frac{h}{3}$ $[y_{2n  2} + 4y_{2n  1} + y_{2n}]$ ...............(iv)
Adding (ii), (iii) and (iv), we get
$\int_{x_{0}}^{x_{2n}}f(x) dx$ = $\frac{h}{3}\left [ \left (y _{0} + y_{2n}\right ) + 4\left (y _{1} + y_{3} + y_{5} + ... + y_{2n  1} \right ) + 2\left (y _{2} + y_{4} + y_{6} + .... + y_{2n  2} \right )\right ]$
In numerical integration, we want to find out the approximate value of the given integral say $\int_{a}^{b}y dx$ without actually integrating the function but only using some values of y at some points of x equally spaced over the interval [a,b]. If we have y = f(x) which is a equally spaced function over [a,b] i.e. if a = x
_{0}, x1 = x
_{0 }+ h, x2 = x
_{0} + 2h ...., xn = x
_{0} + nh, where h is the difference in these terms or we can say that y0 = f(x
_{0}), y
_{1} = f(x
_{1}), y
_{2} = f(x
_{2}),......,y
_{n} = f(x
_{n}) are the corresponding values of y with each value of x.
We have two Simpson's rule for numerical integration one is 1/3rd rule and another is 3/8 rule.
Simpson's One Third Rule:
$\int_{a}^{b}f(x) dx$ = $\frac{h}{3}\left [ \left (y _{0} +y_{n}\right ) +4\left (y
_{1}+y_{3}+y_{5}+...+y_{n1} \right )+2\left (y
_{2}+y_{4}+y_{6}+....+y_{n2} \right )\right ]$
Simpson's Three Eight Rule:
$\int_{a}^{b}f(x) dx$ = $\frac{3h}{8}\left [ \left (y _{0} +y_{n}\right ) +3\left (y
_{1}+y_{2}+y_{4}+y_{5}+...+y_{n1} \right )+2\left (y
_{3}+y_{6}+y_{9}+....+y_{n3} \right )\right ]$