Burden & Faires, 9th Ed. - §4.3–4.7

Chapter 9: Numerical Integration

Trapezoidal Rule · Simpson's 1/3 & 3/8 Rules · Composite rules · Error bounds & degree of precision

Chapter 5 built a polynomial to approximate a function; this chapter integrates that polynomial exactly and calls the result an approximation of $\int_a^b f(x)\,dx$. It's a remarkably direct idea - approximate $f$ by something easy to integrate, then integrate that - and the accuracy jump from a straight line (Trapezoidal Rule) to a parabola (Simpson's Rule) turns out to be far larger than the modest jump in complexity would suggest.

Section 4.3

The Trapezoidal Rule

Derivation - Integrate the Linear Interpolant
Replace $f$ on $[a,b]$ by the linear interpolant $P_1(x)$ through $(a,f(a))$ and $(b,f(b))$ (Chapter 5), then integrate $P_1$ exactly: $$\int_a^b f(x)\,dx \approx \int_a^b P_1(x)\,dx = \frac{b-a}{2}\big[f(a)+f(b)\big]$$ - the area of the trapezoid under the secant line. Integrating the interpolation error formula (Theorem 5.2) gives the exact error: $$\int_a^b f(x)\,dx = \frac{b-a}{2}[f(a)+f(b)] - \frac{(b-a)^3}{12}f''(\xi), \quad \xi\in(a,b)$$
Composite Trapezoidal Rule
Split $[a,b]$ into $n$ equal subintervals of width $h=(b-a)/n$, apply the rule on each, and sum: $$\int_a^b f(x)\,dx \approx \frac{h}{2}\left[f(x_0) + 2\sum_{i=1}^{n-1}f(x_i) + f(x_n)\right], \qquad \text{error} = -\frac{(b-a)h^2}{12}f''(\xi)$$ Composite trapezoidal is $O(h^2)$ - halving $h$ (doubling the work) roughly quarters the error.
Composite trapezoidal approximation of $\int_0^\pi \sin(x)\,dx = 2$. Each trapezoid's straight top visibly cuts the corners off the curve - systematically underestimating area wherever $f$ is concave down, exactly as the $-f''(\xi)$ error term predicts.
📘 Example 9.1 - Trapezoidal Rule with $n=4$
Approximate $\int_0^\pi \sin(x)\,dx$ (true value $2$) using composite trapezoidal with $n=4$. Solution $h=\pi/4$, nodes $0,\,\pi/4,\,\pi/2,\,3\pi/4,\,\pi$; $f$-values $0,\,0.70711,\,1,\,0.70711,\,0$. $$\approx \frac{\pi/4}{2}\big[0 + 2(0.70711+1+0.70711)+0\big] = \frac{\pi}{8}(4.82843) = 1.89612$$ Approximation $1.89612$, true value $2$ - error $0.10388$, a $5.2\%$ relative error from just 4 trapezoids. Error bound: $\dfrac{(b-a)h^2}{12}\max|f''| = \dfrac{\pi(\pi/4)^2}{12}(1) = 0.16149$ - the actual error is comfortably inside it.
Section 4.4

Simpson's Rules

Simpson's 1/3 Rule

Derivation - Integrate the Quadratic Interpolant
Using 3 equally spaced points $a=x_0,\,x_1=a+h,\,x_2=b$ ($h=(b-a)/2$), replace $f$ by the quadratic interpolant $P_2(x)$ through all three and integrate exactly: $$\int_{x_0}^{x_2} f(x)\,dx \approx \frac{h}{3}\big[f(x_0)+4f(x_1)+f(x_2)\big], \qquad \text{error} = -\frac{h^5}{90}f^{(4)}(\xi)$$ Remarkably, although Simpson's Rule is derived from a quadratic fit, the error term involves $f^{(4)}$, not $f'''$ - the rule is exact not just for quadratics but for every cubic too (its "degree of precision" is 3, one better than its construction would suggest, from a symmetry cancellation in the derivation).

Simpson's 3/8 Rule

