Why Combine Several Trapezoids?
A definite integral can represent accumulated quantity, such as distance from a velocity function. Sometimes the function is known only at a finite collection of points, so evaluating an exact integral is not an option. The trapezoidal rule estimates the integral by joining consecutive sampled points with line segments and adding the areas of the resulting trapezoids.
Using several subintervals creates a composite trapezoidal estimate. When the subintervals have equal width, the estimate can be calculated efficiently with one formula. The formula gives the two endpoints half the weight of each interior value. Understanding where those weights come from helps prevent a common arithmetic error.
Equal Subintervals and Sampled Values
Suppose we want to estimate \(\int_a^b f(x)\,dx\) using \(n\) equal subintervals, where \(n\) is a positive integer. The width of each subinterval is
Starting at \(a\), the partition points are \(x_i=a+ih\), for \(i=0,1,\ldots,n\). In particular, \(x_0=a\) and \(x_n=b\). There are \(n\) subintervals but \(n+1\) sampled function values: \(f(x_0), f(x_1),\ldots,f(x_n)\).
For one subinterval \([x_i,x_{i+1}]\), the trapezoid has parallel sides of lengths \(f(x_i)\) and \(f(x_{i+1})\), and width \(h\). When these values are nonnegative, its geometric area is the average of the parallel sides times the width:
Adding these local contributions gives the composite estimate. The same formula is used to estimate the definite integral, with each sampled function value treated as a signed height when appropriate.
Deriving the Composite Formula
Write \(f_i=f(x_i)\) for shorter notation. The estimate is the sum of the local trapezoids:
Factor out the common multiplier \(h/2\). The first endpoint value \(f_0\) occurs only in the first trapezoid, and the last endpoint value \(f_n\) occurs only in the final trapezoid. Every interior value \(f_i\), where \(1\leq i\leq n-1\), occurs in two neighboring trapezoids: once as a right-hand height and once as a left-hand height. Therefore each interior value appears twice in the sum.
This derivation explains the weights: they are not a separate adjustment to memorize. They follow from counting how many local trapezoids use each sampled value.
A Reliable Calculation Process
Before using the formula, identify the number of subintervals and the sample points. A table with \(n+1\) values has \(n\) subintervals. Then calculate \(h\), keep the endpoints separate from the interior values, and apply the common factor \(h/2\).
If there are \(n+1\) consecutive sampled points, there are \(n\) subintervals.
Calculate \(h=(b-a)/n\) and confirm that successive \(x\)-values are separated by this amount.
Add the endpoint values once, add each interior value twice, and multiply the bracketed sum by \(h/2\).
Calculate each trapezoid separately and confirm that their sum matches the formula.
Worked Examples
Worked Example: Estimate an Integral from a Table
Suppose equally spaced values of \(f\) are given below. Use the composite trapezoidal rule to estimate \(\int_0^3 f(x)\,dx\).
| \(x\) | 0 | 1 | 2 | 3 |
|---|---|---|---|---|
| \(f(x)\) | 1 | 2 | 4 | 3 |
There are four sampled points, so \(n=3\) subintervals. Their width is
The endpoint values are \(f(0)=1\) and \(f(3)=3\). The interior values are \(f(1)=2\) and \(f(2)=4\). Substitute them into the formula:
Check by adding the local trapezoids. Their estimates are \(\frac{1}{2}(1+2)(1)=1.5\), \(\frac{1}{2}(2+4)(1)=3\), and \(\frac{1}{2}(4+3)(1)=3.5\). Their sum is \(1.5+3+3.5=8\), matching the composite formula. Thus the estimate is \(8\).
Worked Example: Use a Function to Generate the Values
Use four equal subintervals to estimate \(\int_0^2 (x^2+1)\,dx\) with the composite trapezoidal rule.
Here \(n=4\), so
The partition points are \(x_i=0+i/2\), giving \(0,\frac12,1,\frac32,2\). Evaluate \(f(x)=x^2+1\) at each point:
The endpoints have values \(1\) and \(5\); the interior values are \(\frac54,2,\frac{13}{4}\). Therefore,
For a check, calculate the four local contributions using width \(\frac12\):
Their sum is \((9+13+21+33)/16=76/16=19/4=4.75\), as required. The trapezoidal estimate is \(4.75\).
Worked Example: Estimate Accumulated Distance from Velocity Data
A vehicle’s velocity is recorded at equal time intervals. Estimate the distance traveled over the eight seconds shown, using the composite trapezoidal rule.
| Time \(t\) (s) | 0 | 2 | 4 | 6 | 8 |
|---|---|---|---|---|---|
| Velocity \(v(t)\) (m/s) | 3 | 5 | 4 | 7 | 6 |
There are five data points and hence \(n=4\) subintervals. The common width is \(h=(8-0)/4=2\) seconds. The trapezoidal estimate for accumulated distance is
Velocity is measured in metres per second and the width in seconds, so the estimate has units \((\mathrm{m/s})(\mathrm{s})=\mathrm{m}\). Check using the individual trapezoids: their estimates are \(\frac{2}{2}(3+5)=8\) m, \(\frac{2}{2}(5+4)=9\) m, \(\frac{2}{2}(4+7)=11\) m, and \(\frac{2}{2}(7+6)=13\) m. The total is \(8+9+11+13=41\) m, which agrees with the weighted formula.
A Common Weighting Error
A frequent mistake is to double the endpoint values as well as the interior values. Return to the table in the first example. Incorrectly doubling all four values gives
This is not the composite trapezoidal estimate. The first and last values each occur in only one local trapezoid, so they must appear once. Only the interior values occur in two neighboring trapezoids. The correct calculation is
The local-trapezoid check confirms the correction: the three contributions add to \(8\), not \(10\). A second useful safeguard is to include the factor \(h/2\); the weighted sum by itself is not the estimate.
What the Estimate Represents
The method replaces the curve between adjacent sampled points with a straight segment. Each segment forms one trapezoid, and the estimate adds the contributions from all the subintervals. More sampled points give more trapezoids, but the formula still uses the same structure: endpoints once, interior points twice, then multiply by \(h/2\).
When an integral represents accumulated change, the trapezoidal rule turns sampled rates into an estimated total. In the velocity example, multiplying a velocity scale by a time width produces distance. In other settings, the units of the estimate come from multiplying the units of the function by the units of \(x\). Checking these units and comparing the formula with the sum of local trapezoids are practical ways to catch mistakes.
Check Your Understanding
For each question, identify the subinterval width before applying any weights.
- A table gives five equally spaced values on \([2,10]\). How many subintervals are there, and what is their common width?
- For \(n\) equal subintervals, which sampled values are counted once in the composite formula, and which are counted twice?
- Use the composite formula to estimate an integral when \(h=2\), the endpoint values are \(3\) and \(5\), and the interior values are \(4\) and \(6\).
- Explain why an interior value occurs twice when the local trapezoid contributions are added.
- A velocity estimate uses time in seconds and velocity in metres per second. What units should the resulting trapezoidal estimate have?