Deriving the formula for Simpson's rule

Assume that \(f(x)\) is continuous over \([a,b]\). Let's say we want to find \(\int^b_a f(x) \ dx \), but \(f(x)\) is complicated and it's integral is difficult to find. We can approximate teh integral by using the Simpson's rule, where we start by partitioning the interval into an even number of subintervals (\(n\)), each of equal width (\(\Delta x\)). We can break the integral like this:

\[\int^b_a f(x) \ dx = \int_{x_0}^{x_2} f(x) \ dx + \int_{x_2}^{x_4} f(x) \ dx + \ldots + \int_{x_{n-2}}^{x_n} f(x) \ dx\]

Let's focus on one of these subintegrals:

\[\int_{x_0}^{x_2} f(x) \ dx\]

We can approximate the value of this subintegral by finding \(\int^{x_2}_{x_0} P(x) \ dx\), where \(P(x)\) is a polynomial which is equal to \(f(x)\) at \(x_0\), \(x_1\) and \(x_2\), and is in the form \(Ax^2 + Bx + C\), which easier to integrate:

\[\int_{x_0}^{x_2} f(x) \ dx \approx \int_{x_0}^{x_2} P(x) \ dx \]

Since \(P(x)\) is a polynomial which is equal to \(f(x)\) at \(x_0\), \(x_1\) and \(x_2\), it can be a good approximation:

Image from openstax.org (Calculus Volume 2)

If we evaluate \(\int^{x_2}_{x_0} P(x) \ dx\):

\[\begin{align} \int^{x_2}_{x_0} P(x) \ dx &= \int^{x_2}_{x_0} Ax^2 + Bx + C \ dx = \left[ A\frac{x^3}{3} + B\frac{x^2}{2} + Cx \right]^{x_2}_{x_0} \\ &= A\frac{x^3_2}{3} + B\frac{x^2_2}{2} + Cx_2 - A\frac{x^3_0}{3} - B\frac{x^2_0}{2} - Cx_0 \end{align}\]

Factoring the like terms:

\[\frac{A}{3}(x^3_2 - x^3_0) + \frac{B}{2}(x^2_2 - x^2_0) + C(x_2 - x_0)\]

Factoring both (\(x^3_2 - x^3_0\)) and (\(x^2_2 - x^2_0\)):

\[\begin{gathered} \frac{A}{3}(x_2 - x_0)(x^2_2 + x_2x_0 + x^2_0) + \frac{B}{2}(x_2 - x_0)(x_2 + x_0) + C(x_2 - x_0) \\ \frac{x_2 - x_0}{6} ( 2A(x^2_2 + x_2x_0 + x^2_0) + 3B(x_2 + x_0) + 6C) \end{gathered}\]

Since \(x_2 - x_0 = 2\Delta x\):

\[\frac{\Delta x}{3} ( 2A(x^2_2 + x_2x_0 + x^2_0) + 3B(x_2 + x_0) + 6C)\]

We can rewrite this as:

\[\begin{gathered} \frac{\Delta x}{3} \left( A(x^2_2 + x_2x_0 + x^2_0) + B(x_2 + x_0) + 2C + A(x^2_2 + x_2x_0 + x^2_0) + 2B(x_2 + x_0) + 4C \right) \\ \frac{\Delta x}{3} \left( Ax^2_2 + Bx_2 + C + Ax^2_0 + Bx_0 + C + Ax_2x_0 + A(x^2_2 + x_2x_0 + x^2_0) + 2B(x_2 + x_0) + 4C \right) \\ \frac{\Delta x}{3} \left( Ax^2_2 + Bx_2 + C + Ax^2_0 + Bx_0 + C + A(x^2_2 + 2x_2x_0 + x^2_0) + 2B(x_2 + x_0) + 4C \right) \end{gathered}\]

Since \(f(x) = P(x)\) at \(x_0\), \(x_1\) and \(x_2\):

\[ \frac{\Delta x}{3} \left( f(x_2) + f(x_0) + A(x_2 + x_0)^2 + 2B(x_2 + x_0) + 4C \right) \]

Since \(x_1 = \frac{x_0 + x_2}{2}\):

\[\begin{gathered} \frac{\Delta x}{3} \left( f(x_2) + f(x_0) + A(2x_1)^2 + 2B(2x_1) + 4C \right) \\ \frac{\Delta x}{3} \left( f(x_2) + f(x_0) + 4A(x_1^2) + 4B(x_1) + 4C \right) \\ \frac{\Delta x}{3} \left( f(x_2) + f(x_0) + 4f(x_1) \right)\end{gathered} \]

This means:

\[\int_{x_0}^{x_2} f(x) \ dx \approx \frac{\Delta x}{3} \left( f(x_0) + 4f(x_1) + f(x_2) \right) \]

We can use this to approximate the total integral:

\[\begin{align} \int_a^b f(x) \ dx &\approx \frac{\Delta x}{3} \left( f(x_0) + 4f(x_1) + f(x_2) \right) + \frac{\Delta x}{3} \left( f(x_2) + 4f(x_3) + f(x_4) \right) + \ldots + \frac{\Delta x}{3} \left( f(x_{n-2}) + 4f(x_{n-1}) + f(x_n) \right) \\ &\approx \frac{\Delta x}{3} \left( f(x_0) + 4f(x_1) + 2f(x_2) + 4f(x_3) + 2f(x_4) + \ldots + 2f(x_{n-2}) + 4f(x_{n-1}) + f(x_n) \right) \end{align}\]

Styles

(uses cookies)