= Trapezoidal rule
{title2=$T(f)=(b-a)(f(a)+f(b))/2$}
{wiki}
As a <quadrature rule>, the <trapezoidal rule> replaces an <integrand> by the <linear interpolation> joining its two endpoint values:
$$
I(f)=\int_a^bf(x)\,dx\approx T(f)=\frac{b-a}{2}\bigl(f(a)+f(b)\bigr),\qquad a<b.
$$
For nonnegative endpoint values, this is the area of a <trapezoid>; in general it is a signed area. The <quadrature nodes> are $a,b$, each with <quadrature weight> $(b-a)/2$. Unlike the <midpoint quadrature rule>, it uses endpoint samples, which can be reused between adjacent panels.
Every <affine function> $f(x)=\alpha x+\beta$ agrees with its <linear interpolation>, so the <trapezoidal rule> integrates it exactly. On $[0,2]$, $f(x)=2x+1$ gives $T(f)=(2/2)(1+5)=6=I(f)$. On $[0,1]$, the <polynomial> $f(x)=x^2$ instead gives $T(f)=1/2$, exceeding $I(f)=1/3$ by $1/6$. Its <degree of precision of a quadrature rule> is exactly one.
If $f\in C^2[a,b]$, its signed <approximation error> satisfies
$$
T(f)-I(f)=\frac{(b-a)^3}{12}f''(\xi_T),\qquad a<\xi_T<b.
$$
A <convex function> lies below its endpoint chord, so the <trapezoidal rule> overestimates its <integral>; a <concave function> gives the reverse inequality. The error formula assumes that the second <derivative> exists and is a <continuous function> throughout the closed interval.<NIST Digital Library of Mathematical Functions/3.5 Quadrature, subsection (i) Trapezoidal Rules>[§3.5(i), equation 3.5.1 and its C² hypothesis; the source writes integral minus rule]{ref} A short derivation is the identity
$$
T(f)-I(f)=\frac12\int_a^b(t-a)(b-t)f''(t)\,dt,
$$
obtained by two <integrations by parts>. The nonnegative <Peano kernel> has <integral> $(b-a)^3/12$, and the <weighted mean value theorem for integrals> gives the formula.
The <trapezoidal rule> for an <ordinary differential equation> averages <vector fields> at the old and new states and is <A-stable>.
This time-stepping use applies the same <trapezoidal rule> to the <integral> of the <derivative> in an <ordinary differential equation>. That connection explains its place under <implicit Runge-Kutta methods>; its quadrature behavior and the nonlinear issue in <trapezoidal rule fails B-stability> concern different uses of the same endpoint averaging.
Back to article page