Dividing the interval into $\rm\,n\,$ equal pieces. [Spivak - Calculus, Exercise 20] I was doing exercise 20 of Spivak Calculus, it says

(a) Find a function $\rm\,f\,$, other than a constant function such that $$\rm\,|f(x)-f(y)|\le|y-x|\,$$
  (b) Suppose that $\rm\,f(y)-f(x)\le(y-x)^2\,$ for all $\rm\,x\,$ and $\rm\,y\,$. (Why does this imply that $\rm\,|f(y)-f(x)|\le(y-x)^2\,$?) Prove that $f$ is a constant function. Hint: Divide the interval from $\rm\,x\,$ to $\rm\,y\,$ into $\rm\,n\,$ equal pieces.

I could do (a) without much problem. But for (b) I couldn't do it after hours thinking. so i look up in the solution book

I can't understand how he goes to the green. (what's the intuition?) For the first inequality it's easy to see because $$\rm|\sum_i a_i|\le\sum_i|a_i|$$ but then how does he go to the orange part? And how he goes to the yellow part? (riemann sums aren't introduced in that part). Also how can he concludes that $\rm\,f\,$ must then be constant? Limits aren't covered in that part, so you can't let $\rm\,n\to\infty\,$ 
Is this just a bad exercise to put in that section because i would never come up with that solution?
thanks!
$$\bbox[8pt,border:3px white solid]{\color{black}{\large}}$$
 A: The first step is a "telescoping sum:"
$$x_n-x_0 = (x_1-x_0)+(x_2-x_1)+\cdots + (x_{n}-x_{n-1})$$
Notice how the terms cancel.
The orange line comes from $|f(X)-F(Y)|\leq (X-Y)^2$, with $X=x+\frac{k}{n}(x-y)$ and $Y=x+\frac{k-1}{n}(x-y)$, so $X-Y=\frac{1}{n}(x-y)$.
For the yellow line, if $C$ is constant then $\sum_{k=1}^n C =nC$. In this case, $C=\frac{(y-x)^2}{n^2}$, which does not depend on $k$.
Finally, you've shown that $|f(x)-f(y)|<\frac{(y-x)^2}{n}$ for all $n$. That means that $|f(x)-f(y)|$ is smaller than all positive numbers, hence must be zero.
A: Like the Riemann sum, he partitioned the interval $[x,y]$ using $x_0 = x, x_i = x+(y-x)\dfrac{i}{n}$, then he uses:
$f(y) = (f(y) - f(x_{n-1})) + (f(x_{n-1} - f(x_{n-2})) + \cdots (f(x_2) - f(x_1) + (f(x_1) - f(x_0)) + f(x)$, from this the green equation follows.
A: The intuition is that the sum is telescoping: Write out the first few terms:
$$f(x+[y-x]/n) - f(x) + f(x+2[y-x]/n) - f(x+[y-x]/n)+f(x+3[y-x]/n-f(x+2[y-x]/n)+\cdots +f(y)-f(x+(n-1)[y-x]),$$
and notice how all terms cancel except $f(x)$ and $f(y)$. 
Equivalently, if you divide the assumption to get: $|f(x)-f(y)| / |x-y| \leq |x-y|$, fix $y$ and take the limit $x\rightarrow y$, you'll conclude $f'(y)=0$ everywhere, a constant function.
