Simpson’s Rule Calculator (1/3 and 3/8 Rules, Step by Step)

CalculusFreeNo sign-up

A Simpson’s rule calculator estimates a definite integral with parabolas over pairs of subintervals: Sn = (h/3)[f(x₀) + 4f(x₁) + 2f(x₂) + … + 4f(xn−1) + f(xn)], where h = (b − a)/n and n is even. For 1/x from 1 to 2 with n = 4, h = 0.25 and S₄ ≈ 0.693254, just 0.000107 above ln 2 ≈ 0.693147.

Simpson’s rule calculator with steps
Reads asf(x) = 1x
Type x^3 for x³, 2x for 2·x, sqrt(x), e^x, ln(x), sin(x), 1/(1+x^2). Limits can be numbers, fractions, pi or e. n can be up to 10,000.
Try:
Simpson’s 1/3 rule, n = 4
S₄ ≈ 0.6932539683
Step h = (b − a)/n0.25
Exact integralln(2) ≈ 0.69314718
Actual error+0.0001068 (0.0154%)
Error bound≤ 0.0005208
11.21.41.61.820.51
f(x) = 1/xparabola areaspoints (xᵢ, f(xᵢ))
Compare with other methods
Method (n = 4) Value Error
Simpson’s 1/3 rule 0.6932539683 +0.0001068
Trapezoidal rule 0.6970238095 +0.003877
Midpoint rule 0.6912198912 −0.001927
Left Riemann sum 0.7595238095 +0.06638
Right Riemann sum 0.6345238095 −0.05862
Table of xᵢ, f(xᵢ) and weights (5 points)
i xᵢ f(xᵢ) weight weight × f(xᵢ)
0 1 1 1 1
1 1.25 0.8 4 3.2
2 1.5 0.666667 2 1.33333
3 1.75 0.571429 4 2.28571
4 2 0.5 1 0.5
Sum 8.319047619
S₄ = h/3 × sum 0.6932539683
Doubling n: the error shrinks about 16 times
n S(n) Error Error ratio
4 0.6932539683 0.000107 —
8 0.6931545307 7.35 × 10⁻⁶ 14.5
16 0.6931476528 4.72 × 10⁻⁷ 15.6
32 0.6931472103 2.97 × 10⁻⁸ 15.9
Show steps
  1. Check n and find the stepn = 4 is even, as the 1/3 rule needs. h = (b − a)/n = (2 − 1)/4 = 0.25.
  2. Evaluate f at the points xᵢ = a + ihf(1) = 1, f(1.25) = 0.8, f(1.5) = 0.666667, f(1.75) = 0.571429, f(2) = 0.5.
  3. Apply the weightsThe 1/3 rule uses the pattern 1, 4, 2, 4, 2, …, 4, 1: ends once, odd points 4 times, interior even points 2 times. S₄ = (h/3)[f(x₀) + 4f(x₁) + 2f(x₂) + … + 4f(x₃) + f(x₄)].
  4. Add the weighted values1 + 4·0.8 + 2·0.666667 + 4·0.571429 + 0.5 = 8.319047619.
  5. Multiply by h/3S₄ = 0.25/3 × 8.319047619 = 0.6932539683.
  6. Exact value with the Fundamental Theorem of CalculusF(x) = ln(|x|), so the integral from 1 to 2 = F(b) − F(a) = ln(2) ≈ 0.69314718
  7. Actual errorError = 0.6932539683 − 0.6931471806 = 0.0001068.
  8. Error boundf⁽⁴⁾(x) = 24/x5. On [a, b], K = max |f⁽⁴⁾(x)| ≈ 24 (at x ≈ 1), so |E| ≤ K(b − a)⁵/(180n⁴) = 24 × 1⁵/(180 × 4⁴) = 0.0005208.

Related: integral calculator · Riemann sum and trapezoid calculator · derivative calculator

Simpson’s Rule Calculator (1/3 and 3/8 Rules, Step by Step)
Embed this calculator on your site

Free to use on class pages, blogs and course pages. Copy the code below and paste it into your page:

How to use the Simpson’s rule calculator

  1. Type the function, such as 1/x, e^(x^2) or sin(x), and the limits a and b. Limits can be fractions, pi or e.
  2. Enter the number of subintervals n and pick the rule: Simpson’s 1/3 rule needs an even n, the 3/8 rule needs a multiple of 3.
  3. Read the estimate, the exact integral when one exists, the actual error and the error bound. The graph shades the parabolas (or cubics) that the rule integrates.
  4. Optional: type a target error, such as 0.0001, to get the smallest n that the error bound guarantees.

