TITLE: Showing that $\sup\{|f(x)-f(y)|, x,y\in X\}= \sup \ f - \inf \ f$
QUESTION [7 upvotes]: I need to show that, for $f:X\to \mathbb{R}$ bounded, we have:
$$\sup\{|f(x)-f(y)|, x,y\in X\}= \sup  f - \inf f$$
Well, I know that 
$$\sup\{|f(x)-f(y)|, x,y\in X\}\ge |f(x)-f(y)|$$ but in what this helps? I really have no idea in how to prove this one

REPLY [4 votes]: Fix any $x_0\in X$ and $y_0\in X$. Then, one has that $$f(x_0)-f(y_0)\leq|f(x_0)-f(y_0)|\leq\sup_{x,y\in X}\{|f(x)-f(y)|\},$$ since every real number is less than or equal to its absolute value. Rearranging yields: $$f(x_0)\leq\sup_{x,y\in X}\{|f(x)-f(y)|\}+f(y_0).$$ This is true for any $x_0\in X$, so taking supremum on the left-hand side yields $$\sup_{x\in X}f(x)\leq\sup_{x,y\in X}\{|f(x)-f(y)|\}+f(y_0).$$ Another rearrangement yields: $$\sup_{x\in X}f(x)-\sup_{x,y\in X}\{|f(x)-f(y)|\}\leq f(y_0),$$ and taking infimum on the right-hand side results in $$\sup_{x\in X}f(x)-\sup_{x,y\in X}\{|f(x)-f(y)|\}\leq\inf_{x\in X} f(x),$$ or $$\sup_{x\in X}f(x)-\inf_{x\in X} f(x)\leq\sup_{x,y\in X}\{|f(x)-f(y)|\}.$$

As for the other direction, fix again arbitrary $x_0\in X$ and $y_0\in X$. If $f(x_0)\geq f(y_0)$, then $$|f(x_0)-f(y_0)|=f(x_0)-f(y_0)\leq \sup_{x\in X} f(x)-f(y_0)\leq\sup_{x\in X}f(x)-\inf_{x\in X}f(x).$$ If, on the other hand, $f(x_0)<f(y_0)$, then $$|f(x_0)-f(y_0)|=f(y_0)-f(x_0)\leq \sup_{x\in X} f(x)-f(x_0)\leq\sup_{x\in X}f(x)-\inf_{x\in X}f(x).$$ In either case, $$|f(x_0)-f(y_0)|\leq\sup_{x\in X}f(x)-\inf_{x\in X}f(x).$$ Now taking supremum on the left-hand side over $x_0,y_0\in X$, one has that $$\sup_{x,y\in X}\{|f(x)-f(y)|\}\leq\sup_{x\in X}f(x)-\inf_{x\in X}f(x),$$ completing the proof.