Simpson's Rule Formula
The Simpson's rule formula is one of the formulas used to find the approximate value of a definite integral. A definite integral is an integral with lower and upper limits. Usually, to evaluate a definite integral, we first integrate (using the integration techniques) and then we use the fundamental theorem of calculus to apply the limits. But sometimes, we cannot apply any integration techniques to solve an integral, and sometimes, we do not have a specific function to integrate, instead, we have some observed values (in case of experiments) of the function. In such cases, Simpson's rule formula helps in approximating the value of the definite integral. Let us learn this formula and a few solved examples in the upcoming sections.
What is Simpson's Rule Formula?
We have several numerical methods to approximate an integral, such as Riemann's left sum, Riemann's right sum, midpoint rule, trapezoidal rule, Simpson's rule, etc. But among these, Simpson's rule formula gives the more accurate approximation of a definite integral. If we have f(x) = y, which is equally spaced between [a,b], the Simpson's rule formula is:
\(\begin{align}\int_{a}^{b} f(x) d x \approx \dfrac{\Delta x}{3}\left[f\left(x_{0}\right)+4 f\left(x_{1}\right)+2 f\left(x_{2}\right)+\\[0.2cm]\cdots+2 f\left(x_{n2}\right)+4 f\left(x_{n1}\right)+f\left(x_{n}\right)\right] \end{align} \)
Here,
 n is an even number which is the number of subintervals that the interval [a, b] should be divided into.
(n is usually mentioned in the problem)  \(x_0\) = a and \(x_n\) = b
 \(\Delta x = \dfrac{ba}{n}\)
 \(x_0, x_1, ...., x_n\) are the ends of the n subintervals.
Simpson's Rule Error Bound
Simpson's rule gives just an approximate value of the integral, not the exact value. So there is always an error that can be calculated using the following formula.
Error bound in Simpson's rule = \(\dfrac{M(ba)^{5}}{180 n^{4}}\),
where \(\leftf^{(4)}(x)\right \leq M\)
Solved Examples Using Simpson's Rule Formula

Example 1: Evaluate the integral \(\int_{1}^{2} e^{x^{3}} d x\) using Simpson's rule formula by taking n = 4.
Solution:
\(\int_{1}^{2} e^{x^{3}} d x\) = \(\int_{a}^{b} f(x)\, d x\)
Comparing both integrals,
[a, b] = [1, 2] and f(x) = \(e^{x^{3}}\)
\(\Delta x = \dfrac{ba}{n}= \dfrac{21}{4} = 0.25\)
So the 4 subintervals are [1, 1.25], [1.25, 1.5], [1.5, 1.75], and [1.75, 2].
By Simpson's rule formula.
\(\begin{align}&\int_{1}^{2} f(x) d x\\[0.2cm] &\approx \dfrac{0.25}{3}\left[f\left(1\right)+4 f\left(1.25\right)+2 f\left(1.5\right)+4f(1.75)+f(2) \right]\\[0.2cm]
&= \dfrac{0.25}{3}(2.71828182845905+28.2027463392796\\[0.2cm]&+58.4485675624699+850.36813958881\\[0.2cm]&+2980.95798704173) \\[0.2cm]
& = 326.724643530062 \end{align} \)Answer: \(\int_{1}^{2} e^{x^{3}} d x \approx \) 326.724643530062

Example 2 : Evaluate the integral \(\int_{0}^{2} \sin \sqrt x \,d x\) using Simpson's rule formula by taking n = 8.
Solution:
\(\int_{0}^{2} \sin \sqrt x \, d x\) = \(\int_{a}^{b} f(x)\, d x\)
Comparing both integrals,
[a, b] = [0, 2] and f(x) = \(\sin \sqrt x\)
\(\Delta x = \dfrac{ba}{n}= \dfrac{20}{8} = 0.25\)
So the 4 subintervals are [0, 0.25], [0.25, 0.5], [0.5, 0.75], [0.75, 1], [1, 1.25], [1.25, 1.5], [1.5, 1.75], and [1.75, 2].
By Simpson's rule formula.
\(\begin{align}&\int_{0}^{2} f(x) d x\\[0.2cm] &\approx \dfrac{0.25}{3}\left[f\left(0\right)+4 f\left(0.25\right)+2 f\left(0.5\right)+...+4f(1.75)+f(2) \right]\\[0.2cm]
&= \dfrac{0.25}{3}(0+1.91770215441681+1.29927387816012\\[0.2cm]&+3.04703992566516+1.68294196961579\\[0.2cm]&+3.59696858641514+1.88143866748289\\[0.2cm]&+3.87769904361669+0.987765945992735) \\[0.2cm]
& = 1.52423584761378\end{align} \)Answer: \(\int_{0}^{2} \sin \sqrt x \, d x \approx \) 1.52423584761378