I'm re-reading some material from Apostol's Calculus. He asks to prove that, if $f$ is such that, for any $x,y\in[a,b]$ we have
$|f(x)-f(y)|\leq|x-y|$
then:
$(i)$ $f$ is continuous in $[a,b]$
$(ii)$ For any $c$ in the interval,
$\left|\int_a^b f(x)dx-(b-a)f(c)\right|\leq\frac{(b-a)^2}{2}$
The proof for the first part is easy, and I ommit it. I'm interested in the second one.
We can write that as
$\left| {\int_a^b f (x)dx - \int_a^b f (c)dx} \right| \leqslant \frac{{{{(b - a)}^2}}}{2}$
Or $\left| {\int_a^b {\left( {f(x) - f(c)} \right)dx} } \right| \leqslant \frac{{{{(b - a)}^2}}}{2}$
Now, it is not hard to show that
$\left| {\int_a^b {\left( {f(x) - f(c)} \right)dx} } \right| \leqslant \int_a^b {\left| {f(x) - f(c)} \right|dx} $
By hypothesis, we have
$\left| {f(x) - f(c)} \right| \leqslant \left| {x - c} \right|$
so that
$\left| {\int_a^b {\left( {f(x) - f(c)} \right)dx} } \right| \leqslant \int_a^b {\left| {f(x) - f(c)} \right|dx} \leqslant \int\limits_a^b {\left| {x - c} \right|dx} $
The last term, integrates as follows:
$\int\limits_a^b {\left| {x - c} \right|dx} = - \int\limits_a^c {\left( {x - c} \right)dx} + \int\limits_c^b {\left( {x - c} \right)dx} = \frac{{{{\left( {b - c} \right)}^2} + {{\left( {a - c} \right)}^2}}}{2}$
How can I conciliate that with $\frac{{{{\left( {b - a} \right)}^2}}}{2}?$
I'd like to know what happens in the general case
$|f(x)-f(y)|\leq \lambda |x-y|$ too.