Simpson’s Rule Calculator (with Table and Error)
- Free
- No sign-up
- Works on phones
- Shows the working
This Simpson’s rule calculator approximates a definite integral by fitting parabolas through groups of three points. It shows ( Delta x ), every point ( x_i ) with ( f(x_i) ) and its 1, 4, 2, 4, …, 4, 1 weight, the weighted sum, the approximation ( S_n ), the exact integral and the error. Simpson’s rule is usually far more accurate than the trapezoidal or midpoint rule for the same number of points.
It’s free and needs no sign-up.
![Simpson's rule calculator: Simpson’s rule fits parabolas through the points of y = sin x on [0, π] (n = 6) and gives…](https://www.calculuscalc.com/wp-content/uploads/2026/10/simpsons-rule-calculator-diagram.webp)
How to use it
- Type the function, for example
sin(x),e^(-x^2)or1/x. - Enter the limits a and b. You can type
pifor ( pi ). - Enter an even number of subintervals n.
- Press Approximate.
Formula
With ( Delta x = frac{b – a}{n} ), n even, and ( x_i = a + i,Delta x ):
$$S_n = frac{Delta x}{3}left[f(x_0) + 4f(x_1) + 2f(x_2) + 4f(x_3) + cdots + 2f(x_{n-2}) + 4f(x_{n-1}) + f(x_n)right]$$
The endpoints have weight 1, odd-numbered points weight 4 and even-numbered interior points weight 2. Each pair of subintervals is covered by a parabola through three points, and the area under that parabola is exactly ( frac{Delta x}{3}[f(x_{i-1}) + 4f(x_i) + f(x_{i+1})] ). That’s why n must be even.
Worked example: ∫₀^π sin x dx with n = 6
As loaded above: ( Delta x = frac{pi}{6} ).

| i | ( x_i ) | ( sin x_i ) | Weight |
|---|---|---|---|
| 0 | 0 | 0 | 1 |
| 1 | ( frac{pi}{6} ) | 0.5 | 4 |
| 2 | ( frac{pi}{3} ) | 0.866025 | 2 |
| 3 | ( frac{pi}{2} ) | 1 | 4 |
| 4 | ( frac{2pi}{3} ) | 0.866025 | 2 |
| 5 | ( frac{5pi}{6} ) | 0.5 | 4 |
| 6 | ( pi ) | 0 | 1 |
The weighted sum is ( 4(0.5 + 1 + 0.5) + 2(0.866025 times 2) = 11.464102 ), so
$$S_6 = frac{pi/6}{3} times 11.464102 approx 2.000863$$
The exact value is 2, an error of only 0.00086. The trapezoidal rule with the same six subintervals gives 1.954097, an error of 0.046, more than 50 times larger.
Worked example: a curve with no antiderivative
( int_0^1 e^{-x^2},dx ) cannot be found with elementary antiderivatives (see the integral of e^(x²)), so numerical methods are the practical route. With n = 4, Simpson’s rule gives 0.746855; the true value is 0.746824. The trapezoidal rule with n = 4 gives 0.742984.
Worked example: from data
Speeds of 0, 6, 10, 12 and 13 m/s recorded every 2 seconds give a distance of
$$S_4 = frac{2}{3}left[0 + 4(6) + 2(10) + 4(12) + 13right] = frac{2}{3}(105) = 70 text{ m}$$
compared with 69 m from the trapezoidal rule.
Error bound
If ( |f^{(4)}(x)| le K ) on ( [a, b] ), then

$$|E_S| le frac{K(b - a)^5}{180n^4}$$
The error falls like ( frac{1}{n^4} ): doubling n divides it by about 16. Because the fourth derivative of any cubic is zero, Simpson’s rule is exact for polynomials up to degree 3. Try x^3 on ( [0, 2] ) with n = 2: you get exactly 4.
Using a simpson's rule calculator for 1/3 and 3/8 rules
The formula above is Simpson’s 1/3 rule, the one taught in most courses. However, the 3/8 rule fits cubics through four points and needs n to be a multiple of 3. It has a similar accuracy. If you have an odd number of subintervals, you can use the 3/8 rule for three of them and the 1/3 rule for the rest.
Common mistakes
- Using an odd n. The calculator will remind you; Simpson’s 1/3 rule needs pairs of subintervals.
- Mixing up the 2s and 4s. Odd-indexed points get 4, while even interior points get 2.
- Dividing by 2 instead of 3.
Step-by-step method
- Check that n is even, then compute ( Delta x = frac{b – a}{n} ).
- List the points ( x_0, x_1, ldots, x_n ) and evaluate f at each.
- Weight them 1, 4, 2, 4, 2, …, 4, 1.
- Add the weighted values.
- Multiply by ( frac{Delta x}{3} ).
Worked example: ∫₀⁴ √x dx with n = 4
With ( Delta x = 1 ):

$$S_4 = frac{1}{3}left[0 + 4(1) + 2(1.4142) + 4(1.7321) + 2right] = frac{15.7566}{3} approx 5.2522$$
The exact value is ( frac{16}{3} approx 5.3333 ). The error (0.081) is larger than usual because ( sqrt{x} ) has an infinite slope at 0, where Simpson’s error bound doesn’t apply; for smooth functions Simpson’s rule is far more accurate.
Worked example: estimating π
( int_0^1 frac{4}{1 + x^2},dx = pi ). With n = 4, Simpson’s rule on ( frac{1}{1 + x^2} ) gives 0.7853921, so
$$pi approx 4 times 0.7853921 = 3.1415686$$
an error of only 0.000024 from just five function values.
Where the formula comes from
Through three equally spaced points ( (-h, y_0) ), ( (0, y_1) ), ( (h, y_2) ) there is exactly one parabola ( y = Ax^2 + Bx + C ). Integrating it from ( -h ) to h gives
$$int_{-h}^{h}(Ax^2 + Bx + C),dx = frac{2Ah^3}{3} + 2Ch = frac{h}{3}(y_0 + 4y_1 + y_2)$$
using ( y_1 = C ) and ( y_0 + y_2 = 2Ah^2 + 2C ). Repeating this on each pair of subintervals and adding gives the 1, 4, 2, 4, …, 1 pattern, since the shared points are counted twice.
Comparison for ∫₀¹ eˣ dx, n = 4
| Method | Value | Error |
|---|---|---|
| Trapezoidal rule | 1.727222 | 0.00894 |
| Simpson’s rule | 1.718319 | 0.000037 |
| Exact ( e – 1 ) | 1.718282 | — |
Simpson’s rule is more than 200 times more accurate here, for the same five function values.
Practice problems
- Approximate ( int_0^2 x^4,dx ) with n = 2.
- Next, Approximate ( int_0^{pi} sin x,dx ) with n = 2.
- Approximate ( int_1^3 frac{1}{x},dx ) with n = 2.
Answers: 1. ( frac{1}{3}[0 + 4(1) + 16] = frac{20}{3} approx 6.667 ) (exact 6.4; not exact because the integrand is degree 4). 2. ( frac{pi/2}{3}[0 + 4(1) + 0] = frac{2pi}{3} approx 2.094 ) (exact 2). 3. ( frac{1}{3}[1 + 4(0.5) + 0.3333] = 1.1111 ) (exact ( ln 3 approx 1.0986 )).
How fast the error falls
For ( int_1^2 frac{1}{x},dx = ln 2 ), doubling n from 4 to 8 cuts Simpson’s error from about ( 1.07 times 10^{-4} ) to about ( 7.4 times 10^{-6} ), a factor of about 15, close to the 16 that the ( frac{1}{n^4} ) error bound predicts. In contrast, the trapezoidal rule’s error only falls by a factor of about 4 for the same doubling.
Related guides
Further reading
- Simpson’s rule (Wikipedia) — derivation, the 3/8 rule and composite versions.
FAQ
What is Simpson’s rule?
A numerical method that approximates ( int_a^b f(x),dx ) by fitting parabolas through consecutive triples of points: ( S_n = frac{Delta x}{3}[f(x_0) + 4f(x_1) + 2f(x_2) + cdots + 4f(x_{n-1}) + f(x_n)] ).
Why does n have to be even?
Each parabola spans two subintervals, so the subintervals must pair up.
Is Simpson’s rule more accurate than the trapezoidal rule?
Usually much more. Its error shrinks like ( frac{1}{n^4} ) instead of ( frac{1}{n^2} ), and it is exact for cubics.
What does the 1-4-2-4-1 pattern mean?
They are the weights: 1 for the endpoints, 4 for odd-numbered points and 2 for even-numbered interior points.
Why is Simpson’s rule exact for cubics?
The parabola fit is exact for quadratics, and the error from the cubic term cancels by symmetry over each pair of subintervals.
Is Simpson’s rule better than the midpoint rule?
Usually, yes. In fact Simpson’s rule equals ( frac{2M_n + T_n}{3} ), a weighted average of the midpoint and trapezoidal rules that cancels their leading errors.
