Trapezoidal Rule Integration Calculator
The trapezoidal rule estimates a definite integral by approximating the region under the curve as a series of trapezoids. Enter your function values at equally spaced points and the start and end of the interval. The calculator computes the step size, applies the composite trapezoidal formula, and returns the approximate integral, the step size, and the number of strips. This is the standard method for integrating measured data without a closed-form function.
Composite trapezoidal rule formula
h = (b - a) / n (n strips, n+1 values)
Integral = h / 2 * (y0 + yn + 2 * sum of interior y values)
Endpoints carry weight 1 and interior points carry weight 2. The step size h is the interval width divided by the number of strips, which is one less than the number of values you enter.
Worked example
For y = x squared sampled at x = 0, 1, 2, 3, 4 the values are 0, 1, 4, 9, 16, with a = 0, b = 4, so h = 1 and n = 4 strips. Integral = 1/2 * (0 + 16 + 2*(1 + 4 + 9)) = 1/2 * (16 + 28) = 22. The exact integral of x squared from 0 to 4 is 64/3 which is about 21.33; the trapezoidal estimate of 22 slightly overestimates because the curve is concave up.
Trapezoidal rule: frequently asked questions
What is the trapezoidal rule?
The trapezoidal rule approximates the area under a curve by dividing the interval into equal strips and treating each strip as a trapezoid. It sums the area of those trapezoids to estimate the definite integral. It is exact for straight-line functions and a good approximation for smooth curves.
What is the composite trapezoidal rule formula?
For values y0 through yn at n+1 equally spaced points with spacing h, the integral is approximately h times (y0 plus yn plus 2 times the sum of all interior values), all divided by 2. The endpoints get weight 1 and the interior points get weight 2.
How do I enter my function values?
Enter the y values at equally spaced x points, separated by commas, in the order from the left endpoint to the right endpoint. Then enter the start and end of the interval. The calculator computes the step size automatically from the number of values you provide.
How accurate is the trapezoidal rule?
Accuracy improves as the number of strips increases. The error shrinks roughly with the square of the step size, so halving the spacing cuts the error by about a factor of four. For functions with strong curvature, Simpson's rule is usually more accurate for the same number of points.
Sources
- NIST Digital Library of Mathematical Functions, quadrature: dlmf.nist.gov/3.5.
- Standard composite trapezoidal rule for numerical integration.
Reviewed by the CalculatorHub team, edited by James Graham, 19 June 2026. See our methodology.