Use the Data table tab when you only have measured values at equal spacing, for example offsets in land surveying or readings every 10 seconds. With an odd number of subintervals, the automatic setting uses the 1/3 rule and finishes with the 3/8 rule on the last three.

Simpson’s rule formula

Split [a, b] into n equal subintervals of width h = (b − a)/n, with points xi = a + ih. Simpson’s 1/3 rule is

∫ f(x) dx from a to b ≈ (h/3)[f(x₀) + 4f(x₁) + 2f(x₂) + 4f(x₃) + … + 2f(xn−2) + 4f(xn−1) + f(xn)].

The weights follow the pattern 1, 4, 2, 4, 2, …, 4, 1. Each pair of subintervals gets its own parabola through three points, and the area under one parabola is exactly (h/3)(y₀ + 4y₁ + y₂). Neighbouring parabolas share an end point, which is why the inside even points get weight 2. That pairing is also why n must be even.

Worked examples

Example 1: x² from 0 to 2 with n = 2

h = (2 − 0)/2 = 1, and f(0) = 0, f(1) = 1, f(2) = 4. Simpson’s rule gives (1/3)(0 + 4 × 1 + 4) = 8/3 ≈ 2.667, which is the exact answer. The trapezoidal rule with the same points gives (1/2)(0 + 2 × 1 + 4) = 3, an overestimate. Simpson’s rule is exact for every polynomial of degree 3 or less.

Example 2: 1/x from 1 to 2 with n = 4

i xi f(xi) Weight Weight × f(xi)
0 1 1 1 1
1 1.25 0.8 4 3.2
2 1.5 0.666667 2 1.333333
3 1.75 0.571429 4 2.285714
4 2 0.5 1 0.5

The weighted values add up to 8.319048, so S₄ = (0.25/3) × 8.319048 ≈ 0.693254. The exact integral is ln 2 ≈ 0.693147, so the error is about 0.000107, or 0.015%.

Example 3: Simpson’s 3/8 rule

The 3/8 rule fits a cubic through four points, three subintervals at a time: ∫ f(x) dx ≈ (3h/8)[f(x₀) + 3f(x₁) + 3f(x₂) + 2f(x₃) + 3f(x₄) + … + 3f(xn−1) + f(xn)], with n a multiple of 3. For x⁴ from 0 to 3 with n = 3, h = 1 and (3/8)(0 + 3 × 1 + 3 × 16 + 81) = (3/8)(132) = 49.5. The exact value is 3⁵/5 = 48.6.

Simpson’s rule error bound and choosing n

If |f⁽⁴⁾(x)| ≤ K on [a, b], the error of Simpson’s 1/3 rule is at most

|E| ≤ K(b − a)⁵ / (180n⁴).

For the 3/8 rule the denominator is 80n⁴. For 1/x on [1, 2], f⁽⁴⁾(x) = 24/x⁵, so K = 24 and the bound for n = 4 is 24 × 1⁵/(180 × 4⁴) ≈ 0.000521. The actual error, 0.000107, is well inside it.

To guarantee a given accuracy, solve the bound for n. For 1/(1 + x²) on [0, 1], the largest value of |f⁽⁴⁾| is 24 (at x = 0). An error of at most 0.00001 needs n⁴ ≥ 24/(180 × 0.00001), so n ≥ 10.75, and the smallest even choice is n = 12.

Because of the n⁴ in the denominator, doubling n cuts the error by about 16. In Example 2, going from n = 4 to n = 8 shrinks the error from about 0.000107 to 0.0000073.

Simpson’s rule vs the trapezoidal and midpoint rules

Method, 1/x on [1, 2], n = 4 Estimate Error
Left Riemann sum 0.759524 +0.066377
Right Riemann sum 0.634524 −0.058623
Trapezoidal rule 0.697024 +0.003877
Midpoint rule 0.691220 −0.001927
Simpson’s 1/3 rule 0.693254 +0.000107

The trapezoidal rule joins points with straight lines; Simpson’s rule uses parabolas, which follow a curve far more closely. The two are linked: Simpson’s rule with 2n subintervals equals (2Mn + Tn)/3, a weighted average of the midpoint and trapezoidal rules. Here (2 × 0.691220 + 0.697024)/3 ≈ 0.693155, which is S₈.

