Euler Hall — free maths guides

Simpson's rule

Apply Simpson's rule to a table or a formula with an even number of pieces. The idea in plain words, a worked example, and a check with the answers shown — part of the free Calculus II guides.

Fit a curve through three points, not a line through two

The trapezoidal rule approximates the integrand by straight lines. Simpson's rule goes one degree further: it fits a parabola through three consecutive sample points.

That needs two subintervals per parabola, sonn must be even. Withnn pieces there aren/2n/2 parabolas, and adding their areas gives the weights

Read the pattern before anything else:1,4,2,4,2,…,2,4,11, 4, 2, 4, 2, \ldots, 2, 4, 1, then divide by three. Odd-indexed interior samples get 4, even-indexed interior samples get 2, the ends get 1.

Where the one third comes from. For a parabolay=Ax2+Bx+Cy=Ax^2+Bx+C through(−h,y0)(-h,y_0),(0,y1)(0,y_1),(h,y2)(h,y_2), the exact area from−h-h tohh is ∫−hh(Ax2+C) dx=h3(2Ah2+6C)=h3(y0+4y1+y2),\int_{-h}^{h}(Ax^2+C)\,dx = \frac{h}{3}(2Ah^2+6C) = \frac{h}{3}\left(y_0+4y_1+y_2\right), usingy0+y2=2Ah2+2Cy_0+y_2 = 2Ah^2+2C andy1=Cy_1=C. Note theBxBx term integrates to zero over a symmetric interval, so a parabola's area depends only on the three heights — which is what makes the rule possible at all.

Why it is so much better than it looks. The rule is built from quadratics, but it is exact for every cubic too. That extra degree is free: the error term carries a fourth derivative, so any polynomial of degree at most three is integrated exactly. The next-but-one skill asks you to prove that, and the family that tests it draws the degree.

Why the weights are 1, 4, 2, 4, 1 and why the divisor is three

Take one parabola throughy0,y1,y2y_0,y_1,y_2 atx=−h,0,hx=-h,0,h. On the symmetric interval the odd term integrates away:

Now express2Ah2+6C2Ah^2+6C in the three heights. From the parabola: y0=Ah2−Bh+C,y1=C,y2=Ah2+Bh+C,y_0 = Ah^2-Bh+C,\quad y_1 = C,\quad y_2 = Ah^2+Bh+C, soy0+y2=2Ah2+2Cy_0+y_2 = 2Ah^2+2C and therefore2Ah2+6C=(y0+y2)+4y1=y0+4y1+y22Ah^2+6C = (y_0+y_2)+4y_1 = y_0+4y_1+y_2.

That is the1,4,11,4,1 pattern for one parabola. Shifting it horizontally does not change the area, so the same formula applies to every pair of pieces. Adding the parabolas, the shared interior points are counted twice — once as the right end of one parabola and once as the left end of the next — and that is where the 2s come from, exactly as in the trapezoidal rule.

Why the divisor is three. It is the13\frac13 inAh33\frac{Ah^3}{3}: the integral ofx2x^2 brings a third. Nothing more.

The cubic exactness. A cubic's fourth derivative is zero, and Simpson's error isK(b−a)5180n4\frac{K(b-a)^5}{180n^4} withKK bounding∣f(4)∣|f^{(4)}|. So the formula is not merely "better than the trapezoid" — it is exactly right on a whole degree of polynomials the trapezoid gets wrong.

Worked example: a table with four pieces

Estimate∫04f\int_0^4 f fromf(0)=2f(0)=2,f(1)=5f(1)=5,f(2)=6f(2)=6,f(3)=5f(3)=5,f(4)=2f(4)=2.

Δx=1\Delta x = 1 andn=4n=4 is even, so Simpson applies. Weights1,4,2,4,11,4,2,4,1:

Compare the trapezoidal estimate:T4=12(2+10+12+10+2)=18T_4 = \frac12(2+10+12+10+2) = 18, and563≈18.67\frac{56}{3}\approx18.67. The two differ by23\frac23, and for a curve that peaks in the middle (concave down there) the trapezoid should under-estimate —18<18.6718 < 18.67. ✓

An oddnn refused. Had the table had five pieces instead of four, Simpson's rule would not apply as stated: a parabola needs two pieces, so an odd count leaves one piece unpaired. The honest response is to use the trapezoid on the last piece and Simpson on the rest, and to say so — not to apply the weight pattern to a count it does not fit.

By the end you can
  • Apply Simpson's rule to a table or a formula with an even number of pieces
  • Explain the 1,4,2,4,1 weights and the divisor three
  • Say for which polynomial degrees the rule is exact
Check yourself
  1. 1. Estimate∫04x dx\int_0^4 x\,dx withn=4n=4 by Simpson's rule. Is it exact?
  2. 2. Why does Simpson's rule need an even number of pieces?
  3. 3. Estimate∫02x4 dx\int_0^2 x^4\,dx withn=2n=2 by Simpson and compare with325\frac{32}{5}.
Answers

1. Weights1,4,2,4,11,4,2,4,1 on values0,1,2,3,40,1,2,3,4:S4=13(0+4+4+12+4)=243=8S_4=\frac13(0+4+4+12+4)=\frac{24}{3}=8. The exact value is 8, so it is exact — as it is for every polynomial of degree at most three. 2. Each parabola passes through three points and therefore spans two subintervals; an odd count leaves one piece without a partner. 3. Values0,1,160,1,16:S2=13(0+4+16)=203S_2=\frac13(0+4+16)=\frac{20}{3}. The exact value is325=6.4\frac{32}{5}=6.4 and203≈6.67\frac{20}{3}\approx6.67, so the estimate is high by about0.270.27 — the rule is not exact for a quartic.

Work out where to start — free, no accountAnswer six real questions — free, no account