Integrating the linear Lagrange interpolant on [a,b] to obtain the trapezoid rule and its geometric interpretation.
Integrating the interpolating line
We want to approximate ∫abf(x)dx using only the values of the function at the endpoints. Replace the curve by the line through (a,f(a)) and (b,f(b)), then integrate that line.
The curve is replaced by the interpolating line. The area under that line is the trapezoid approximation.
Derivation with Lagrange
Take the endpoint nodes x0=a and x1=b, with h=b−a. The linear Lagrange bases equal 1 at their node and 0 at the other one:
L0(x)=a−bx−b,L1(x)=b−ax−a
The linear interpolant is the combination of the known values:
p1(x)=f(a)L0(x)+f(b)L1(x)
Approximate the integral of f by the integral of p1. The weights of the formula are the integrals of the bases:
I≈f(a)∫abL0(x)dx+f(b)∫abL1(x)dx
Compute the first weight with the change s=x−a. Then x−b=s−h, a−b=−h, dx=ds, and the limits x=a,b become s=0,h: