All of the bounds I've seen for the error of the midpoint method of integration are expressed in terms of the second derivative of the function. What bounds are available when the function is not twice-differentiable? In particular, is it the case that for every continuous function $f$ on $[0,1]$, the midpoint method of estimating $\int\_0^1 f(x)\: dx$ has error $o(1/n)$? If the answer to this last question is "no" (and I'm pretty sure it is, unless I've misunderstood the example Carnahan gave in response to my earlier question [Dependence of error on mesh for Riemann sums](https://mathoverflow.net/questions/13344/dependence-of-error-on-mesh-for-riemann-sums)), does the answer change to "yes" if we assume that $f$ has bounded variation? That $f$ is monotone?



Error of midpoint method for functions that are not twice-differentiable
If the function is monotone, then the error for the midpoint approximation with $n$ intervals is at most $\frac{f(1)-f(0)}{2n}$. Say we know $f$ is increasing and the values at the midpoints, $f(m\_i)$ for $i=1,\dots n$, as well as $f(0)$ and $f(1)$, are known. Then the $g\_L$ with the smallest integral that satisfies those constraints (not continuous, but arbitrarily closely approximated by continuous functions) is the stepwise function $$g\_L(x) = f(m\_i) \text{ whenever } m\_i\leq x < m\_{i+1}$$ where by convention $m\_0 = 0$ and $m\_{n+1}=1$. Similarly, the function with the largest integral that satisfies these constraints is
$$g\_U(x) = f(m\_{i+1}) \text{ whenever } m\_i < x \leq m\_{i+1}$$
So we have $$\int\_0^1 g\_L(x) dx \leq \int\_0^1 f(x)dx \leq \int\_0^1 g\_U(x)dx$$
Note that the functions $g\_L$ and $g\_M$ depend on $f$ and $n$, but $f$ does not depend on $n$.
Then $$\int\_0^1 g\_L(x) dx = \sum\_{i=0}^{n} (m\_{i+1} - m\_i)f(m\_i) = \frac{1}{2n}f(0) + \frac{1}{n}\sum\_{i=1}^{n-1} f(m\_i) + \frac{1}{2n} f(m\_n)$$ and a similar calculation gives $\int\_0^1 g\_U(x) dx$.


Subtracting the midpoint approximation from the integral inequality above gives $$\frac{f(0)-f(m\_n)}{2n} \leq \int\_0^1 f(x) dx - \frac{1}{n}\sum\_i f(m\_i) \leq \frac{f(1) - f(m\_1)}{2n}$$ and one can see that the magnitude of the error is bounded by $\frac{f(1)-f(0)}{2n}$.


If $f$ is of bounded variation, then $f = f^+ - f^-$ where each summand is monotone increasing. Since taking integrals and taking midpoint approximations both commute with finite sums, the total error is bounded by $\frac{f^+(1)-f^+(0) + f^-(1) - f^-(0)}{2n}$. Note that the numerator is the total variation of the function.


**EDIT: The following was added on 2/17/14.**


To see that $O(1/n)$ is the best possible, consider the following construction of a continuous monotone increasing function $f$ with $f(0)=0, f(1)=1$, and for infinitely many $n$, the midpoint approximation at $n$ has error greater than $\frac{1}{4n}$. The function is constructed in stages, similar to the Cantor function.


First we mess up the approximation for $n=2$. Since the samples are taken at $\frac{1}{4}$ and $\frac{3}{4}$, define $$f(x) = \begin{cases} 0 &\text{ if } x \in [0,\frac{1}{4}] \\ \frac{1}{2} &\text{ if } x \in [\frac{1}{4}+\varepsilon\_1, \frac{3}{4}] \\ 1 & \text{ if } x \in [\frac{3}{4}+\varepsilon\_1, 1]\end{cases}$$ where $\varepsilon\_1<\frac{1}{4}$ will be chosen soon. Regardless of the choice for $\varepsilon\_1$, the midpoint approximation at $n=2$ is $\frac{1}{4}$. The integral of the function (based on its values where it has been defined so far) is at least $\frac{1}{2} - \frac{3}{2}\varepsilon\_1$. So by choosing $\varepsilon\_1$ small enough, we can guarantee an error of at least $\frac{1}{8}$. 


It is convenient to make $\varepsilon\_1$ of the form $2^{-k\_1}$. Then the $2^{k\_1+1}$ approximation will be perfect on all but four $\varepsilon\_1/2$-length intervals, in two pairs. Now we have set ourselves up to recurse, messing up the $2^{k\_1+1}$ midpoint approximation by putting in each $\varepsilon\_1$-sized gap an appropriate increasing function of variation $\frac{1}{2}$ which is badly under-approximated by the pair of values it contributes to the overall approximation.


That is, we may define
$$f(x) = \begin{cases} 0 &\text{ if } x - \frac{1}{4} \in [0,\frac{\varepsilon\_1}{4}] \\ \frac{1}{4} &\text{ if } x-\frac{1}{4} \in [\frac{\varepsilon\_1}{4} + \varepsilon\_2, \frac{3\varepsilon\_1}{4}] \\ \frac{1}{2} & \text{ if } x-\frac{1}{4} \in [\frac{3\varepsilon\_1}{4} + \varepsilon\_2, \varepsilon\_1]\end{cases}$$ where $\varepsilon\_2$ will be chosen soon. The $2^{k\_1+1}$ approximation estimates the integral of $f$ on $[\frac{1}{4}, \frac{1}{4}+\varepsilon\_1]$ to be $\frac{\varepsilon\_1}{8}$, but the actual integral is at least $\frac{\varepsilon\_1}{4} - \frac{3}{2}\varepsilon\_2$, so by choosing $\varepsilon\_2$ sufficiently small, we can guarantee that the error is at least $\frac{\varepsilon\_1}{16}$. By defining $f$ analogously on $[\frac{3}{4},\frac{3}{4}+\varepsilon\_1]$ (choosing the same $\varepsilon\_2$, but all the values are shifted up by $\frac{1}{2}$), we can double the total error to at least $\frac{\varepsilon\_1}{8} = \frac{1}{4\cdot 2^{k\_1+1}}$. 


Now there are four gaps of size $\varepsilon\_2$, each of which should support an increasing function of variation $\frac{1}{4}$. Recurse.


