From Endpoint Values to Trapezoids
A function may curve between the points where its values are known. A numerical estimate can be made by replacing each short piece of the graph with a straight segment joining its endpoint values. The region between that segment and the horizontal axis is a trapezoid when the endpoint values are above the axis.
This replacement is called linear interpolation. It gives a direct reason for the trapezoidal rule: on each subinterval, use the area under the interpolating line, then add the contributions from all the subintervals. The result is an estimate for a curved graph, and it is exact when the function itself is linear on each subinterval.
Deriving the Formula on One Subinterval
Let the subinterval run from \(x_{i-1}\) to \(x_i\), with width \(h_i=x_i-x_{i-1}>0\). Write \(y_{i-1}=f(x_{i-1})\) and \(y_i=f(x_i)\). The line that connects the endpoint values is
This equation has the required endpoint values. Substituting \(x=x_{i-1}\) makes the last term zero, so \(L_i(x_{i-1})=y_{i-1}\). Substituting \(x=x_i\) gives \(x_i-x_{i-1}=h_i\), and therefore \(L_i(x_i)=y_{i-1}+(y_i-y_{i-1})=y_i\).
If both endpoint values are nonnegative, the area under this line is the area of a trapezoid. Its parallel sides have lengths \(y_{i-1}\) and \(y_i\), and the perpendicular distance between them is \(h_i\). The area is the width multiplied by the average of the two heights:
The same expression gives the signed area under the interpolating line if an endpoint value is negative. Signed area counts portions below the horizontal axis as negative. If the line crosses the axis, the formula gives the net contribution, not the total ordinary area of the two pieces.
A Second View of the Derivation
The formula can also be justified by splitting the interpolating region into a rectangle and a triangle. Begin with a rectangle of width \(h_i\) and signed height \(y_{i-1}\). The change from the left endpoint height to the right endpoint height is \(y_i-y_{i-1}\), so the extra triangular contribution is \(\frac12h_i(y_i-y_{i-1})\). The triangle's contribution is signed: it is negative when the line slopes downward.
This derivation explains why the endpoint values are averaged. The interpolating line changes steadily from one endpoint height to the other, so its average height over the interval is the average of those endpoint heights. Multiplying that average by the width gives the area contribution.
Adding Contributions Across a Partition
Suppose the interval is divided at \(x_0,x_1,\ldots,x_n\), where \(x_0<x_1<\cdots<x_n\). Each subinterval can have its own width \(h_i=x_i-x_{i-1}\). Applying the one-subinterval formula and adding all the pieces gives the composite trapezoidal estimate:
The sum combines adjacent trapezoids. An interior function value appears twice in the expanded sum: once as the right endpoint of one subinterval and once as the left endpoint of the next. For equal-width subintervals, this gives a useful simplified form.
This simplified form requires all subintervals to have the same width \(h\). If the widths differ, use the sum with the individual widths instead.
Worked Example: One Interpolated Segment
Worked Example: One Interpolated Segment
Suppose a function has value \(2\) at \(x=1\) and value \(6\) at \(x=4\). Estimate the signed area under the straight-line interpolation on this interval.
First find the width: \(h=4-1=3\). The endpoint heights are \(y_0=2\) and \(y_1=6\). The interpolating line is
Check the endpoints: \(L(1)=2+\frac43(0)=2\), and \(L(4)=2+\frac43(3)=2+4=6\). The trapezoidal contribution is
As a check using a rectangle and a triangle, the rectangle contributes \(3(2)=6\), and the triangle contributes \(\frac12(3)(6-2)=6\). Their sum is \(6+6=12\), matching the formula. If the horizontal axis is measured in seconds and the function in meters per second, the area has units of meters.
Worked Example: Unequal Subinterval Widths
Worked Example: Unequal Subinterval Widths
A rate is measured at \(x=0,1,3,4\), with values \(1,3,2,5\), respectively. Use linear interpolation on each subinterval to estimate the signed accumulated amount.
The subinterval widths are \(1-0=1\), \(3-1=2\), and \(4-3=1\). Calculate each trapezoid separately:
Add the contributions: \(T=2+5+3.5=10.5\). Thus the estimate is \(10.5\) rate-units times \(x\)-units. To check, the interpolating lines on the three subintervals are \(L_1(x)=1+2x\), \(L_2(x)=3-\frac12(x-1)\), and \(L_3(x)=2+3(x-3)\). Substitution at each interval's endpoints gives the stated pairs of values \((1,3)\), \((3,2)\), and \((2,5)\); their trapezoidal contributions are exactly \(2\), \(5\), and \(3.5\).
Worked Example: Equal-Width Subintervals
Worked Example: Equal-Width Subintervals
A function is sampled at \(x=0,2,4,6,8\), with respective values \(0,2,3,3,1\). Use the composite trapezoidal rule.
There are four subintervals, each of width \(h=2\). Use the equal-width formula:
Checking by calculating each trapezoid separately gives \(\frac22(0+2)=2\), \(\frac22(2+3)=5\), \(\frac22(3+3)=6\), and \(\frac22(3+1)=4\). Their sum is \(2+5+6+4=17\). The matching results confirm that the shared interior heights were counted twice in the simplified formula.
Signed Contributions When a Segment Crosses the Axis
The trapezoidal expression still applies when the interpolating line crosses the horizontal axis, but its meaning needs care. Consider a line with endpoint values \(-2\) and \(4\) across a width of \(3\). The signed trapezoidal contribution is
For a direct check, the line rises by \(6\) over a width of \(3\), so its slope is \(2\). Starting at height \(-2\), it reaches zero after \(1\) unit of horizontal distance. The triangular region below the axis has area \(\frac12(1)(2)=1\), counted as \(-1\). The triangular region above the axis has area \(\frac12(2)(4)=4\). Their signed total is \(-1+4=3\), as the formula gives. The total ordinary geometric area would instead be \(1+4=5\).
Common Mistakes
Another common error is applying the equal-width formula to a partition whose widths differ. For example, the subintervals in the unequal-width example have widths \(1,2,1\); there is no single \(h\) that can be factored out for all three trapezoids. Use each width in its own term.
Finally, a trapezoidal estimate uses the straight segment between sampled endpoint values. If the original function curves between those points, the interpolating line does not generally match the graph there. The estimate is exact for a function that is linear on every subinterval; otherwise it is an approximation. The direction and size of its error depend on the function's behavior, not on the area formula alone.
Check Your Understanding
Use the interpolation formula and show the endpoint or arithmetic checks in your work.
- What is the trapezoidal contribution for endpoint values \(3\) and \(7\) across a subinterval of width \(2\)?
- Write the equation of the line interpolating between \((2,1)\) and \((5,4)\), and verify its endpoint values.
- For values \(2,4,1\) at \(x=0,1,3\), calculate the composite trapezoidal estimate using the individual widths.
- Why does an interior value have weight two in the equal-width composite formula?
- For endpoint values \(-3\) and \(1\) across width \(4\), calculate the signed trapezoidal contribution. Explain why it need not equal the total ordinary area.