Skip to content
ENExplore Calculators

Trapezoidal Rule Calculator

Approximate a definite integral using the composite trapezoidal rule with n subintervals.

About Trapezoidal Rule Calculator

The composite trapezoidal rule approximates ∫f(x)dx by connecting adjacent points with straight lines and summing the trapezoid areas. Error is O(h²), making it less accurate than Simpson's rule but simpler and applicable with any number of subintervals.

Formula

Trapezoidal rule

∫[a,b]f(x)dx ≈ h·[f(x₀)/2 + f(x₁) + f(x₂) + ... + f(xₙ)/2]

h
(b-a)/n
n
Number of subintervals

Worked example

With the default values below, Trapezoidal Rule Calculator returns Approximate integral of 0.7462107961. Change any input above and every figure here is recalculated in your browser.

Inputs used

f(x)
exp(-x^2)
Lower bound (a)
0
Upper bound (b)
1
Subintervals (n)accepts 1–100,000
10

Results

Approximate integral
0.7462107961
Step size h
0.10000000

Step by step

  1. 1Values used
  2. 2Trapezoidal rule
  3. 3Approximate integral= 0.7462107961
  4. 4Step size h= 0.10000000

Assumptions and limits

  • The result is derived only from the 4 inputs listed above. Anything not among them is not part of the calculation.
  • In particular, this calculator does not take inflation, tax, fees or charges or compounding frequency into account.
  • Figures are rounded for display to 10 decimal places, so totals built from several rounded parts can differ slightly from the unrounded arithmetic.

How these calculators are built and tested is described on the Methodology page. If a figure looks wrong, please report it.

Frequently Asked Questions

When is the trapezoidal rule preferred?

For periodic functions integrated over a full period, the trapezoidal rule can be exponentially accurate (superconvergence), outperforming even Simpson's rule.

How does error decrease with n?

Doubling n reduces error by a factor of 4 (quadratic convergence in n).

Trapezoidal Rule Calculator | Calcrivo