We can approximate a definite integral, $\int_a^b f(x)dx$, using a variety of Riemann sums. If $T_n$ and $M_n$ are the nth sums using the trapezoid and midpoint (middle) sum methods and if the second derivative of $f$ is bounded on $[a, b]$ then does the following theorem imply that $M_n$ "tends to be more accurate" then $T_n$?

If $f''$ is continuous on $[a, b]$ and $|f''(x)| \leq K$, $\forall$ $x \in [a, b]$. Then,

$\left| \int_a^b f(x)dx - T_n \right| \leq K\frac{(b-a)^3}{12n^2}$


$\left| \int_a^b f(x)dx - M_n \right| \leq K\frac{(b-a)^3}{24n^2}$

For this question let, $E_{T_n} = \left| \int_a^b f(x)dx - T_n \right| $ and $E_{M_n} = \left| \int_a^b f(x)dx - T_n \right| $

The theorem is presented (without proof) in a calculus 2 book. It only really seems to imply that, we can with 100% certainly bound E_{M_n} smaller than we can bound E_{T_n}. But, that says nothing about the actual values of E_{T_n} or E_{M_n}.

So, isn't it possible to customize a function so that $E_{T_n} < E_{M_n}$ for a particular n? Could we even make a function so that $E_{T_n} < E_{M_n}$ $\forall n$?

  • $\begingroup$ For a particular $n$, absolutely: that's equivalent to doing it for $n=1$ and replicating the function across multiple intervals. Just consider any function satisfying $f(0)=f(1)=0$ and $\int_0^1 f(x)\, dx = 0$, but $f(1/2) \ne 0$. Then $E_T = 0$ but $E_M$ can be as large as you want (by rescaling $f$). $\endgroup$
    – Erick Wong
    May 4, 2016 at 8:40
  • $\begingroup$ This shows $T = 0$, not $E_T = 0$. $\endgroup$
    – RRL
    May 5, 2016 at 2:20
  • $\begingroup$ Although the Midpoint Rule is typically more accurate, it should be said that the Trapezoid Rule can be used to get $guaranteed$ upper and lower bounds for integrals of concave and convex functions respectively, which cannot be said for the Midpoint Rule. $\endgroup$
    – user123641
    Oct 30, 2017 at 15:56

1 Answer 1


As you observed, the midpoint method is typically more accurate than the trapezoidal method. This is suggested by the composite error bounds, but they don't rule out the possibility that the trapezoidal method might be more accurate in some cases.

We can get a better understanding by examining the local errors for single-segment rules. Consider an interval $[a,b]$ and define interval length $h = b-a$ and midpoint $c = (a+b)/2.$ Note that $b-c = c-a = (b-a)/2 = h/2.$

The midpoint error is

$$E_M = f(c)h - \int_a^b f(x) \, dx = \int_a^b [f(c) - f(x)] \, dx.$$

Using a second-order Taylor approximation,

$$f(c) = f(x) + f'(x)(c-x) + \frac{1}{2} f''(\xi_x)(x-c)^2, $$

we see

$$E_M = -\int_a^b f'(x)(x-c) \, dx + \frac{1}{2}\int_a^b f''(\xi_x)(x-c)^2 \, dx.$$

Applying integration by parts to the first integral on the RHS we get

$$\int_a^b f'(x)(x-c) = \left.(x-c)f(x)\right|_a^b - \int_a^b f(x) \, dx = \frac{h}{2}[f(a) + f(b)] - \int_a^b f(x) \, dx .$$

Note that this result gives us the error $E_T$ for the trapezoidal method.


$$E_M = -E_T + \frac{1}{2}\int_a^b f''(\xi_x)(x-c)^2 \, dx.$$

It is actually not that easy to find examples where $|E_T| < |E_M|$. Using the above result, we can surmise that this could happen when the midpoint method overestimates, $E_M > 0$, the trapezoidal method underestimates $E_T < 0,$ and we have high curvature in a small neighborhood of a point in the interval.

Here is a somewhat contrived example.

Consider the following function that meets those requirements. Note that the second derivative is piecewise continuous but bounded -- which does not degrade the composite $O(n^{-2})$ accuracy.

$$f(x) = \begin{cases} 0.25 + 0.75\exp(-200 x^2), &\mbox{if } -1 \leqslant x \leqslant 0 \\ 0.99 + 0.01 \cos(\pi x), &\mbox{if } \,\,\,\,\,\,\, 0 < x \leqslant 1 \end{cases}.$$


$$\begin{align}\int_{-1}^1 f(x) \, dx &\approx 1.2870\\ M &\approx 2 \\ T &\approx 1.2300 \\ E_M &\approx 0.7130 \\ E_T &\approx 0.0570 \end{align}$$

  • $\begingroup$ I think you can use periodic smooth functions to get non-contrived examples. $\endgroup$
    – Ian
    May 5, 2016 at 2:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.