Prove that f is a constant function

Solution 1:

For any $x,y$, the difference quotient of $f$ obeys $$\bigg| \frac{f(x) - f(y)}{x-y} \bigg| \leq M|x-y|.$$ In particular $f$ is differentiable and its derivative is zero everywhere (both by the squeeze theorem).

Since the derivative is everywhere zero, what can you say about $f$?