Simpson’s rule with data and in surveying

Simpson’s rule only needs function values at equal spacing, so it works on measurements. A surveyor measures the width of a plot (the offsets) every 10 m along a 60 m baseline: 12, 15, 19, 22, 20, 16 and 13 m. The area is about (10/3)[12 + 4(15) + 2(19) + 4(22) + 2(20) + 4(16) + 13] = (10/3)(315) = 1,050 m². The same method gives distance from a table of speeds or volume from cross-sectional areas.

Common mistakes with Simpson’s rule

  • Using an odd n with the 1/3 rule. Use an even n, or switch to the 3/8 rule for the last three subintervals.
  • Mixing up the weights. The ends get 1, odd points 4, inside even points 2.
  • Dividing by 3 instead of multiplying by h/3, or using (b − a)/3 in place of h/3.
  • Applying it to unequally spaced data. Simpson’s rule needs one common width h.
  • Evaluating trig functions in degrees. Calculus uses radians.

Simpson’s rule practice quiz: 10 questions

Test yourself with 10 multiple-choice questions. Choose an answer and press Submit to see if you are right and why. Your score appears at the end.

Question 1 of 10
1. Use Simpson’s 1/3 rule with n = 2 to estimate the integral of x^3 from 0 to 2.

Found a mistake? Let us know!

2. In Simpson’s 1/3 rule with n = 6, what weight does f(x4) get?

Found a mistake? Let us know!

3. Why must n be even for Simpson’s 1/3 rule?

Found a mistake? Let us know!

4. Estimate the integral of 1/x from 1 to 3 with Simpson’s 1/3 rule and n = 2.

Found a mistake? Let us know!

5. A table gives f(0) = 2, f(1) = 3, f(2) = 7, f(3) = 6, f(4) = 4. What is the Simpson’s 1/3 estimate of the integral from 0 to 4?

Found a mistake? Let us know!

6. With Simpson’s 3/8 rule and n = 3, what are the weights?

Found a mistake? Let us know!

7. If n is doubled, about how much smaller does the Simpson’s rule error usually get?

Found a mistake? Let us know!

8. For f(x) = x^4 on [0, 1], what is the Simpson’s 1/3 error bound with n = 2?

Found a mistake? Let us know!

9. For which function is Simpson’s rule always exact?

Found a mistake? Let us know!

10. The midpoint estimate is M2 = 0.82 and the trapezoidal estimate is T2 = 0.85. What is the Simpson’s estimate S4?

Found a mistake? Let us know!

Frequently asked questions

What is Simpson's rule?

Simpson's rule is a numerical integration method that estimates a definite integral by replacing the curve with parabolas over pairs of subintervals. It is usually far more accurate than the trapezoidal rule with the same number of points.

What is Simpson's rule for calculation of area in surveying?

Surveyors measure offsets (perpendicular widths) at equal intervals d along a baseline and use Area ≈ (d/3)[first + last + 4 × (sum of odd offsets) + 2 × (sum of remaining even offsets)]. It needs an odd number of offsets; with an even number, treat the last strip separately.

How do you do Simpson's rule on a calculator?

Enter f(x), a, b and n in the calculator above. On a TI-84, store f in Y1 and type (h/3)(Y1(a) + 4sum(seq(Y1(a + Ih), I, 1, n − 1, 2)) + 2sum(seq(Y1(a + Ih), I, 2, n − 2, 2)) + Y1(b)) with your own numbers for a, b, h and n. The built-in fnInt command uses its own method and does not show Simpson's rule.

Is Simpson's rule in Calc BC?

AP Calculus questions on approximating integrals usually ask for left, right, midpoint or trapezoidal sums, often from a table. Simpson's rule is more common in college Calculus II and numerical methods courses, so check your course syllabus.

How is Simpson's rule different from the trapezoidal rule?

The trapezoidal rule connects points with straight lines and has an error that shrinks with 1/n²; Simpson's rule connects them with parabolas and its error shrinks with 1/n⁴. Simpson's rule needs an even n and is exact for cubics.

Related calculators

More calculus calculators

Browse all 541 calculators

Related to This Article

What people say about "Simpson's Rule Calculator: 1/3 & 3/8 Rules, Error, Steps"?

No one replied yet.

Leave a Reply