= Composite trapezoidal rule
{title2=$T_n(f)=h(f(a)/2+\sum_{j=1}^{n-1}f(a+jh)+f(b)/2)$}
On an equal-panel <partition of an interval>, with $h=(b-a)/n$, sum the <trapezoidal rule> over adjacent panels:
$$
T_n(f)=h\left[\frac{f(a)}2+\sum_{j=1}^{n-1}f(a+jh)+\frac{f(b)}2\right].
$$
There are $n+1$ distinct <quadrature nodes>. Each interior sample belongs to two panels and therefore has <quadrature weight> $h$, while each endpoint has <quadrature weight> $h/2$. Equivalently, the <composite trapezoidal rule> integrates the <piecewise linear function> obtained by <linear interpolation> exactly.<Fundamentals of Numerical Computation by Tobin A. Driscoll and others/5.6 Numerical integration>[§5.6.1, equations 5.6.3–5.6.5: integrating the piecewise linear interpolant]{ref}
For $f\in C^2[a,b]$ and $K=\max_{x\in[a,b]}|f''(x)|$, summing panel <quadrature errors> gives
$$
T_n(f)-I(f)=\frac{b-a}{12}h^2f''(\xi),\qquad |T_n(f)-I(f)|\leq\frac{b-a}{12}h^2K
$$
for some $\xi\in(a,b)$. Thus panel <quadrature errors> of order $O(h^3)$ accumulate to order $O(h^2)$, using <big O notation>.<NIST Digital Library of Mathematical Functions/3.5 Quadrature, subsection (i) Trapezoidal Rules>[§3.5(i), equations 3.5.2–3.5.3: composite formula and signed error]{ref} On a nonuniform <partition of an interval> with widths $h_j$ and largest width $H$, the bound is $K\sum_jh_j^3/12\leq K(b-a)H^2/12$.
For the <polynomial> $f(x)=x^2$ on $[0,1]$, direct summation yields
$$
T_n(f)=\frac13+\frac{1}{6n^2},\qquad T_n(f)-I(f)=-2\bigl(M_n(f)-I(f)\bigr).
$$
Both <quadrature errors> shrink by exactly four when $n$ doubles, with opposite signs. This exact relation belongs to this <polynomial> example; the <trapezoidal rule> is not always twice as inaccurate as the <midpoint quadrature rule>.
\Image[/midpoint-trapezoidal-error-refinement.png]
{title=Quadratic quadrature errors fall by four on refinement while a common sample bias persists}
The left plot uses exact <polynomial> sums; the right adds a common sample bias $\delta=0.002$ to the <composite trapezoidal rule>. That mathematical model converges to $1/3+\delta$, showing why smaller panels alone do not ensure accuracy for noisy samples. It illustrates <noise sensitivity of a quadrature rule>, rather than measured data.
Back to article page