Supremum Infimum argument: what did I do wrong? 
Suppose $f:[a,b]\to\mathbb R$ be a function such that $|f(x)-f(y)|<\epsilon_0$ for all $x,y\in[a,b]$. Then $M-m\le\epsilon_0$, where $M=\sup\{f(x):x\in[a,b]\}$ and $m=\inf\{f(x):x\in[a,b]\}$.

I went this way: suppose $M-m>\epsilon_0$, hence $M>\epsilon_0+m$, hence there is an $x\in[a,b]$ such that$$M>f(x)>\epsilon_0+m,\tag1$$and similarly $M-\epsilon_0>m$ implies$$M-\epsilon_0>f(y)>m.\tag2$$Subtracting $(1)$ from $(2)$ says $-\epsilon_0>f(y)-f(x)>-\epsilon_0$, which is absurd. 
But on a second thought, I realized that my argument says that $M-m>\varepsilon$ is false for any $\varepsilon>0$, not just for $\epsilon_0$, implying $M-m=0$. What did I do wrong?
 A: Your mistake is thinking you can just subtract inequalities. You can't do that. For example, 
$$1>0$$
is true, and $$2>0$$ is also true, but subtracting these two inequalities, I get $$-1>0$$ which is not true.

The problem with subtracting inequalities is that when you subtract equations, you actually multiply one of them by $(-1)$ and then add them. With inequalities, you cannot do that because multiplication by a negative number reverses the inequality.

For an actual proof, a sketch of it would be this:


*

*Find some $x$ for which $f(x)$ is "near" $M$

*Find some $y$ for which $f(y)$ is "near" $m$

*Use the fact that $|f(x)-f(y)|<\epsilon_0$ and the fact that $$|f(x)-f(y)| = |f(x)-M+M-f(y)+m-m|\leq |f(x)-M| + |f(y)-m| + |M-m|$$ to reach a conclusion.


Naturally, the "near" in this sketch must, in the final proof, be a more rigorous statement. Good luck!
A: Last step is wrong. $a\leq b\leq c$ and $a'\leq b'\leq c'$ do not imply $a-a'\leq b-b'\leq c-c'$.
A: You may also proceed as follows:


*

*Note that $|x|$ is continuous.

*Choose sequences $(x_n), (y_n)$ with $\lim_{n \to \infty} f(x_n) = M$ and $\lim_{n \to \infty} f(y_n) = m$.


It follows:
$$|f(x_n) - f(y_n)| \stackrel{n \to \infty}{\longrightarrow} M-m$$
Now, as $|f(x_n) - f(y_n)| < \epsilon_0 \Rightarrow M-m \leq \epsilon_0$.
