Trapezoid Rule

To calculate the value of an integral one can approximate the function using a polynomial defined on subintervals. The following formula corresponds to passing a straight line through the points (xo, yo), (x1, y1) and integrating under the interpolant.

If we combine several such integrals for equally spaced points at a = xo, a+x = x1, a+2x = x2,..., at Nx = xN, a+(N+1)x = b = xn+1, we get the trapezoid rule.