Trapezoidal Rule Integration Calculator

The trapezoidal rule is the most fundamental numerical integration method, approximating the area under a curve by joining successive sample points with straight chords and summing the trapezoids beneath them. It is robust, easy to understand, and works for any number of subintervals. This calculator takes the lower and upper bounds, the number of subintervals, and the function values at each evenly spaced node, then applies the composite trapezoidal weighting (1, 2, 2, ..., 2, 1) scaled by half the step size. It is exact for any linear function and its error shrinks with the square of the step size.

0.00
0.00
0.00
0.00

Trapezoidal rule formula

h = (b - a) / n
Integral = (h / 2) * [ f0
+ 2 * (f1 + f2 + ... + f(n-1))
+ f(n) ]
Supply n + 1 evenly spaced node values

Each endpoint receives weight 1 and every interior node receives weight 2. The whole weighted sum is then scaled by half the step size to give the approximate integral.

Notes on the trapezoidal rule

  • Any positive integer number of subintervals works; n need not be even.
  • You must supply exactly n + 1 function values, one at each node from a to b inclusive.
  • The nodes must be evenly spaced; the step size h is derived from the bounds and n.
  • The rule is exact for straight-line functions of degree one.
  • Error scales with h squared; doubling the points cuts the error about fourfold.

Trapezoidal rule: frequently asked questions

What is the trapezoidal rule?

The trapezoidal rule approximates a definite integral by connecting consecutive sample points with straight lines and summing the areas of the resulting trapezoids. It is the simplest Newton-Cotes quadrature method and is exact for any straight-line function.

What is the trapezoidal rule formula?

With step h = (b - a) / n, the integral is approximately (h/2) times [f0 + 2*(f1 + f2 + ... + f(n-1)) + f(n)]. The two endpoints carry weight 1 and every interior point carries weight 2.

How accurate is the trapezoidal rule?

The composite trapezoidal rule has an error proportional to h squared, so halving the step size cuts the error roughly fourfold. It is less accurate than Simpson's rule on smooth curved functions but simpler and robust.

Does n need to be even for the trapezoidal rule?

No. Unlike Simpson's rule, the trapezoidal rule works for any positive integer number of subintervals because each trapezoid spans a single subinterval. You still need n + 1 function values.

When does the trapezoidal rule overestimate or underestimate?

For a function that is concave up over the interval the trapezoidal rule overestimates the true integral, because the straight chords lie above the curve. For a concave-down function it underestimates.

Official sources

Reviewed by the CalculatorHub team, edited by James Graham, 16 June 2026. See our methodology.