Why Unequal Spacing Requires Care
A table of function values does not always use equally spaced \(x\)-values. For example, measurements might be recorded more frequently in one region than another. To estimate the area represented by a definite integral, the trapezoidal method connects neighboring data points with line segments and adds the areas of the resulting trapezoids.
When the spacing is uniform, every trapezoid has the same width. With unequal spacing, each panel has its own width, so each pair of neighboring function values must be multiplied by that panel’s width. Using one common width can produce an incorrect estimate even if all the function values are copied correctly.
The Nonuniform Trapezoidal Formula
Let the interval be partitioned at ordered points \(x_0<x_1<\cdots<x_n\). Write \(f_i=f(x_i)\), and let \(\Delta x_i=x_{i+1}-x_i\) be the width of the panel from \(x_i\) to \(x_{i+1}\). The panel has endpoint heights \(f_i\) and \(f_{i+1}\).
For an area interpretation, the graph should remain on or above the \(x\)-axis on the interval being considered. Each panel’s trapezoid area is its width multiplied by the average of its two endpoint heights. In applications, the integral is estimated by replacing the curve on each panel with the straight segment joining its endpoint values.
The formula uses the full list of partition points, not just the number of panels and the overall interval length. Before calculating, find every \(\Delta x_i\). In general, these widths are not interchangeable.
Worked Example: Three Panels with Different Widths
Worked Example: Three Panels with Different Widths
Use the table to estimate \(\int_0^3 f(x)\,dx\) by the trapezoidal method.
| \(x\) | \(f(x)\) |
|---|---|
| \(0\) | \(1\) |
| \(0.5\) | \(2\) |
| \(2\) | \(1\) |
| \(3\) | \(4\) |
Step 1: Find the panel widths.
Step 2: Calculate each trapezoid. The first panel has endpoint heights \(1\) and \(2\), the second has heights \(2\) and \(1\), and the third has heights \(1\) and \(4\).
Step 3: Add the panel areas.
The estimated integral is \(5.5\) square units if the horizontal and vertical measurements are in the same length units. As an arithmetic check, the panel widths add to \(0.5+1.5+1=3\), the full interval length, and the three panel estimates add to \(5.5\).
Why the Formula Works
The trapezoidal rule replaces the function on one panel by the line segment joining its endpoint values. Integrating that line gives exactly the area of the panel’s trapezoid. Adding these individual approximations gives the composite estimate. The derivation also shows why each panel must use its own width.
This derivation is a justification of the approximation method, not a claim that a curved function equals its interpolating line. If the function is linear on every panel, the estimate equals the definite integral exactly. Otherwise, it is an approximation based on the endpoint data.
Worked Example: Unequal Panels from a Data Table
Worked Example: Unequal Panels from a Data Table
A quantity \(r(t)\) is measured in units per minute, with \(t\) in minutes. Use the data below to estimate the accumulated quantity from \(t=1\) to \(t=3\).
| \(t\) (minutes) | \(r(t)\) (units per minute) |
|---|---|
| \(1\) | \(1\) |
| \(1.4\) | \(2.5\) |
| \(2.2\) | \(1.5\) |
| \(3\) | \(4\) |
Step 1: Calculate each time width.
Step 2: Estimate the accumulation on each panel. Each estimate is the time width times the average of the two endpoint rates.
Step 3: Add the contributions.
The units check: \((\text{minutes})(\text{units per minute})=\text{units}\). The widths also check, since \(0.4+0.8+0.8=2\) minutes, matching the interval from \(1\) to \(3\). The estimated accumulated quantity is \(4.5\) units.
An Equivalent Weighted-Sum Form
The panel formula can also be regrouped by function value. Each endpoint value appears in one panel; an interior value appears in the two panels that meet there. This gives a useful way to check a calculation, provided that the widths attached to each value are retained.
For instance, in the first worked example, the coefficient of \(f_1\) is \((0.5+1.5)/2=1\): that function value borders panels of widths \(0.5\) and \(1.5\). It is not generally correct to give every interior value the same coefficient, because the widths around different interior points may differ.
Worked Example: Check the Estimate in Two Forms
Worked Example: Check the Estimate in Two Forms
Let \(f(x)=x^2\), and use the partition \(0,1,3\) to estimate \(\int_0^3 x^2\,dx\).
Step 1: Record the values and widths.
Step 2: Apply the panel formula.
Step 3: Check using the weighted-sum form. The coefficient of the interior value \(f(1)\) is \((1+2)/2=1.5\).
Both forms give the same estimate, \(10.5\). As an additional check, the exact integral is \(\left[\frac{x^3}{3}\right]_0^3=9\), so the numerical estimate is an approximation rather than an equality. This comparison checks the result for this example; it does not establish a general rule about the direction of trapezoidal error.
Common Pitfall: Reusing One Width
The familiar equal-subinterval formula uses one constant width \(h\). It is valid only when all the panels have that same width. On an unequal partition, replacing every \(\Delta x_i\) with a single \(h\) changes the calculation.
A reliable habit is to write the partition points in increasing order, calculate the consecutive differences, and then write one trapezoid term per panel. Only after those steps should the terms be added. This makes it easier to spot a missing panel, a misplaced function value, or a width assigned to the wrong pair of endpoints.
When This Method Is Useful
The nonuniform trapezoidal rule is useful whenever function values are available at ordered sample points but the spacing varies. It is especially natural for data collected at irregular times or locations: each neighboring pair contributes an estimate over precisely the interval between those two measurements.
The method depends on the chosen partition and the available endpoint values. A panel with a large width contributes its own width factor, while a narrow panel contributes a smaller one. The formula does not require the widths to be equal, but it does require using the correct width for every adjacent pair. When the function is known by a formula, a definite integral may sometimes be evaluated exactly; when only sampled values are available, a numerical estimate such as this one provides an approximation.
Check Your Understanding
Use the panel formula, and show the width of every subinterval in your work.
- For partition points \(0,2,5\) with function values \(f(0)=1\), \(f(2)=3\), and \(f(5)=2\), calculate the trapezoidal estimate.
- For partition points \(1,1.5,2.5\) with values \(4,2,6\), what are the two panel estimates and their sum?
- State the condition under which the equal-subinterval formula can be used with a single width \(h\).
- Explain why an interior function value receives contributions from two neighboring panels in the weighted-sum form.
- If a rate is measured in liters per hour and the horizontal variable in hours, what are the units of the trapezoidal estimate?