How to use Simpson’s rule to approximate an integral

When we can evaluate a function but its integral is harder to find, Simpson’s rule gives us another way to estimate it. It fits a parabola across every pair of subintervals. That pairing is why we start with an even number of subintervals.

Divide the interval and assign the weights

For an even n, use the width Δx=b-an and sample at xi=a+iΔx. The two endpoints have weight 1, interior odd indices have weight 4, and interior even indices have weight 2. Multiply the weighted sum by Δx3.

Approximate the integral of an exponential

∫03ex2dx

With n=4, the width is 34 and the multiplier is 14. Put the five sample points in order so the weights go with the right values.

The five samples and their weights
Sample pointWeightFunction value
011
344e9/16
322e9/4
944e81/16
31e9
S4=14(1+4e9/16+2e9/4+4e81/16+e9)S4≈2190.505

That is the four-subinterval estimate. A finer partition gives a different estimate, so the number of subintervals is part of the answer.