When Exact Integration Fails

Some integrals cannot be expressed in terms of elementary functions — for example, ∫e^(−x²)dx. Numerical methods approximate the integral to any desired accuracy using only function evaluations.

The Trapezoid Rule

Instead of rectangles (Riemann sums), use trapezoids. For n subintervals of width h = (b−a)/n:

T = h/2 · [f(x₀) + 2f(x₁) + 2f(x₂) + ... + 2f(xₙ₋₁) + f(xₙ)]

Simpson's Rule

Simpson's Rule uses parabolas instead of straight lines — dramatically more accurate for smooth functions. Requires n to be even:

S = h/3 · [f(x₀) + 4f(x₁) + 2f(x₂) + 4f(x₃) + ... + f(xₙ)]

The pattern of coefficients is 1, 4, 2, 4, 2, ..., 4, 1.

📋 Approximate ∫₀¹ eˣ dx with n=4 using Simpson's Rule
h= 0.25. Points: 0, 0.25, 0.5, 0.75, 1
Valuese⁰=1, e^0.25≈1.284, e^0.5≈1.649, e^0.75≈2.117, e¹≈2.718
Sum(0.25/3)[1 + 4(1.284) + 2(1.649) + 4(2.117) + 2.718] ≈ 1.7183
Exacte − 1 ≈ 1.71828. Error < 0.00002

Error Bounds

Trapezoid error ≤ (b−a)³/(12n²) · max|f''|. Simpson's error ≤ (b−a)⁵/(180n⁴) · max|f⁴|. Simpson's is far more accurate — the error decreases as n⁴ rather than n².

Frequently Asked Questions

Which method should I use?
For smooth functions, Simpson's Rule is almost always better — it is fourth-order accurate vs second-order for the trapezoid rule. Use the trapezoid rule when the function has limited smoothness or when simplicity matters.
How many subintervals do I need?
Depends on the required accuracy and how curved the function is. Use the error bound formula to determine n. For most purposes in applied work, n = 100 with Simpson's Rule gives machine-precision results.

When Exact Integration Fails

Many integrals cannot be expressed in closed form. The Gaussian integral ∫e^(−x²)dx, the error function, Fresnel integrals, and elliptic integrals have no elementary antiderivative. This is not a gap in technique — it is a proved theorem. For these, numerical methods are the only option.

Why the Trapezoid Rule Works

Instead of rectangles (Riemann sums), connect adjacent points with straight lines. Each strip is a trapezoid with area = ½(f(xᵢ) + f(xᵢ₊₁))·h. Summing n trapezoids gives: T = h/2·[f(x₀) + 2f(x₁) + 2f(x₂) + ... + 2f(xₙ₋₁) + f(xₙ)]. The first and last points get coefficient 1; all interior points get 2.

Why Simpson's Rule Is So Much Better

Simpson's rule fits a parabola through every three consecutive points. A parabola is an exact fit for quadratic functions, and a good fit for smooth functions in general. The coefficients 1, 4, 2, 4, 2, ..., 4, 1 come from integrating the Lagrange interpolating polynomial through those points. The key requirement: n must be even (pairs of subintervals).

Worked Comparison

📋 Approximate ∫₀¹ eˣ dx (exact = e−1 ≈ 1.71828) using n=4
h= 0.25. Points: x = 0, 0.25, 0.5, 0.75, 1.0
f values1.000, 1.284, 1.649, 2.117, 2.718
Trapezoid= 0.25/2·[1.000 + 2(1.284+1.649+2.117) + 2.718] = 1.7272 (error 0.009)
Simpson= 0.25/3·[1.000 + 4(1.284) + 2(1.649) + 4(2.117) + 2.718] = 1.7183 (error 0.00002)

Error Bounds — How Accurate Are You?

Trapezoid error ≤ (b−a)³ · max|f''| / (12n²) Simpson error ≤ (b−a)⁵ · max|f⁽⁴⁾| / (180n⁴)

Simpson's error decreases as n⁴ — doubling n reduces the error by a factor of 16. Trapezoid error decreases as n², so doubling n only reduces error by 4. This is why Simpson's is preferred for smooth functions: you need far fewer function evaluations to achieve the same accuracy.

Adaptive Integration

Modern numerical integrators use adaptive step sizes — they automatically refine the partition in regions where f changes rapidly and use fewer points where f is smooth. This is how computer algebra systems like MATLAB, Python's scipy.integrate, and Wolfram Alpha compute definite integrals. The underlying algorithm is usually an adaptive Simpson or Gauss-Kronrod quadrature rule.

AM
Dr. Aisha Malik, PhD Mathematics
Senior Lecturer in Applied Mathematics · 12 years teaching calculus
Dr. Malik holds a PhD in Applied Mathematics from the University of Edinburgh and has taught calculus to over 4,000 students. She has reviewed this article for mathematical accuracy and pedagogical clarity.
Technically reviewed by: Prof. James Chen, Stanford Mathematics Department · April 2026