The basic Trapezoidal Rule fits a single straight line over the entire interval [a,b]. When f(x) curves significantly, this single trapezoid can be a poor approximation. The Composite Trapezoidal Rule fixes this by dividing [a,b] into m equal sub-intervals and applying the basic Trapezoidal Rule on each one. The total integral is then the sum of all the small trapezoids.
Partitioning the Interval
Divide [a,b] into m equal sub-intervals of width:
h=mb−a
This defines m+1 equally spaced nodes:
x0=a,x1=a+h,x2=a+2h,…,xm=a+mh=b
Applying the Trapezoidal Rule to the j-th sub-interval [xj−1,xj] gives:
2h[f(xj−1)+f(xj)]
Assembling the Sum
The composite approximation is the sum over all m sub-intervals:
Every interior node x1,x2,…,xm−1 appears once as the right endpoint of one sub-interval and once as the left endpoint of the next. Each therefore contributes twice. The two endpoints x0=a and xm=b appear only once. Collecting terms: