Trapezoidal Rule Calculator
Approximate the definite integral of f(x) over [a, b] with the composite trapezoidal rule. Set your subintervals and get an error estimate.
Frequently Asked Questions about the Trapezoidal Rule Calculator
What is the trapezoidal rule?
The trapezoidal rule estimates the area under a curve f(x) between x = a and x = b by replacing the curve with straight line segments and adding up the trapezoids beneath them. The composite version splits [a, b] into n equal-width panels for a closer fit. It is one of the simplest methods of numerical integration, used when an exact antiderivative is hard or impossible to find.
What formula does this calculator use?
It uses the composite trapezoidal rule. With step width h = (b - a) / n and nodes x_i = a + i times h, the estimate is T_n = (h / 2) times [f(x_0) + 2 times (f(x_1) + ... + f(x_{n-1})) + f(x_n)]. The two end nodes carry weight 1 and the n - 1 interior nodes carry weight 2. The node table on this page shows each x, its f(x), and its weight.
What does the subintervals value n do?
n is the number of equal panels the interval is divided into. A larger n means narrower trapezoids, a closer match to the curve, and usually a smaller error, at the cost of more function evaluations. Because the rule's error shrinks with the square of the step width, doubling n cuts the error to roughly one quarter for smooth functions. Start with a small n to see the working table, then increase it for accuracy.
How accurate is the result and what is the error estimate?
The global error of the composite trapezoidal rule is on the order of h squared, so it is exact for straight lines and tends to over or underestimate curved functions depending on concavity. This calculator reports an error estimate by computing the rule again with the step halved and comparing the two values through Richardson extrapolation. The refined value it shows is the matching Simpson estimate on the doubled grid, which is usually closer to the true integral but is not a guaranteed bound.
Which functions and inputs are supported?
Enter f(x) using x as the variable with + - * / ^, parentheses, the constants pi and e, and functions such as sin, cos, tan, exp, ln, log, sqrt, and abs. The bounds a and b must be finite and different, and n must be a whole number of at least 1. If the function is undefined at any node it samples, for example 1/x at x = 0, no value is shown.
When should I use the trapezoidal rule instead of Simpson's rule?
Use the trapezoidal rule when you want a quick, robust estimate, when the integrand is only known at evenly spaced sample points, or when the data is noisy and a higher-order method might overfit. Simpson's rule is generally more accurate for smooth functions because it fits parabolas instead of straight lines. For a fair comparison, the refined value on this page is exactly the Simpson estimate on the doubled grid.
Related Calculators
More calculators in "Math"
Definite Integral CalculatorDerivative CalculatorDice Probability CalculatorDot Product CalculatorFive Number Summary CalculatorHeron's Formula Calculator
See all 202 calculators in "Math"