The Cubic-Based Variant
Using 4 equally spaced points and a cubic interpolant: $$\int_{x_0}^{x_3} f(x)\,dx \approx \frac{3h}{8}\big[f(x_0)+3f(x_1)+3f(x_2)+f(x_3)\big], \qquad \text{error} = -\frac{3h^5}{80}f^{(4)}(\xi)$$ Same order $O(h^5)$ per panel as Simpson's 1/3 rule; its main practical use is handling an odd number of subintervals in a composite rule - pair one 3/8 panel (3 subintervals) with an even number of 1/3 panels to cover any total subinterval count.
Composite Simpson's Rule
For $n$ (even) subintervals of width $h=(b-a)/n$: $$\int_a^b f(x)\,dx \approx \frac{h}{3}\left[f(x_0) + 4\!\!\sum_{i\text{ odd}}f(x_i) + 2\!\!\sum_{i\text{ even},\,i\neq0,n}f(x_i) + f(x_n)\right], \qquad \text{error} = -\frac{(b-a)h^4}{180}f^{(4)}(\xi)$$ Composite Simpson is $O(h^4)$ - two full orders better than trapezoidal for the same step size.
Composite Simpson's Rule on the same $\int_0^\pi\sin(x)\,dx$ problem: each panel's parabolic arc hugs the true curve far more closely than trapezoidal's straight edges - visibly, and by two orders of $h$.
📘 Example 9.2 - Simpson's Rule, Same Problem as Example 9.1
Repeat Example 9.1 ($\int_0^\pi\sin x\,dx=2$) with composite Simpson's Rule, $n=4$. Solution Odd-indexed nodes ($x_1,x_3$) get weight 4; even-interior ($x_2$) gets weight 2. $$\approx \frac{\pi/4}{3}\big[0 + 4(0.70711) + 2(1) + 4(0.70711) + 0\big] = \frac{\pi}{12}(7.65685) = 2.00456$$ Error $\approx0.00456$ - about $23\times$ smaller than trapezoidal's $0.10388$ at the same $n=4$ and nearly the same cost (5 function evaluations vs. 5). Error bound: $\dfrac{(b-a)h^4}{180}\max|f^{(4)}| = \dfrac{\pi(\pi/4)^4}{180}(1) = 0.006641$, comfortably containing the actual error.
Section 4.3–4.7 Summary

Composite Rules & Comparison

📘 Example 9.3 - Convergence Rate Head-to-Head
Compare trapezoidal and Simpson error as $n$ doubles, for $\int_1^2 \frac{1}{x}\,dx = \ln 2 = 0.693147$. Solution
$n$Trapezoidal errorSimpson error
4$3.877\times10^{-3}$$1.068\times10^{-4}$
8$9.747\times10^{-4}$$7.350\times10^{-6}$
Doubling $n$: trapezoidal error drops by a factor of $\approx3.98\approx2^2$ (confirming $O(h^2)$); Simpson error drops by a factor of $\approx14.5\approx2^4$ (confirming $O(h^4)$). At $n=8$, Simpson is already $132\times$ more accurate than trapezoidal - the gap only widens as $n$ grows further.
Log-log error vs. $n$ for both rules on $\int_1^2(1/x)\,dx$: trapezoidal's slope of $-2$ against Simpson's slope of $-4$ makes the $O(h^2)$ vs. $O(h^4)$ gap visually unmistakable.
Practice

Practice Problem

Try this problem yourself before expanding the solution below.

✏️ Practice Problem 9.1 - Trapezoidal vs. Simpson's on $\int_1^2 \frac{1}{x}\,dx$
Approximate $\displaystyle\int_1^2 \frac{1}{x}\,dx$ (true value $\ln 2 = 0.693147$) using composite trapezoidal with $n=4$ and composite Simpson's $1/3$ rule with $n=4$. Compare both errors. Solution With $n=4$, $h=0.25$, the nodes are $x_0,\ldots,x_4 = 1, 1.25, 1.5, 1.75, 2$ with $f$-values $1, 0.8, 0.666667, 0.571429, 0.5$.

Composite trapezoidal: $$T = \frac{h}{2}\Big[f(x_0)+2f(x_1)+2f(x_2)+2f(x_3)+f(x_4)\Big] = 0.697024.$$ Composite Simpson's $1/3$: $$S = \frac{h}{3}\Big[f(x_0)+4f(x_1)+2f(x_2)+4f(x_3)+f(x_4)\Big] = 0.693254.$$ Trapezoidal error $\approx0.003877$; Simpson's error $\approx0.000107$ - about 36 times smaller, consistent with Simpson's $O(h^4)$ rate against trapezoidal's $O(h^2)$ for the same $n$.
Connections Across the Course
  • Both rules are built by integrating the same interpolating polynomials from Chapter 5 - their error terms are the integral of Theorem 5.2's interpolation error.
  • Applying Richardson extrapolation (Chapter 8) directly to the composite trapezoidal rule as $h$ halves produces Romberg integration, Chapter 10's opening topic.
  • Gaussian quadrature, also in Chapter 10, asks a different question entirely - not "integrate the interpolant through fixed equally spaced nodes" but "choose the nodes themselves to maximize accuracy."
Scroll to Top