Trapezoidal Rule Calculator

Free trapezoidal rule calculator with steps. Approximate definite integrals with trapezoid visualization, error bounds, and method comparison.

Use x as variable. Supports sin, cos, tan, ln, sqrt, exp, ^, *, /, +, -

Polynomial
Trigonometric
Exponential
to
4
150

Approximated Integral

n = 4
Δx = 0.5

4.750000

f(x) = x^2 + 1 on [0, 2]

Accuracy

Error analysis for this approximation

Reference Value

Analytical antiderivative available

4.666667

Absolute Error

|Reference Approx|

0.083333

1.785714% relative

Error Bound

|E| (ba)³/(12n²) · max|f(x)|

0.083333

Step-by-Step Solution

Trapezoidal rule computation with n = 4

1Calculate Step Width

Δx = (b a) / n = (2 0) / 4 = 0.5

2Find Partition Points & Evaluate f(x)

x0 = 0 f(x0) = 1

x1 = 0.5 f(x1) = 1.25

x2 = 1 f(x2) = 2

x3 = 1.5 f(x3) = 3.25

x4 = 2 f(x4) = 5

3Apply Trapezoidal Rule Formula

f(x)dx (Δx/2) × [f(x₀) + 2f(x₁) + 2f(x₂) + ... + 2f(xn1) + f(xn)]

= (0.5 / 2) × [1 + 2(1.25 + 2 + 3.25) + 5]

= 4.75

Per-Trapezoid Breakdown

Individual trapezoid areas

ixᵢxᵢ₊₁f(xᵢ)f(xᵢ₊₁)Area
100.511.250.5625
20.511.2520.8125
311.523.251.3125
41.523.2552.0625
Total4.75

Trapezoidal Approximation

Visualizing 4 trapezoids under f(x)

f(x)
Trapezoids
00.511.52012345xf(x)

What Is the Trapezoidal Rule?

A numerical method for approximating definite integrals

The trapezoidal rule is a numerical integration technique that approximates the area under a curve by dividing it into trapezoids and summing their areas. Instead of finding an exact antiderivative — which is impossible for many functions — it uses a simple geometric approach that converges to the true value as you increase the number of trapezoids.

Key Insight

The trapezoidal rule approximates the curve with straight line segments. More subintervals (larger n) means the line segments hug the curve more closely — error decreases as 1/n².

No Antiderivative

Functions like e^(−x²) or sin(x)/x have no elementary antiderivative — numerical methods are essential.

Discrete Data

When you only have measured data points rather than a formula, the trapezoidal rule works directly.

Quick Estimates

Get a fast approximation without complex symbolic computation — ideal for engineering checks.

Verification

Cross-check symbolic integration results or validate numerical simulations with a simple method.

Trapezoidal Rule Formula

The mathematical foundation and variable definitions

General Formula

Δx = (b a) / n

ab f(x) dx (Δx/2) [f(x₀) + 2f(x₁) + 2f(x₂) + ... + 2f(xn1) + f(xn)]

a, b

Integration bounds

n

Number of trapezoids

Δx

Step width (b−a)/n

xᵢ

Partition points

Error Bound Formula

|E| ((ba)³ / (12n²)) · max|f(x)| on [a,b]

Doubling n reduces the error bound by a factor of 4 (quadratic convergence). For smooth functions, even modest n gives excellent accuracy.

Worked Example

Trapezoidal rule applied to f(x) = x² + 1 on [0, 2] with n = 4

1

Calculate Step Width

Δx = (b − a) / n = (2 − 0) / 4 = 0.5

Δx = 0.5

2

List Partition Points & Evaluate f(x)

x₀ = 0 → f(0) = 0² + 1 = 1

x₁ = 0.5 → f(0.5) = 0.5² + 1 = 1.25

x₂ = 1 → f(1) = 1² + 1 = 2

x₃ = 1.5 → f(1.5) = 1.5² + 1 = 3.25

x₄ = 2 → f(2) = 2² + 1 = 5

3

Apply the Trapezoidal Rule Formula

∫f(x)dx ≈ (Δx/2) × [f(x₀) + 2f(x₁) + 2f(x₂) + 2f(x₃) + f(x₄)]

= (0.5/2) × [1 + 2(1.25) + 2(2) + 2(3.25) + 5]

= 0.25 × [1 + 2.5 + 4 + 6.5 + 5]

= 0.25 × 19

= 4.75 (exact = 4.667, error = 1.79%)

Trapezoidal vs. Other Methods

How the trapezoidal rule compares to midpoint and Simpson's rules

Trapezoidal

Error: ∝ 1/n²

Uses straight lines between endpoints. Simple, works for any n. Best for periodic functions over full periods.

Midpoint

Error: ∝ 1/n²

Uses function value at the middle of each subinterval. Often more accurate than trapezoidal for the same n.

Simpson's

Error: ∝ 1/n⁴

Uses parabolic arcs. Much faster convergence but requires an even number of subintervals.

Real-World Applications

Where the trapezoidal rule is used in practice

Pharmacokinetics

AUC (Area Under the Curve) calculations for drug concentration over time in clinical trials and dosing.

Surveying

Computing land parcel areas from irregular boundary measurements using the trapezoidal formula.

Engineering

Numerical integration in FEA (Finite Element Analysis) for stress, strain, and heat transfer simulations.

Physics

Computing work done by a variable force: W = ∫F(x)dx where force changes with position.

Economics

Consumer and producer surplus calculations from supply and demand curves.

Signal Processing

Discrete-time integration of sensor data, accelerometer readings, and audio waveforms.

Common Mistakes to Avoid

Errors to watch for when using numerical integration

Using too few intervals

n = 1 gives a very rough single-trapezoid estimate. For smooth functions use at least n = 4–10; for oscillatory functions use n = 20+.

Confusing with rectangular rule

The rectangular rule uses flat tops. Trapezoidal connects endpoints with slanted lines — generally more accurate for the same n.

Forgetting function domain

Ensure your function is defined across the entire interval. ln(x) at x = 0 or sqrt(x) for x < 0 will produce errors.

Assuming Simpson's is always better

Simpson's rule requires even n and smooth functions. For periodic or noisy data, trapezoidal can be more robust.

Frequently Asked Questions

Common questions about the trapezoidal rule and numerical integration

Embed Trapezoidal Rule Calculator

Add this calculator to your website or blog for free.

Last updated May 6, 2026