Mathwords logoMathwords

Simpson's Rule — Formula, Examples & Definition

Simpson's Rule

A method for approximating a definite integral Definite integral notation: the integral from a to b of f(x) dx using parabolic approximations of f. The parabolas are drawn as shown below.

To use Simpson's rule follow these two steps:

Two-step Simpson's Rule: partition [a,b] into n equal subintervals (n even), then integrate using...
Graph of y=f(x) with shaded region from x₀=a to x₄=b divided into subintervals of width Δx, approximated by parabolas....

 

See also

Partition, definite integral, trapezoid rule

Key Formula

abf(x)dxΔx3[f(x0)+4f(x1)+2f(x2)+4f(x3)+2f(x4)++4f(xn1)+f(xn)]\int_a^b f(x)\,dx \approx \frac{\Delta x}{3}\Big[f(x_0) + 4f(x_1) + 2f(x_2) + 4f(x_3) + 2f(x_4) + \cdots + 4f(x_{n-1}) + f(x_n)\Big]
Where:
  • a,ba, b = The lower and upper limits of integration
  • nn = The number of subintervals (must be even)
  • Δx\Delta x = The width of each subinterval: $\Delta x = \frac{b - a}{n}$
  • xix_i = The partition points: $x_i = a + i\,\Delta x$ for $i = 0, 1, 2, \ldots, n$
  • f(xi)f(x_i) = The value of the function at each partition point

Worked Example

Problem: Use Simpson's Rule with n = 4 subintervals to approximate the integral 02x2dx\int_0^2 x^2\,dx.
Step 1: Compute the subinterval width Δx\Delta x.
Δx=ban=204=0.5\Delta x = \frac{b - a}{n} = \frac{2 - 0}{4} = 0.5
Step 2: Identify the partition points x0,x1,x2,x3,x4x_0, x_1, x_2, x_3, x_4.
x0=0,x1=0.5,x2=1,x3=1.5,x4=2x_0 = 0,\quad x_1 = 0.5,\quad x_2 = 1,\quad x_3 = 1.5,\quad x_4 = 2
Step 3: Evaluate f(x)=x2f(x) = x^2 at each partition point.
f(0)=0,f(0.5)=0.25,f(1)=1,f(1.5)=2.25,f(2)=4f(0) = 0,\quad f(0.5) = 0.25,\quad f(1) = 1,\quad f(1.5) = 2.25,\quad f(2) = 4
Step 4: Apply Simpson's Rule with the pattern of coefficients: 1, 4, 2, 4, 1.
Δx3[f(x0)+4f(x1)+2f(x2)+4f(x3)+f(x4)]=0.53[0+4(0.25)+2(1)+4(2.25)+4]\frac{\Delta x}{3}\Big[f(x_0) + 4f(x_1) + 2f(x_2) + 4f(x_3) + f(x_4)\Big] = \frac{0.5}{3}\Big[0 + 4(0.25) + 2(1) + 4(2.25) + 4\Big]
Step 5: Simplify the arithmetic inside the brackets, then multiply.
=0.53[0+1+2+9+4]=0.53(16)=832.6667= \frac{0.5}{3}\Big[0 + 1 + 2 + 9 + 4\Big] = \frac{0.5}{3}(16) = \frac{8}{3} \approx 2.6667
Answer: The approximation is 832.6667\frac{8}{3} \approx 2.6667. The exact value of 02x2dx=83\int_0^2 x^2\,dx = \frac{8}{3}, so Simpson's Rule gives the exact answer here because x2x^2 is a polynomial of degree 2 (a quadratic), and Simpson's Rule is exact for polynomials of degree 3 or less.

Another Example

This example uses a non-polynomial function where Simpson's Rule does not give the exact answer, illustrating its role as an approximation technique and showing how small the error can be even with few subintervals.

