If $f(y)−f(x) \le (y−x)^2$ for all $x,y$, then $f$ is a constant function. Suppose that $f(y)-f(x) \leq (y-x)^2 $ for all $x\in \mathbb{R}$ and $y\in \mathbb{R}$. Then how can i show $f$ is a constant function. 
I encountered this problem reading Calculus book written by Michael Spivak. He said that this would imply that
$|f(y)-f(x)| \leq (y-x)^2$
and I could derive this exchanging y and x. And his final hint was Divide the interval from $x$ to $y$ into $n$ equal pieces.
 A: Let $a, b\in \Bbb R$.
Pick $n\in \Bbb N$ and for $0\le i\le n$, let $x_i=a+i\frac{b-a}n$ (so $x_0=a$, $x_n=b$). Then
$$\begin{align} f(b)-f(a)&=f(x_n)-f(x_{n-1})+f(x_{n-1})-f(x_{n-2})+\cdots +f(x_1)-f(x_0)\\
&\le (x_n-x_{n-1})^2+(x_{n-1}-x_{n-2})^2+\cdot +(x_1-x_0)^2\\
&=n\cdot\frac{(b-a)^2}{n^2}\\&=\frac
{(b-a)^2}{n}.\end{align}$$
As $n$ was arbitrary, conclude that $f(b)\le f(a)$. By symmetry, also $f(a)\le f(b)$.
A: Let $x \neq y$ and w.l.o.g $x<y$ and $n \in \Bbb{N}$
Then take the partition $P$ of $[x,y]$  such that $P=\{x+\frac{k(y-x)}{n}: k=0,1,2,...,n\}$
Then $$|f(x)-f(y)| \leq \sum_{k=0}^{n-1} |f(x+\frac{(k+1)(y-x)}{n})-f(x+\frac{k(y-x)}{n})|$$ $$ \leq \frac{(y-x)^2}{n}$$
from hypothesis. Can you continue from here?
A: Instead of dealing with sums: this approach seems to me a bit more elegant.  We claim: If $f(y)-f(x)\leq c\cdot(y-x)^2$ for a non-negative constant $c$, the already $f(y)-f(x)\leq \frac12c\cdot(y-x)^2$.
Prove similar as above:
$$\begin{align}
f(y)-f(x)&=f(y)-f\bigl(\frac12(x+y)\bigr)+f\bigl(\frac12(x+y)\bigr)-f(x)\\
&\leq c\cdot  \left(y-\frac12(x+y)\right)^2+c\cdot \left(\frac12(x+y)-x\right)^2\\
&=c\cdot \left(\frac12(y-x)\right)^2+c\cdot \left(\frac12(x-y)\right)^2\\
&=\frac12 c\cdot(y-x)^2.
\end{align}
$$
A: From the given,
$$\lim_{y\to x}\left|\frac{f(y)-f(x)}{y-x}\right|\le \lim_{y\to x}|y-x|=0$$ and the derivative is everywhere zero. 
