Introduction
The trapezoidal rule replaces a function’s graph on each panel with a straight line joining the endpoint values. The area under that line is the area of a trapezoid, so the rule approximates the integral by adding trapezoid areas.
The shape of the graph tells us which way this approximation tends to err. If the function is convex, each endpoint chord lies above the graph, so the trapezoidal estimate is too large. If the function is concave, the chords lie below the graph, so the estimate is too small. This direction of error is called the trapezoid bias.
Convexity, Concavity, and the Second Derivative
The right-hand side is the value at \((1-t)u+tv\) of the straight line joining \((u,f(u))\) and \((v,f(v))\). Thus convexity says the graph lies on or below every chord between two points on it; concavity says it lies on or above every such chord.
A useful way to check convexity is with the second derivative. If \(f\) is twice continuously differentiable on an interval and \(f''(x)\ge 0\) throughout it, then \(f\) is convex there. If \(f''(x)\le 0\) throughout, then \(f\) is concave. Strict positivity or negativity throughout the interior gives strict convexity or strict concavity.
The sign condition needs to hold across the interval being considered. A second derivative that is positive at just one point does not establish convexity on the whole interval.
The Composite Trapezoidal Estimate
Let \(f\) be continuous on \([a,b]\), with \(a<b\). Divide the interval into \(n\) equal panels, where \(n\) is a positive integer. The panel width is \(h=(b-a)/n\), and the nodes are \(x_i=a+ih\) for \(i=0,1,\ldots,n\). The composite trapezoidal estimate is
On each panel \([x_{i-1},x_i]\), this formula uses the area of the trapezoid whose parallel sides have lengths \(f(x_{i-1})\) and \(f(x_i)\). The estimate \(T_n\) is the sum of those panel areas. The bias result compares this sum with the exact integral.
The conclusion holds for every positive panel count \(n\). The panel width affects the size of the discrepancy, but not its direction under these curvature assumptions.
Why the Bias Result Holds
It is enough to compare the function with its endpoint chord on a single panel. Let \([p,q]\) be any panel and let \(L(x)\) be the line joining \((p,f(p))\) to \((q,f(q))\). If \(f''\ge 0\), define \(g(x)=f(x)-L(x)\). Then \(g(p)=g(q)=0\) and \(g''(x)=f''(x)\ge 0\).
For \(u<v\), the mean value theorem applied to \(g'\) gives \(g'(v)-g'(u)=g''(\xi)(v-u)\ge 0\) for some \(\xi\) between \(u\) and \(v\).
If there were an \(x\) with \(p<x<q\) and \(g(x)>0\), the mean value theorem applied to \(g\) on \([p,x]\) would give a point \(c_1\in(p,x)\) with \(g'(c_1)=g(x)/(x-p)>0\).
Applied on \([x,q]\), the theorem would give \(c_2\in(x,q)\) with \(g'(c_2)=-g(x)/(q-x)<0\). Since \(c_1<c_2\), this contradicts the fact that \(g'\) is nondecreasing. Therefore \(g(x)\le 0\) throughout the panel.
We have shown that \(f(x)\le L(x)\): a convex function lies on or below its endpoint chord. Integrating over the panel preserves this inequality. The integral of \(L\) is exactly the trapezoid area on that panel. Adding the inequalities over all panels gives \(\int_a^b f(x)\,dx\le T_n\). For a concave function, apply the same argument to \(-f\), which is convex; reversing signs gives \(T_n\le\int_a^b f(x)\,dx\).
If the curvature is strictly positive throughout a panel’s interior, the graph lies strictly below its chord at interior points, so the integral inequality on that panel is strict. This explains why strict curvature gives a strict overall bias.
Worked Examples
Worked Example: A Convex Quadratic
Estimate \(\int_0^1 x^2\,dx\) using four equal panels, then check the direction and size of the bias.
Here \(f(x)=x^2\), so \(f''(x)=2>0\). The function is convex, and the theorem predicts an overestimate. The panel width is \(h=(1-0)/4=1/4\), and the nodes are \(0,1/4,1/2,3/4,1\). The function values are \(0,1/16,1/4,9/16,1\). Substitution gives
The exact integral is
Comparing the values, \(11/32-1/3=33/96-32/96=1/96>0\). Thus \(T_4=11/32\) is indeed an overestimate, and the exact difference is \(1/96\).
Worked Example: A Concave Quadratic
Use two equal panels to estimate \(\int_0^1(2x-x^2)\,dx\) and verify the prediction.
Let \(f(x)=2x-x^2\). Since \(f''(x)=-2<0\), the function is concave, so the trapezoidal estimate should be an underestimate. The panel width is \(h=1/2\), with nodes \(0,1/2,1\). The values are \(f(0)=0\), \(f(1/2)=1-1/4=3/4\), and \(f(1)=2-1=1\). Therefore
Direct integration gives
The difference is \(T_2-\int_0^1(2x-x^2)\,dx=5/8-2/3=15/24-16/24=-1/24\). The estimate is below the exact integral, as the concavity test predicts.
Worked Example: A Convex Quartic
Apply the trapezoidal rule with two equal panels to \(\int_0^1 x^4\,dx\), and compare the estimate with the exact value.
For \(f(x)=x^4\), we have \(f''(x)=12x^2\ge 0\) on \([0,1]\), with strict positivity for \(x>0\). Thus the function is convex and the estimate should be strictly too large. The width is \(h=1/2\), and the values at \(0,1/2,1\) are \(0,1/16,1\). Hence
The exact integral is \(\int_0^1x^4\,dx=[x^5/5]_0^1=1/5\). The difference is \(9/32-1/5=45/160-32/160=13/160>0\). The estimate is an overestimate, in agreement with the second-derivative test.
When the Curvature Test Does Not Decide
The theorem gives a reliable direction when the second derivative has one sign throughout the interval. If \(f''\) changes sign, the graph may alternate between lying below and above its chords on different panels. The theorem then gives no general conclusion about the total bias: the effects may reinforce one another, partially cancel, or even cancel exactly.
For instance, \(f(x)=x^3-\frac32x^2\) has \(f''(x)=6x-3\), which changes sign at \(x=1/2\) on \([0,1]\). With one panel, the trapezoidal estimate is \((f(0)+f(1))/2=(0-1/2)/2=-1/4\). The exact integral is \([x^4/4-x^3/2]_0^1=1/4-1/2=-1/4\), so this estimate happens to be exact. The changing curvature alone does not predict that outcome.
A Common Mistake
A frequent error is to reverse the relationship between convexity and the endpoint chord. For \(f(x)=x^2\) on \([0,1]\), the chord from \((0,0)\) to \((1,1)\) is \(L(x)=x\). Since \(x^2\le x\) on this interval, the graph lies below its chord. The chord’s area, \(1/2\), is therefore greater than the exact integral, \(1/3\).
The incorrect claim “convex means the graph lies above its chord, so the trapezoid underestimates” reverses both the geometry and the bias. The correction is: convex means the graph lies below its endpoint chord, so the trapezoidal rule overestimates. For concave functions, both directions reverse.
Using the Bias in Practice
The bias result is useful because it adds qualitative information to a numerical estimate. It tells you which side of the exact integral the estimate lies on, without requiring you to compute the exact integral. It can also flag a suspicious numerical result: if a function is known to be convex on the entire integration interval but the computed trapezoidal estimate is below a known exact integral, then either the calculation or the assumptions should be checked.
Before making a prediction, check the interval carefully. Confirm that the function is twice continuously differentiable there and that the second derivative has the required sign over the whole interval. If the sign condition holds, convexity or concavity determines the direction of bias for every composite panel count. If it does not hold, do not infer a direction from the curvature at just one point.
Check Your Understanding
Use the definition, the second-derivative test, and the bias theorem to answer these questions.
- If \(f''(x)\ge 0\) throughout an interval, does the composite trapezoidal estimate overestimate or underestimate the integral?
- For \(f(x)=\cos x\) on \([0,\pi/2]\), determine the sign of \(f''\) and predict the bias direction.
- For \(f(x)=x^3\) on \([0,1]\), determine whether the trapezoidal estimate with any positive number of equal panels is above or below the exact integral.
- Why does a second derivative that changes sign prevent this theorem from giving a general direction for the total bias?
- For \(f(x)=1-x^2\) on \([0,1]\), use the curvature test to predict the direction of trapezoidal bias.