Trapezoidal Rule Calculator
Approximate a definite integral by slicing the interval into n trapezoids and summing their areas.
Function f(x)
Area under the curve
How does this calculator work?
The trapezoidal rule estimates a definite integral by splitting [a, b] into n strips of width Δx = (b − a)/n and summing trapezoid areas: (Δx/2)·[f(x₀) + 2·Σ interior heights + f(xₙ)]. Choose f, a, b, and n; larger n gives a more accurate area-under-the-curve estimate.
Formula
How this is calculated
Pick a function f(x), the lower limit a, the upper limit b, and the number of subintervals n. The interval [a, b] is divided into n equal pieces of width Δx = (b − a)/n, with sample points xᵢ = a + i·Δx for i = 0, 1, …, n.
The trapezoidal rule replaces the curve over each subinterval with a straight line, forming a trapezoid. Summing the trapezoid areas gives (Δx/2)·[f(x₀) + 2·(f(x₁) + … + f(xₙ₋₁)) + f(xₙ)]: the two endpoint heights are counted once and every interior height is counted twice. Larger n yields a finer mesh and a more accurate estimate.
The input units are whatever units a, b, and f carry; the result is in those combined area units. The error shrinks roughly with 1/n² and is zero for linear functions. Edge cases: a = b returns no result (zero-width interval), n must be a positive integer, and points where f is undefined (such as 1/x or ln(x) at x ≤ 0) will be rejected.
Frequently asked questions
The trapezoidal rule fits straight lines between sample points, while Simpson’s rule fits parabolas. Simpson’s rule is usually more accurate for smooth curves at the same n, but the trapezoidal rule is simpler and works for any n.
Increase the number of subintervals n. Doubling n roughly quarters the error for smooth functions, since the trapezoidal error is proportional to 1/n².
Yes. For straight-line (linear) functions the trapezoids match the area exactly, so the approximation equals the true integral regardless of n.
Also known as
TG we-Calculate Editorial Team. (2026). Trapezoidal Rule Calculator [Online calculator]. TG we-Calculate. https://we-calculate.com/calculator/trapezoidal-rule-calculator
TG we-Calculate Editorial Team. "Trapezoidal Rule Calculator." TG we-Calculate. 2026. https://we-calculate.com/calculator/trapezoidal-rule-calculator.
TG we-Calculate Editorial Team, "Trapezoidal Rule Calculator," TG we-Calculate, 2026. [Online]. Available: https://we-calculate.com/calculator/trapezoidal-rule-calculator
@misc{wecalculate_trapezoidal_rule_calculator, title = {Trapezoidal Rule Calculator}, author = {{TG we-Calculate Editorial Team}}, howpublished = {\url{https://we-calculate.com/calculator/trapezoidal-rule-calculator}}, year = {2026}, note = {TG we-Calculate} }
Did this calculator help you?
