The trapezoid is a subset of the Newton-Cotes closed formulations using a first order (linear) representation of the curve.

Formulation

Consider a small interval between and :

where is a linear approximation:

Substituting, we have:

This is based on the area of trapezoid formula:

(In middle school this was written as )

When applied, we use the Composite Trapezoid Rule.

Data Distributions

The trapezoid rule can be applied to evenly-spaced and unevenly-spaced data, as long as we define some interval to apply with Composite Trapezoid Rule.

The trapezoid rule is often used due to its ease of implementation, versatility for both data and functions, and applicability to unevenly-spaced data.

Accuracy

In general, the accuracy improves as we increase the number of intervals. The error in applying can be determined by summing up the errors of each individual interval, where lies somewhere in the interval from to .

The error for an individual interval is:

where is the second derivative at a point located in the segment . The intuition here is that since the second derivative describes the curvature of a function, we are comparing how the curviness of the function to the straight trapezoid line.

We can simplify things by considering:

where is the mean or average value of the second derivative for the entire interval.

The approximate error (due to the approximation of above) is then:

Interestingly, this is a function of , which means that doubling the number of points reduces the error by a factor of .