Prove that every function that verifies $|f(x)-f(y)|\leq(x-y)^2$ for all $x,y$ is constant.
Solution 1:
You don't know that $f$ is differentiable, a priori, so that's not quite correct. What you can say, however, is that
$$0 \le \left|\frac{f(x) - f(y)}{x - y}\right| \le |x - y|$$
Now let $y \to x$; by the squeeze theorem, we must have that
$$\lim_{y \to x} \frac{f(x) - f(y)}{x - y} = 0$$
So we can now conclude that $f$ actually is differentiable, and the derivative is identically $0$.
Solution 2:
We have $$\frac{|f(x)-f(y)|}{|x-y|}\leq |x-y|$$ so by passing to the limit $y\to x$ we find $|f'(x)|=0\quad\forall x$. Can you take it from here?
Solution 3:
There is a more elementary way to see this that uses no differentiability assumptions.
For any $\epsilon$ we can take a sequence of points $x_0 \leq x_1 \leq \dots \leq x_n$ such that $x = x_0$ and $y = x_n$ and $|x_i - x_{i+1}| < \epsilon \llless 1$. Moreover, we can take $n \leq |x-y|/\epsilon$.
We then have:
$$ |f(x) - f(y)| = |f(x_0) - f(x_n)| = |(f(x_0) - f(x_1)) - \dots - (f(x_{n-1} - f(x_n))|$$
We then get: $|f(x) - f(y)| \leq |x_0 - x_1|^2 + \dots |x_{n-1} + x_n|^2$ by applying the triangle inequality and the hypothesis. We then have $|f(x) - f(y)| \leq n \epsilon^2 \leq \epsilon |x-y|$ which goes to zero as $\epsilon \rightarrow 0$. Thus $f(x) = f(y)$.
Essentially, small things get smaller under squaring so you can make the different too small for the values to be distinct.