Lipschitz continuity and integration. 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.
 A: You need to prove
$$
(b-c)^2 + (a-c)^2 \le (b-a)^2.
$$
A bit of algebra reduces this to
$$
c^2-bc-ac+ab \le 0.
$$
Factor by grouping:
$$
(c-a)(c-b)\le 0.
$$
This just says $c$ is between $a$ and $b$.  It says that regardless of whether $a\le b$ or $b\le a$.
A: Another way is to write $$(b-a)^2= ((b-c)-(a-c))^2= (b-c)^2+ (a-c)^2-2(b-c)(a-c) \geq (b-c)^2+(a-c)^2$$ because $(b-c)(a-c) \leq 0$.
For your second question, consider $\displaystyle \frac{1}{\lambda} f$ and apply your first result.
A: I like pictures...

$\frac{(c-a)^2}{2} + \frac{(b-c)^2}{2} = m(T_1)+m(T_2)  \leq \frac{m(R_1)+m(R_2)}{2} \leq \frac{1}{2} (b-a) \max(c-a,b-c) \leq \frac{1}{2} (b-a)^2$.
A: Consider $f(c) = \dfrac{(b-c)^2+ (a-c)^2}{2}$. Then $f´(c) = (a-c)+(b-c)$. Hence, $f$ decreases of $a$ to $\dfrac{a+b}{2}$ and increases of $\dfrac{a+b}{2}$ to $b$. Hence $\dfrac{(a+b)^2}{2}=f(a)\ge f(c)$ to $a\le c\le \dfrac{a+b}{2}$ and $f(c) \le \dfrac{(a+b)^2}{2}=f(b)$ to $\dfrac{a+b}{2}\le c \le b$. Namely,
$f(c) \le \dfrac{(a+b)^2}{2}$ to $c\in[a,b]$.
