Derivation: composite trapezoid

From summing simple trapezoids on n subintervals to the weights 1,2,...,2,1 and the global error.

Summing simple trapezoids

width hx₀x₁x₂x₃xₙinterior nodes: weight 2
Each subinterval contributes one trapezoid. Interior nodes are counted twice.
Expand diagram

Each subinterval contributes one trapezoid. Interior nodes are counted twice.

Formula for n subintervals
  1. Split [a,b][a,b] into n equal subintervals:

    xi=a+ih,h=ban,i=0,,nx_i=a+ih,\qquad h=\frac{b-a}{n},\qquad i=0,\ldots,n
  2. On [xi,xi+1][x_i,x_{i+1}], apply the simple trapezoid rule:

    Ti=h2[f(xi)+f(xi+1)]T_i=\frac{h}{2}\left[f(x_i)+f(x_{i+1})\right]
  3. The total approximation is the sum of the n trapezoids:

    Tn=i=0n1Ti=h2i=0n1[f(xi)+f(xi+1)]\begin{aligned}T_n&=\sum_{i=0}^{n-1}T_i\\&=\frac{h}{2}\sum_{i=0}^{n-1}\left[f(x_i)+f(x_{i+1})\right]\end{aligned}
  4. When the full sum is written out, f(x0)f(x_0) and f(xn)f(x_n) appear once. Every interior value appears twice:

    Tn=h2[f(x0)+2i=1n1f(xi)+f(xn)]T_n=\frac{h}{2}\left[f(x_0)+2\sum_{i=1}^{n-1}f(x_i)+f(x_n)\right]
  5. The global error is obtained by summing the local errors of the simple trapezoid rule:

    ET=h312i=0n1f(ξi)=ba12h2f(ξ)\begin{aligned}E_T&=-\frac{h^3}{12}\sum_{i=0}^{n-1}f''(\xi_i)\\&=-\frac{b-a}{12}h^2f''(\xi)\end{aligned}