# Integral Approximation - Simpson's Rule

**Simpson's rule** is a method for approximating definite integrals of functions. It is usually (but not always) more accurate than approximations using Riemann sums or the trapezium rule, and is exact for linear and quadratic functions. The error in approximating the integral of a four-times-differentiable function by Simpson's Rule is proportional to the fourth derivative of the function at some point in the interval.

(Compare the trapezium rule, which approximates \( f(x) \) by a linear function through the endpoints of the interval.)

#### Contents

## Definition

Suppose \( f(x) \) is defined on the interval \( [a,b].\) Then Simpson's rule on the entire interval approximates the definite integral of \( f(x) \) on the interval by the formula \[ \int_a^b f(x) \, dx \approx \frac{b-a}6 \left(f(a) + 4f\left(\frac{a+b}2\right) +f(b)\right). \] The idea is that if \( f(x) = 1,x,\) or \( x^2,\) this formula is an exact equality. So Simpson's rule gives the correct integral of any quadratic function. In general, Simpson's rule approximates \(f(x)\) by a parabola through the points on the graph of \( f(x) \) with \( x\)-coordinates \( a,\frac{a+b}2,b.\)

Simpson's rule is usually applied by breaking the interval into \( N \) equal-sized subintervals, where \( N \) is an even number, and approximating the integral over each pair of adjacent subintervals using the above estimate.

That is, let \( x_0 = a, x_1 = a+\frac{b-a}{N}, x_2 = a+2\frac{b-a}{N}, \ldots, x_{N-1} = a+(N-1)\frac{b-a}{N}, x_N = b.\) Then \[ \begin{align} \int_{a}^{x_2} f(x) \, dx &\approx \frac{b-a}{3N}( f(a)+4f(x_1)+f(x_2)) \\ \int_{x_2}^{x_4} f(x) \, dx &\approx \frac{b-a}{3N} (f(x_2)+4f(x_3)+f(x_4)) \end{align} \] and so on. Adding these up gives \[ \int_a^b f(x) \, dx \approx \frac{b-a}{3N}(f(a)+4f(x_1)+2f(x_2)+4f(x_3)+2f(x_4)+\cdots+4f(x_{N-1})+f(b)). \]

Let \( f(x) = x^4,\) \( a=0,\) \(b=4.\)

Dividing the interval up into \( 4 \) equal subintervals gives \[ \int_0^4 x^4 \, dx = \frac13(0^4+4(1)^4+2(2)^4+4(3)^4+4^4) = 205\frac13. \] Compare with the actual value of the integral, which is \( 4^5/5 = 204.8.\)

## Error estimate

It seems reasonable that the error in the Simpson's rule estimate on an interval should be proportional to the third derivative of the function, analogous to the error in the trapezium rule being proportional to the second derivative. But in fact Simpson's rule is exact on an extra power of \( x \) "for free":

Show that Simpson's rule gives the exact integral of \( x^3\) on any interval.

The Simpson's rule approximation on \([a,b]\) is \[ \begin{align} \frac{b-a}6\left( a^3+4\left(\frac{a+b}2\right)^3+b^3 \right) &= \frac{b-a}6(\frac32 a^3+\frac32 a^2b + \frac32 ab^2 +\frac32 b^3) \\ &= \frac{b-a}4(a^3+a^2b+ab^2+b^3) \\ &= \frac{b^4-a^4}4, \end{align} \] which is equal to \( \int_a^b x^3 \, dx. \)

So in fact the Simpson's rule error is proportional to the fourth derivative:

Let \( E \) be the error in approximating \(\int_a^b f(x) \, dx \) by Simpson's rule with \( n\) equal-sized subintervals. Suppose \(f\) is four-times-differentiable on \( (a,b).\) Then if there is some constant \( K \) such that \( f''''(c) < K \) for all \( c \in (a,b),\) \[ |E| < \frac{K(b-a)^5}{180N^4}. \]

How many equal-sized subintervals are required to guarantee that the error in approximating \( \int_0^2 x^4 \, dx \) by Simpson's rule is \( \le \frac1{960}\)?

We want \[ \frac{K \cdot 2^5}{180N^4} \le \frac1{960}, \] where \( K \) is an upper bound for the fourth derivative of \( x^4. \) But this is a constant, \( 24,\) so \( K=24.\) Plugging in and simplifying gives \[ N^4 \ge \frac{960 \cdot 24 \cdot 32}{180} = 4096, \] so \( N \ge 8.\) The answer is \( 8.\)

**Cite as:**Integral Approximation - Simpson's Rule.

*Brilliant.org*. Retrieved from https://brilliant.org/wiki/integral-approximation-simpsons-rule/