4.8.16Numerical Methods

Simpson's 1 - 3 rule, 3 - 8 rule (composite) — derivation

1,606 words7 min readdifficulty · medium5 backlinks

1. What problem are we solving?

WHAT distinguishes the rules: the degree of polynomial used per panel and how many subintervals one panel spans.

Rule Polynomial Subintervals per panel Nodes needed
Trapezoid line (deg 1) 1 2
Simpson 1/3 parabola (deg 2) 2 3
Simpson 3/8 cubic (deg 3) 3 4

2. Deriving Simpson's 1/3 rule from scratch

HOW — fit a parabola through 3 points. Take one panel [x0,x2][x_0,x_2] with midpoint x1x_1, spacing hh. Shift coordinates so x0=h, x1=0, x2=hx_0=-h,\ x_1=0,\ x_2=h (allowed: integral is translation-invariant). Fit p(x)=Ax2+Bx+C.p(x)=A x^2 + Bx + C.

Match at the three nodes:

  • p(h)=Ah2Bh+C=f0p(-h)=A h^2 - Bh + C = f_0
  • p(0)=C=f1p(0)= C = f_1
  • p(h)=Ah2+Bh+C=f2p(h)=A h^2 + Bh + C = f_2
Recall Why these equations?

A parabola has 3 unknowns A,B,CA,B,C; three points pin them down uniquely. We never need to solve for BB — watch.

Add first and third: 2Ah2+2C=f0+f2Ah2=f0+f22f12Ah^2+2C=f_0+f_2 \Rightarrow A h^2=\dfrac{f_0+f_2}{2}-f_1.

Now integrate the parabola over the panel: hh(Ax2+Bx+C)dx=Ax33hh+Bx22hh+Cxhh.\int_{-h}^{h} (Ax^2+Bx+C)\,dx = A\frac{x^3}{3}\Big|_{-h}^{h}+B\frac{x^2}{2}\Big|_{-h}^{h}+C x\Big|_{-h}^{h}.

The odd BxBx term integrates to 00 (symmetric limits — why this step? odd functions cancel over [h,h][-h,h]), leaving =2Ah33+2Ch=2h3(Ah2)+2Ch.=\frac{2Ah^3}{3}+2Ch = \frac{2h}{3}\big(Ah^2\big)+2Ch.

Substitute Ah2=f0+f22f1Ah^2=\frac{f_0+f_2}{2}-f_1 and C=f1C=f_1:

