Solution (source code)

= Solution

The <trapezoidal rule> is exact for every <affine function> $f(x)=\alpha+\beta x$, equivalently every <polynomial> of <polynomial degree> at most one: the <linear interpolant> is the <function> itself. These <functions> have $f''=0$, so the preceding upper bound is also zero. There is \b[no contradiction]: zero error is precisely what the bound predicts.

The <degree of precision of a quadrature rule> is one, since the <quadratic polynomial> in part (i) is not integrated exactly. This does not exclude exactness for particular higher-degree or nonpolynomial <functions>. For example $f(x)=(x-m)^3$, $m=(a+b)/2$, has zero <integral> and opposite endpoint values, so the <trapezoidal rule> also gives zero. Its <second derivative> is generally nonzero, making the upper bound positive; an upper bound need not be attained. Signed <quadrature error> can cancel.