← MATH 162 MathScape 0 MATH162

Simpson's Rule

3 min read

Jump to a section
Reference: Stewart §7.7

Textbook Reference

Primary source OpenStax Calculus Volume 2, Section 1.5: “Numerical Integration”
Direct link https://openstax.org/books/calculus-volume-2/pages/1-5-numerical-integration
Textbook used in class Stewart, Calculus, Section 7.7: “Approximate Integration”

Opening Scenario

Trapezoids fit a straight line to the function on each subinterval. A parabola is a better fit for a smooth function: it matches the function values at three points instead of two. Simpson’s Rule fits a parabola through each group of three consecutive function values and integrates that parabola exactly. The result is a dramatic improvement in accuracy: the error shrinks at $O(1/n^4)$, compared with $O(1/n^2)$ for the Trapezoidal and Midpoint rules.


Quick Reference

Simpson’s Rule (requires $n$ even): $$S_n = \frac{\Delta x}{3}\left[f(x_0) + 4f(x_1) + 2f(x_2) + 4f(x_3) + 2f(x_4) + \cdots + 4f(x_{n-1}) + f(x_n)\right].$$

Coefficient pattern: $1, 4, 2, 4, 2, \ldots, 2, 4, 1$.

Connection to other rules: $S_n = \dfrac{2M_{n/2} + T_{n/2}}{3}$ (weighted average of midpoint and trapezoidal approximations on $n/2$ subintervals).

Error bound: If $|f^{(4)}(x)| \leq K$ on $[a,b]$, then $$|E_S| \leq \frac{K(b-a)^5}{180n^4}.$$


Key Concepts

1. The Parabolic Fitting Idea

On each pair of consecutive subintervals $[x_{2i-2}, x_{2i-1}, x_{2i}]$, fit a parabola through the three points $(x_{2i-2}, f(x_{2i-2}))$, $(x_{2i-1}, f(x_{2i-1}))$, $(x_{2i}, f(x_{2i}))$. Integrate that parabola exactly over the two subintervals.

The integral of the parabola through these three points (with subinterval width $h = \Delta x$) equals: $$\frac{h}{3}[f(x_{2i-2}) + 4f(x_{2i-1}) + f(x_{2i})].$$

Summing over all $n/2$ pairs of subintervals gives the full Simpson’s Rule formula, with interior points alternating between coefficient 4 (at odd indices) and 2 (at even interior indices).

2. Why $n$ Must Be Even

Simpson’s Rule groups subintervals in pairs. If $n$ is odd, the last pair would be incomplete. Always choose $n$ even. A common error is using $n = 5$ or another odd number.

3. $O(1/n^4)$ Accuracy

The error bound involves the fourth derivative $f^{(4)}$ and $1/n^4$. If $f$ is a polynomial of degree 3 or less, then $f^{(4)} = 0$ everywhere and Simpson’s Rule is exact. Simpson’s Rule integrates polynomials of degree up to 3 exactly, because a parabola is the unique degree-2 polynomial through three points, and integrating a parabola of that form is equivalent to integrating a cubic (Simpson’s Rule happens to be exact for cubics too).

Common misconception

“The coefficients in Simpson’s Rule alternate as 1, 2, 4, 2, 4, ..., 2, 1.” The pattern is $1, 4, 2, 4, 2, \ldots, 2, 4, 1$ -- starting and ending with 1, then alternating 4 and 2 in between. The pattern starts with 4 (not 2) on the second term.


Worked Example

Approximate $\displaystyle\int_0^1 e^x\,dx$ using $S_4$ and estimate the error.

$n = 4$ (even), $\Delta x = \frac{1}{4}$. Points: $x_0=0, x_1=0.25, x_2=0.5, x_3=0.75, x_4=1$.

$$S_4 = \frac{1/4}{3}\left[e^0 + 4e^{0.25} + 2e^{0.5} + 4e^{0.75} + e^1\right]$$ $$= \frac{1}{12}\left[1 + 4(1.28403) + 2(1.64872) + 4(2.11700) + 2.71828\right]$$ $$= \frac{1}{12}[1 + 5.13611 + 3.29744 + 8.46801 + 2.71828]$$ $$= \frac{1}{12}(20.61984) \approx 1.71832.$$

Exact: $e - 1 \approx 1.71828$. Error: $\approx 0.00004$.

Error bound: $f^{(4)}(x) = e^x$, $K = e^1 \approx 2.718$.

$|E_S| \leq \dfrac{2.718(1)^5}{180(4)^4} = \dfrac{2.718}{46080} \approx 0.000059$. Actual error is within this bound.


Common Errors Summary

Error Example Correction
Using an odd $n$ $S_5$ $n$ must be even; use $S_4$ or $S_6$ instead
Wrong coefficient pattern $1, 2, 4, 2, 4, \ldots$ Correct pattern: $1, 4, 2, 4, 2, \ldots, 2, 4, 1$; starts with 4 on index 1
Forgetting the $\frac{\Delta x}{3}$ factor (not $\frac{\Delta x}{2}$) Using $\frac{\Delta x}{2}$ (the trapezoidal factor) Simpson’s Rule has $\frac{\Delta x}{3}$; using the trapezoidal factor gives a wrong answer

Leveled Practice

Level 1 -- Direct Application

Problem 1. Approximate $\displaystyle\int_0^2 x^4\,dx$ using $S_4$, then compare with the exact value.

Show answer

$n=4$, $\Delta x = \frac{1}{2}$. Points: $0, 0.5, 1, 1.5, 2$.

$S_4 = \frac{1/2}{3}[0^4 + 4(0.5)^4 + 2(1)^4 + 4(1.5)^4 + 2^4]$ $= \frac{1}{6}[0 + 4(0.0625) + 2 + 4(5.0625) + 16]$ $= \frac{1}{6}[0 + 0.25 + 2 + 20.25 + 16] = \frac{38.5}{6} = \frac{77}{12} \approx 6.4167$.

Exact: $\left[\frac{x^5}{5}\right]_0^2 = \frac{32}{5} = 6.4$.

Error: $\approx 0.0167$. (Note: $f^{(4)}(x) = 24$ is constant, but the $O(1/n^4)$ bound still applies.)


Mastery Checklist


Mental Model

The Trapezoidal Rule uses straight lines (degree 1 polynomials) to approximate $f$ on each subinterval. The Midpoint Rule uses constant functions (degree 0). Simpson’s Rule uses parabolas (degree 2) on each pair of subintervals. Higher-degree approximating polynomials fit smooth functions more closely, which is why the error drops from $O(1/n^2)$ to $O(1/n^4)$: each upgrade in polynomial degree gains two orders of accuracy.


Connections

Looking back

Looking ahead


Back to Techniques of Integration | Next: Comparing Numerical Methods