Problem: Use Simpson's Rule with n = 4 subintervals to approximate 131xdx\int_1^3 \frac{1}{x}\,dx.
Step 1: Compute the subinterval width.
Δx=314=0.5\Delta x = \frac{3 - 1}{4} = 0.5
Step 2: List the partition points.
x0=1,x1=1.5,x2=2,x3=2.5,x4=3x_0 = 1,\quad x_1 = 1.5,\quad x_2 = 2,\quad x_3 = 2.5,\quad x_4 = 3
Step 3: Evaluate f(x)=1xf(x) = \frac{1}{x} at each point.
f(1)=1,f(1.5)=23,f(2)=0.5,f(2.5)=0.4,f(3)=13f(1) = 1,\quad f(1.5) = \tfrac{2}{3},\quad f(2) = 0.5,\quad f(2.5) = 0.4,\quad f(3) = \tfrac{1}{3}
Step 4: Substitute into Simpson's Rule.
0.53[1+4 ⁣(23)+2(0.5)+4(0.4)+13]=16[1+83+1+1.6+13]\frac{0.5}{3}\Big[1 + 4\!\left(\tfrac{2}{3}\right) + 2(0.5) + 4(0.4) + \tfrac{1}{3}\Big] = \frac{1}{6}\Big[1 + \tfrac{8}{3} + 1 + 1.6 + \tfrac{1}{3}\Big]
Step 5: Compute the bracket sum and final result.
=16[1+2.6667+1+1.6+0.3333]=16(6.6)=1.1= \frac{1}{6}\Big[1 + 2.6667 + 1 + 1.6 + 0.3333\Big] = \frac{1}{6}(6.6) = 1.1
Answer: The approximation is 1.11.1. The exact value is ln31.0986\ln 3 \approx 1.0986, so the error is only about 0.00140.0014.

Frequently Asked Questions

Why does n have to be even in Simpson's Rule?
Simpson's Rule works by fitting a parabola through every group of three consecutive points, which spans two subintervals at a time. If n were odd, the last subinterval would be left without a partner, and you could not form a complete parabolic segment. This is why n must always be an even number.
What is the difference between Simpson's Rule and the Trapezoid Rule?
The Trapezoid Rule connects consecutive points with straight lines (degree 1), while Simpson's Rule connects groups of three points with parabolas (degree 2). Because parabolas can better match the curvature of most functions, Simpson's Rule generally produces a more accurate approximation for the same number of subintervals. The error in the Trapezoid Rule decreases as O(Δx2)O(\Delta x^2), whereas Simpson's Rule error decreases much faster at O(Δx4)O(\Delta x^4).
When is Simpson's Rule exact?
Simpson's Rule gives the exact value of the integral when the integrand is a polynomial of degree 3 or less. This is because the parabolic interpolation used in each pair of subintervals perfectly captures cubic (and lower-degree) behavior, causing all error terms to cancel out.

Simpson's Rule vs. Trapezoid Rule

Simpson's RuleTrapezoid Rule
Approximating shapeParabolas (quadratic curves) through every 3 pointsStraight line segments (trapezoids) through every 2 points
Coefficient pattern1, 4, 2, 4, 2, …, 4, 1 (divided by 3)1, 2, 2, 2, …, 2, 1 (divided by 2)
Requirement on nn must be evenn can be any positive integer
Error orderO(Δx4)O(\Delta x^4) — fourth-order accuracyO(Δx2)O(\Delta x^2) — second-order accuracy
Exact for polynomials up to degree3 (cubic)1 (linear)

Why It Matters

Simpson's Rule appears in AP Calculus and university calculus courses as a core numerical integration technique. Engineers and scientists rely on it when an antiderivative is impossible or impractical to find analytically — for instance, when working with experimental data given only as a table of values. Its high accuracy relative to its simplicity makes it one of the most widely used numerical methods in practice.

Common Mistakes

Mistake: Using an odd number of subintervals.
Correction: Simpson's Rule requires an even number of subintervals (n must be even). Each parabolic segment spans two subintervals, so an odd n leaves an unmatched interval. Always check that n is even before applying the formula.
Mistake: Mixing up the alternating coefficients 4 and 2.
Correction: The coefficients follow the strict pattern 1, 4, 2, 4, 2, …, 4, 1. The first and last values get coefficient 1, all odd-indexed values get 4, and all even-indexed interior values get 2. A helpful check: the sum of the coefficients should equal n3(1+4+2+)=3n3(average coefficient)\frac{n}{3}(1 + 4 + 2 + \cdots) = \frac{3n}{3} \cdot \text{(average coefficient)}, or more practically, just verify the pattern alternates correctly starting with 4 after the first term.

Related Terms