=\frac{h}{3}(f_0+f_2)-\frac{2h}{3}f_1+2h f_1.$$ $$\boxed{\ \int_{x_0}^{x_2}f\,dx \approx \frac{h}{3}\big(f_0+4f_1+f_2\big)\ }$$ > [!formula] Simpson's 1/3 (single panel) > $$\int_{x_0}^{x_2} f\,dx \approx \frac{h}{3}(f_0+4f_1+f_2)$$ > The "**1/3**" is the $h/3$ out front; weights $1,4,1$. ### Composite 1/3 rule Apply per pair of strips, so $n$ must be **==even==**. Add panels $[x_0,x_2],[x_2,x_4],\dots$: $$I\approx \frac{h}{3}\Big[f_0+4(f_1+f_3+\cdots)+2(f_2+f_4+\cdots)+f_n\Big].$$ > [!intuition] Why the 4-2-4-2 pattern? > Interior **odd-index** nodes are midpoints of a panel → weight 4. **Even-index** interior nodes are shared *endpoints* between two adjacent panels → $1+1=2$. The outer ends appear once → weight 1. --- ## 3. Deriving Simpson's 3/8 rule **HOW — fit a cubic through 4 points.** Panel $[x_0,x_3]$, nodes at $-\tfrac{3h}{2}$? Easier: keep nodes $0,h,2h,3h$ and use Newton's forward formula, but the symmetric trick is cleanest. Let nodes be $-\frac{3h}{2},-\frac{h}{2},\frac{h}{2},\frac{3h}{2}$ (spacing $h$, panel width $3h$). Fit cubic $p(x)=Ax^3+Bx^2+Cx+D$. Integrating over symmetric limits kills odd powers $A,C$: $$\int_{-3h/2}^{3h/2}p\,dx = 2\Big[B\frac{x^3}{3}+Dx\Big]_0^{3h/2}=2B\frac{(3h/2)^3}{3}+2D\frac{3h}{2}.$$ Solving the 4 node equations for $B,D$ in terms of $f_0,f_1,f_2,f_3$ (standard algebra) gives weights $1,3,3,1$: $$\boxed{\ \int_{x_0}^{x_3} f\,dx\approx \frac{3h}{8}(f_0+3f_1+3f_2+f_3)\ }$$ > [!formula] Simpson's 3/8 (single panel) > $$\int_{x_0}^{x_3} f\,dx \approx \frac{3h}{8}(f_0+3f_1+3f_2+f_3)$$ > Coefficient $\frac{3h}{8}$, weights $1,3,3,1$. Needs $n$ divisible by **==3==**. ### Composite 3/8 rule $$I\approx\frac{3h}{8}\Big[f_0+3(f_1+f_2+f_4+f_5+\cdots)+2(f_3+f_6+\cdots)+f_n\Big].$$ Pattern: nodes not multiples of 3 → weight 3; shared joints (multiples of 3, interior) → weight 2. > [!intuition] When use 3/8? > When $n$ is **not** divisible by 2 cleanly, or to handle a leftover 3-strip chunk. Often: do bulk with 1/3 rule, finish last 3 strips with 3/8. ![[4.8.16-Simpson's-1-3-rule,-3-8-rule-(composite)-—-derivation.png]] --- ## 4. Error terms (WHY Simpson is so good) > [!formula] Error > 1/3 composite: $E=-\dfrac{(b-a)h^4}{180}f^{(4)}(\xi)$ — exact for cubics! > 3/8 composite: $E=-\dfrac{(b-a)h^4}{80}f^{(4)}(\xi)$. > > Both are $O(h^4)$. **Surprise:** Simpson 1/3 fits a parabola yet integrates *cubics* exactly — the odd-degree error term cancels by symmetry (same reason $B$ vanished). --- ## 5. Worked examples > [!example] Ex 1 — $\int_0^1 \frac{dx}{1+x}$ by 1/3 rule, $n=2$ > Exact $=\ln 2=0.693147$. $h=0.5$, nodes $0,0.5,1$; $f=1,\,0.6667,\,0.5$. > **Why $n=2$?** smallest even $n$ → one parabola panel. > $I\approx\frac{0.5}{3}(1+4(0.6667)+0.5)=\frac{0.5}{3}(4.1667)=0.69444$. Error $\approx 0.0013$. > [!example] Ex 2 — same integral, 1/3 with $n=4$ > $h=0.25$, $f_0=1,f_1=0.8,f_2=0.6667,f_3=0.5714,f_4=0.5$. > $I=\frac{0.25}{3}[1+4(0.8+0.5714)+2(0.6667)+0.5]=\frac{0.25}{3}[8.3145]=0.69288$. > **Why better?** halving $h$ cut error by $\sim 2^4=16\times$ — that's the $h^4$ law. > [!example] Ex 3 — $\int_0^3 x^3\,dx$ by 3/8 rule, $n=3$ > Exact $=81/4=20.25$. $h=1$, $f=0,1,8,27$. > $I=\frac{3(1)}{8}(0+3(1)+3(8)+27)=\frac{3}{8}(54)=20.25$. **Exact!** > **Why exact?** 3/8 is exact for cubics; $x^3$ is a cubic. --- ## 6. Common mistakes > [!mistake] Using odd $n$ with the 1/3 rule > **Why it feels right:** "more strips = better, who cares about parity." **Reality:** 1/3 rule consumes strips in *pairs*; an odd $n$ leaves one orphan strip with no defined parabola. **Fix:** make $n$ even, or finish the last 3 strips with the 3/8 rule. > [!mistake] Forgetting the 4-2 alternation > Students write weight 4 on *all* interior nodes. **Why tempting:** the single-panel formula has a "4". **Fix:** only **odd-index** (midpoints) get 4; even-index shared joints get 2. > [!mistake] Wrong coefficient: $h/3$ vs $3h/8$ > Mixing them up. **Mnemonic below.** Also: in 3/8, the front is $\frac{3h}{8}$, *not* $\frac{h}{8}$. --- > [!recall]- Feynman: explain to a 12-year-old > Imagine measuring the area under a wiggly hill. The lazy way draws straight lines between fence posts (trapezoid) — but straight lines miss the curve. Simpson is smarter: he bends a flexible ruler so it touches **three** posts at once, making a smooth U-shape (parabola) that hugs the hill. Add up these curved-ruler areas. For extra wiggly bits he uses **four** posts and an S-shaped ruler (cubic) — that's the 3/8 rule. The fancier ruler = tinier error. > [!mnemonic] Remembering both rules > **"One-Third → 1-4-1, even pairs."** (3 numbers, sum 6, $/6\cdot 2h=h/3$... weights $1,4,1$.) > **"Three-Eighths → 1-3-3-1, threes."** Coefficient matches name: $\frac{3h}{8}$. Count the digits: 1/3 rule has **3** weights, 3/8 rule has **4** weights. --- ## 7. Flashcards #flashcards/maths What polynomial does Simpson's 1/3 rule fit per panel? ::: A parabola (degree 2) through 3 points. Single-panel Simpson 1/3 formula? ::: $\frac{h}{3}(f_0+4f_1+f_2)$. Single-panel Simpson 3/8 formula? ::: $\frac{3h}{8}(f_0+3f_1+3f_2+f_3)$. Constraint on $n$ for composite 1/3? ::: $n$ must be even (strips taken in pairs). Constraint on $n$ for composite 3/8? ::: $n$ divisible by 3. Weight pattern in composite 1/3? ::: $1,4,2,4,2,\dots,4,1$ (odd-index → 4, even interior → 2). Why is Simpson 1/3 exact for cubics despite fitting a parabola? ::: The odd-degree error term cancels by symmetry over $[-h,h]$. Order of error for both Simpson rules? ::: $O(h^4)$; error $\propto f^{(4)}(\xi)$. 1/3 composite error term? ::: $-\frac{(b-a)h^4}{180}f^{(4)}(\xi)$. 3/8 composite error term? ::: $-\frac{(b-a)h^4}{80}f^{(4)}(\xi)$. Why does the $Bx$ term vanish in the derivation? ::: It is odd; its integral over symmetric limits $[-h,h]$ is zero. Combined strategy when n is odd? ::: Use 1/3 on most strips, finish last 3 strips with 3/8 rule. --- ## 8. Connections - [[Trapezoidal Rule]] — degree-1 ancestor; Simpson is the degree-2/3 upgrade. - [[Newton-Cotes Formulas]] — Simpson rules are the $n=2,3$ closed Newton-Cotes members. - [[Lagrange Interpolation]] — provides the fitted polynomial whose integral gives the weights. - [[Richardson Extrapolation]] — combining 1/3 results halves error → leads to [[Romberg Integration]]. - [[Gaussian Quadrature]] — optimal-node alternative beating equal-spacing rules. - [[Taylor's Theorem]] — source of the $h^4 f^{(4)}$ error term. ## 🖼️ Concept Map ```mermaid flowchart TD P[Cannot integrate f exactly] -->|solution| Q[Numerical quadrature] Q -->|approximates I| W[Weighted sum of f values] Q -->|fit polynomial per panel| POLY[Replace curve with polynomial] POLY -->|degree 1 line| TR[Trapezoid rule] POLY -->|degree 2 parabola| S13[Simpson 1/3 rule] POLY -->|degree 3 cubic| S38[Simpson 3/8 rule] S13 -->|fit through 3 nodes| DER[Integrate over symmetric panel] DER -->|odd Bx term cancels| BOX[weights 1 4 1, h/3 out front] BOX -->|apply per pair of strips| COMP[Composite 1/3 rule] COMP -->|requires| EVEN[n must be even] COMP -->|shared endpoints| PAT[4-2-4-2 weight pattern] S38 -->|fit through 4 nodes| CUBIC[weights 1 3 3 1, 3h/8] ``` ## 🔊 Hinglish (regional understanding) > [!intuition]- Hinglish mein samjho > Dekho, integral ka exact value nikalna har baar possible nahi hota, isliye hum curve ko ek simple polynomial se *replace* kar dete hain jise integrate karna easy hai. Trapezoidal rule sirf seedhi line (degree 1) use karta hai, lekin Simpson smart hai: 1/3 rule do strips par ek **parabola** (degree 2, teen points) fit karta hai, aur 3/8 rule teen strips par ek **cubic** (degree 3, chaar points). Jitna better polynomial, utna kam error. > > Derivation ka asli trick yeh hai: nodes ko symmetric coordinates mein le aao (jaise $-h,0,h$). Tab parabola ka odd term $Bx$ integrate karne par zero ho jata hai, isliye humein $B$ solve karne ki zaroorat hi nahi padti. Bas $A h^2 = \frac{f_0+f_2}{2}-f_1$ aur $C=f_1$ daalo, aur seedha $\frac{h}{3}(f_0+4f_1+f_2)$ aa jata hai. Yahi symmetry ki wajah se ek mazedaar baat hoti hai — parabola fit karke bhi Simpson 1/3 **cubic** ko bilkul exactly integrate kar deta hai! > > Composite version mein bas panels jod do. 1/3 ke liye $n$ **even** hona chahiye (strips pair mein jaate hain), weights ka pattern $1,4,2,4,2,...,4,1$ — odd-index midpoints ko 4, beech ke shared joints ko 2. 3/8 ke liye $n$ ko **3 se divisible** hona chahiye, weights $1,3,3,...,1$. Dono ka error $O(h^4)$ hota hai, matlab $h$ ko aadha karo to error $16$ guna kam — bahut powerful! Exam mein agar $n$ odd ho, to zyada part 1/3 se karo aur last 3 strips 3/8 se finish karo. ![[audio/4.8.16-Simpson's-1-3-rule,-3-8-rule-(composite)-—-derivation.mp3]]

Test yourself — Numerical Methods

Connections