If $f$ satisfies $|f(x_1)-f(x_2)|\leqslant(x_1-x_2)^2$ on an interval, then it is constant 
Prove that if $f$ is a function on an interval $[a,b]$ satisfying $$|f(x_1)-f(x_2)|\leqslant(x_1-x_2)^2 \ \text{ for all } \ x_1,x_2\in[a,b],$$ then $f$ is constant on $[a,b]$.

For any $x\in(a,b)$, we have $|f(x+h)-f(x)|/|h|\leqslant h^2/|h|=|h|$. So, from the Sandwich Theorem, we get $f^\prime(x)=0$. Similarly, the given condition implies that $f$ is right continuous at $a$ and left continuous at $b$, so by Theorem 2.5, $f$ is constant on $[a,b]$.
Doesn't this question need the condition that $f$ is differentiable on $(a,b)$?

I know an elementary answer which does not derivatives anywhere.
Taking $x_1=a$, $x_2=b$ then $|f(a)-f(b)|\leq |b-a|^2$.
If $x_1=a$, $x_2=(a+b)/2$ then $|f(a)-f((a+b)/2)|\leq |b-a|^2/4$. 
If $x_1=(a+b)/2$, $x_2=b$ then $|f(b)-f((a+b/2))|\leq |b-a|^2/4$. 
Therefore $|f(a)-f(b)|\leq |f(a)-f((a+b/2))|+|f(b)-f((a+b/2))|=|b-a|^2/2$.
In a similar way you can take $x_1=a$, $x_2=a+(b-a)/2^n\ldots..$ and get $$|f(a)-f(b)|\leq |b-a|^2/2^n$$ for any $n\in\mathbb{N}$. So $f(a)=f(b)$.
If $c\in[a,b]$ you can repeat the same argument replacing $b=c$ then $f(a)=f(c)$ so $f$ is constant in $[a,b]$
