The trapezoidal rule is a method for approximating definite integrals of functions. It is usually more accurate than left or right approximation using Riemann sums, and is exact for linear functions. The error in approximating the integral of a twice-differentiable function by the trapezoidal rule is proportional to the second derivative of the function at some point in the interval.
Suppose is defined on the interval The trapezoidal rule works by dividing the interval into equal-sized parts, (Let (The sizes of the intervals need not be equal, but it is more convenient if they are.)
On each interval, estimate by the area of a trapezoid whose four vertices are This area is Since the sum of these areas is where This is the estimate for
Let Approximating the integral using four intervals gives which is close to the actual value of
Approximating the integral using intervals gives So the error in the approximation is precisely which naturally approaches as that is, the more intervals used, the better the approximation becomes.
The picture in the definitions makes it clear that the error in the trapezoidal rule estimate will depend on how concave or convex is on each interval: if is convex ("concave up") the trapezoidal rule will give an overestimate on that interval, and if is concave ("concave down") the trapezoidal rule will give an underestimate. Since the second derivative measures the concavity of a function, it is intuitively reasonable that the error should be proportional to the second derivative.
Let be a twice-differentiable function on and let where is the trapezoidal rule estimate for the integral using equal-sized intervals. Then there is a number such that
The number is known to exist via an argument like the one in the Mean Value Theorem, so there is no formula for it. The way that this estimate is generally used is: if is a constant such that for all in the interval, then
Note that this recovers the error from the example above: for all , so