Monotone function $f(x)$ for which $|f(x)-f(y)| \leq |x-y|$. Let $f:[0,1]\to\mathbb R$ such that $|f(x)-f(y)|\leq |x-y|$ for any $x,y\in[0,1]$. Assume that for any $x\leq y$ in $[0,1]$ then $f(x)\leq f\left(\frac{x+y}2\right)\leq f(y)$ or $f(x)\ge f\left(\frac{x+y}2\right)\geq f(y)$. Then $f$ must be monotone. 
I have no idea to prove this, how to prove this?
 A: By $|f(x)-f(y)| \leq |x-y|$ we get that $f$ is continuous. (just take $\delta = \varepsilon)$.
Now, without loss of generality, assume that $f(0) \leq f(1)$.
Observe, for example that $\displaystyle f(0) \leq f\left( \frac 14\right) \leq f\left(\frac 12\right) \leq f\left( \frac 34\right) \leq f(1)$.
Applying these inequalities countably many times, gives that:
if $\displaystyle x=\frac{m_1}{2^{n_1}}$ and $\displaystyle y= \frac{m_2}{2^{n_2}}$ with $x \leq y$, then $f(x) \leq f(y)$.
Now, since $\displaystyle \left\{ \frac{m}{2^n} : m,n \in \Bbb Z \right\}$ is dense in $[0,1]$, and $f$ is monotone on this dense subset
then $f$ must be monotone on $[0,1]$.
A: The first condition simply states that $f$ is Lipschitz continuous. The second condition states that for any $x,y$, the value of $f(\tfrac{x+y}{2})$ is betweeen $f(x)$ and $f(y)$.
Now assume $f$ were not monotone. Then there exist $x<y<z$ such that $f(y)>f(x)>f(z)$ or $f(y)<f(x)<f(z)$. We will only consider the first case since the second is analogous.
The proof follows from constructing an increasing sequences $x_k \to y$ and a decreasing sequence $ z_k\to y$ with $f(x)\ge f(x_k), f(z_k)\ge f(z)$ for all $k$, contradicting the continuity assumption, since then $|f(y)-f(x_k)|\ge |f(y)-f(x)|>0$ is bounded below, while $|y-x_k|\to 0$. In fact this shows that assuming simple continuity is enough.
We let $(x_1,z_1)=(x,z)$. Given $x_k, z_k$ we construct the next members of the sequences as follows: Consider $c = \frac{x_k+z_k}{2}$. Then by the second assumption $f(x_k) \ge f(c) \ge f(z_k)$ and thus by induction $f(x)\ge f(c) \ge f(z)$. Now, if $c<y$ we set $(x_{k+1},z_{k+1}) = (c,z_k)$ and $(x_{k+1},z_{k+1}) = (x_k,c)$ else.
By construction, $y\in [x_k,z_k]$ for all $k$, but also $|x_k-z_k| \to 0$.
A: I have a hunch that the following approach should work, although I didn’t rigorously check the details. For $0\leq x\leq s\leq y\leq 1$ (with $x,s,y$ being fixed for the rest of the argument), try approximating $s$ by a sequence of the following form: $$s_m\equiv \frac{c_m}{2^m} x+\left(1-\frac{c_m}{2^m}\right)y,\quad\text{where }c_m\in\{0,1,\ldots,2^m\}\text{ and }m\in\mathbb N$$ in such a way that $s_m\to s$ as $m\to\infty$. Next, use induction on $m$ to show that, for each $m\in\mathbb N$, $$\text{either}\quad f(x)\leq f(s_m)\leq f(y)\quad\text{or}\quad f(x)\geq f(s_m)\geq f(y),$$ with the directions of the inequalities being the same for all $m\in\mathbb N$. Finally, it follows from the (Lipschitz) continuity of $f$ that either $f(x)\leq f(s)\leq f(y)$ or $f(x)\geq f(s)\geq f(y)$. This clearly implies monotonicity (right?).
