Why a Smooth Graph Can Still Fool a Numerical Estimate
The trapezoidal rule estimates an integral by joining sampled values with straight line segments and adding the areas of the resulting trapezoids. If the function changes gradually between sample points, this can be an effective approximation. But a smooth function can also oscillate rapidly between those points. Its sampled values may then give little indication of what happens between them.
This is an important limitation: a numerical estimate is based on both the sampled values and assumptions about the integrand. The samples alone do not generally certify that an estimate is accurate.
The Composite Trapezoidal Rule
Let \(f\) be continuous on \([a,b]\), and divide the interval into \(n\) equal subintervals, where \(n\) is a positive integer. The step size and nodes are
The composite trapezoidal estimate for \(\int_a^b f(x)\,dx\) is
The endpoints receive half-weight in the formula, and each interior sample receives full weight. Equivalently, on each subinterval the rule uses the trapezoid whose parallel sides have heights given by the function values at that subinterval’s endpoints.
Worked Example: Three Oscillations Hidden at Every Node
Worked Example: Three Oscillations Hidden at Every Node
Estimate \(\int_0^1\sin(3\pi x)\,dx\) using three equal subintervals, then compare the estimate with the exact integral.
First, \(n=3\), \(a=0\), and \(b=1\), so the step size is
The nodes are \(x_0=0\), \(x_1=\frac13\), \(x_2=\frac23\), and \(x_3=1\). At each node, the sine value is zero:
Therefore the trapezoidal estimate is
But the exact integral is
The estimate is zero even though the integral is positive. The reason is that each sample lands at a zero of the sine function; the nodes fail to register the positive and negative parts between them.
Why Node Values Alone Cannot Guarantee Accuracy
The example is not just an unusual calculation. It shows a basic limitation of finite sampling. Consider \(f_A(x)=A\sin(3\pi x)\) on \([0,1]\), where \(A\) is any positive constant. At the same four nodes, every value is still zero, so \(T_3=0\) for every \(A\). Yet
For any chosen positive number \(M\), taking \(A=\frac{3\pi M}{2}\) makes the exact integral equal to \(M\), while the estimate remains zero. Thus the same node values can be consistent with integrals of arbitrarily large size. These functions are all smooth; smoothness by itself does not prevent the problem.
A Curvature Bound Gives an Error Guarantee
One useful kind of additional information is a bound on the function’s second derivative. Curvature matters because the trapezoidal rule replaces each piece of the graph by a straight line. If the graph bends sharply between nodes, that line can differ substantially from the function.
Why the Error Bound Works
Here is a derivation. On one subinterval \([x_j,x_{j+1}]\), let \(L(x)\) be the line joining the endpoint values of \(f\). The area under \(L\) is exactly the trapezoid’s area on that subinterval. The linear interpolation remainder says that, for each interior \(x\), there is a point \(\xi_x\) in the subinterval such that
Since \(|f''(\xi_x)|\leq M\), and the two factors have opposite signs inside the subinterval, this gives
Write \(t=x-x_j\), so \(0\leq t\leq h\) and \(x_{j+1}-x=h-t\). The difference between the exact area and the trapezoid’s area is at most
There are \(n\) subintervals. Adding their error bounds gives \(nMh^3/12\). Since \(h=(b-a)/n\), this is
This proves the stated bound. The important condition is the available bound \(M\) on \(|f''|\). If the function oscillates more rapidly, its second derivative may be much larger, so the bound may be large even when the step size is small.
Worked Example: Estimating an Error Using Curvature
Worked Example: Estimating an Error Using Curvature
Use two subintervals to estimate \(\int_0^1\sin(\pi x)\,dx\), and use the error bound to assess the estimate.
The step size is \(h=(1-0)/2=1/2\), and the nodes are \(0\), \(1/2\), and \(1\). The function values are
Thus
The exact integral and the actual error are
To apply the theorem, differentiate twice:
On \([0,1]\), \(|\sin(\pi x)|\leq 1\), so \(|f''(x)|\leq\pi^2\). We may take \(M=\pi^2\). The error bound is therefore
The actual error, approximately \(0.1366\), is less than the bound, approximately \(0.2056\). This check confirms that the bound applies correctly here; it is a guarantee, not necessarily the exact error.
A Common Mistake: Treating a Small Estimate as Proof of a Small Integral
A tempting but incorrect conclusion from the first example is: “All four samples are zero, so the integral must be zero.” The calculation only establishes that the trapezoidal estimate is zero:
It does not establish that the function is zero between the nodes. In fact, direct integration gives \(\int_0^1\sin(3\pi x)\,dx=2/(3\pi)\), not zero. The correction is to distinguish the estimate from the integral and seek information—such as a second-derivative bound—that controls their difference.
This issue matters in practice whenever a graph or function is sampled at a fixed spacing. If the spacing is coarse relative to the oscillation, important changes can occur between measurements. A plausible-looking numerical output is not, on its own, evidence that those changes are negligible.
Check Your Understanding
Use the definitions and error bound to explain what the samples establish—and what they do not.
- For \(f(x)=\sin(3\pi x)\) on \([0,1]\) with three equal subintervals, list the node values and calculate \(T_3\).
- Evaluate \(\int_0^1\sin(3\pi x)\,dx\). Why does its value differ from the trapezoidal estimate?
- For \(f_A(x)=A\sin(3\pi x)\), what is the trapezoidal estimate on the same nodes, and what is the exact integral?
- State the assumptions and formula for the composite trapezoidal error bound.
- For \(f(x)=\sin(\pi x)\) on \([0,1]\), identify a valid value of \(M\) for the error bound and explain what \(M\) measures.