Proving oscillation of function on subset of domain Let $ \emptyset\ne A\subset \mathbb{R}^n$ and let $f:A\to \mathbb{R}$ be a bounded function. There is the following definition:
For every non-empty subset $B$ of $A$, the oscillation of $f$ on $B$ is the number osc$(f)_B:=\sup(f)_B - \inf(f)_B$.
I want to prove that osc$(f)=\sup\{|(f(x))-(f(y))|:x,y \in B\}.$
I'm not quite sure how to go about a proof, but here's my attempt.
$\sup_B(f)-\inf_B(f)=\sup_B(f)+\sup_B(-f)=\sup\{f(x):x\in B\}+\sup\{-f(y):y\in B\}$
$=\sup\{f(x)+(-f(y)):x,y\in B\}$
$=\sup\{|f(x)-f(y)|:x,y\in B\}$ (the absolute value can be applied, since $\sup_B(f)\ge \inf_B(f)$).
Do you think this is correct / rigorous enough?
 A: The proof looks ok to me, except for the very last motivation "the absolute value can be applied since...". Note that in general
$$
\sup_{x,y}g(x,y)\ne\sup_{x,y}|g(x,y)|
$$
even if the LHS is positive. For example, for $-2\le g(x,y)\le 1$, the LHS is $1$, but the RHS is $|-2|=2$. 
Here we get equality because of the sign symmetry of the expression
$$
\sup_{x,y}(f(x)-f(y))=\sup_{x,y}(f(y)-f(x))=\sup_{x,y}(-(f(x)-f(y))),
$$
so we can finish the proof as
$$
...=\sup_{x,y}(f(x)-f(y))=\max\sup_{x,y}(\pm(f(x)-f(y)))=\sup_{x,y}\max(\pm(f(x)-f(y)))=\sup_{x,y}|f(x)-f(y)|.
$$
A: According to "sequence", I give a restatement of his result, and then give a proof. Please check if my proof is right.
Lemma: 
Let $f\colon X\to\mathbb{R}$ and $A\subset X$ with $A\neq \emptyset.$ If $f$ is bounded on $A,$ then
\begin{gather*}
 \sup\{f(x)\mid x\in A\}-\inf\{f(x)\mid x\in A\}=\sup\{\left|f(x)-f(y)\right| \mid x,y\in A\}.
\end{gather*}
Proof:
    Let $x\in A$ and $y\in A.$ Since $f$ is bounded on $A,$  we have $f(x)\leq \sup\{f(t)\mid t\in A\}$ and $f(y)\geq \inf\{f(t)\mid t\in A\}.$ Thus $-f(y)\leq -\inf\{f(t)\mid t\in A\}.$ It follows that $f(x)-f(y)\leq \sup\{f(t)\mid t\in A\}-\inf\{f(t)\mid t\in A\}.$ Similarly  (or just by swapping $x$ and $y$), we also have $f(y)-f(x)\leq \sup\{f(t)\mid t\in A\}-\inf\{f(t)\mid t\in A\}.$ Hence $|f(x)-f(y)|\leq \sup\{f(t)\mid t\in A\}-\inf\{f(t)\mid 
t\in A\}.$ So we deduce that $\sup\{|f(x)-f(y)|\mid x,y\in A\}\leq \sup\{f(t)\mid t\in A\}-\inf\{f(t)\mid t\in A\}.$ Conversely, 
for each $u$ and $v$ in $A,$ we have $f(u)=f(u)-f(v)+f(v)\leq |f(u)-f(v)|+f(v)\leq \sup\{|f(x)-f(y)|\mid x,y\in A\}+f(v).$ Because 
$u$ is arbitrary, we have $\sup\{f(u)\mid u\in A\}\leq \sup\{\left|f(x)-f(y)\right|\mid x,y\in A\}+f(v),$ which implies that 
$f(v)\geq \sup\{f(u)\mid u\in A\}-\sup\{|f(x)-f(y)|\mid x,y\in A\}$ and so $\inf\{f(v)\mid v\in A\}\geq \sup\{f(u)\mid u\in A\}-\sup\{|f(x)-f(y)|\mid x,y\in A\}.$ By rearrangement, we have $\sup\{f(u)\mid u\in A\}-\inf\{f(v)\mid v\in A\}\leq \sup\{|f(x)-f(y)|\mid x,y\in A\}.$ Therefore w have shown that $\sup\{f(u)\mid u\in A\}-\inf\{f(v)\mid v\in A\}= \sup\{|f(x)-f(y)|\mid x,y\in A\}.$
