How to use MVT to prove the following problem Let $f(x)$ be continuous on $[a,b]$, differentiable on $(a,b)$, and $f(a)=f(b),|f'(x)|\leqslant1$. prove that for any $x_1,x_2\in[a,b]$ establish$$|f(x_1)-f(x_2)|\leqslant\frac{b-a}{2}.$$
I want to use MVT.But I don't know how did the $\frac{1}{2}$.
 A: Preliminary remarks: $f(a) = f(b)$ means that the function can be extended to a continuous function on $\Bbb R$ with period $b-a$. Then either or $x_1$ and $x_2$ can be shifted left or right by $b-a$ such that the new arguments satisfy $|x_1' - x_2'| \le (b-a)/2$, and $f(x_1) - f(x_2) = f(x_1') - f(x_2')$. The technical problem is that the extended function is not necessarily differentiable everywhere. However, that idea can be used for the following
Proof: Assume that $a \le x_1 \le x_2 \le b$.
If $x_2 - x_1 \le (b-a)/2$ then the mean-value theorem gives
$$
 |f(x_1) - f(x_2)| \le x_2-x_1 \le \frac 12 (b-a) \, .
$$
Otherwise $x_2 - x_1 > (b-a)/2$ and then we use the additional condition that $f(a) = f(b)$:
$$
|f(x_1) - f(x_2)| = |f(x_1) - f(a) + f(b) - f(x_2)|\\
\le |f(x_1) - f(a)| + |f(b) - f(x_2)|  \\\le (x_1-a) + (b-x_2) < \frac 1 2 (b-a) \, .
$$
A: Same solution probably written differently and in a more intricate way but it came to me like that before reading MartinR solution:
Suppose wlog $x<y$ and per absurdum that $|f(y)-f(x)|>(b-a)/2$. In such a case we would have:
$|f(y)-f(x)|>(b-a)/2 \rightarrow y-x>(b-a)/2 \rightarrow (x-a)+(b-y)<(b-a)/2$ [1].
Now this is an identity:
$f(y)-f(x)=-[(f(x)-f(a))+(f(b)-f(y))] [2]$
Looking at the right member of [2] and applying MVT +  [1]:
$|[(f(x)-f(a))+(f(b)-f(y))]|<|(f(x)-f(a))|+|(f(b)-f(y))|<(x-a)+(b-y)<(b-a)/2$
But instead from the absurd hypothesis the left member of [2]:
$|f(y)-f(x)|>(b-a)/2$
Which is than a contradiction.
It is the same solution as MartinR, only with the argument presented in slightly a different way ...
