TITLE: Continuous iff Oscillation is zero
QUESTION [5 upvotes]: For  a bounded function $f:D\subset \Bbb R^n \rightarrow  \Bbb R$, $b$ in $\Bbb R^n$,   and a real number $\delta>0$. Define the following:
$M(f,b,\delta)$=sup{f(x)$: x$ in $D$ and $||x-b||<\delta$}
$m(f,b,\delta)$=inf{f(x)$: x$ in $D$ and $||x-b||<\delta$}
Define the oscillation of $f$ in $b$ as:
$o(f,b)= \lim\limits_{\delta \to 0} \ (M(f,b,\delta)-m(f,b,\delta))$
Prove that $f$ is continuous in $b$ if and only if $o(f,b,\delta)=0$
The first direction would be easier if we had a closed interval. As this one is closed, I haven't figured out how to prove the first implication. Also, what would you suggest for the second one?
For the converse, it it enough to say that if  $||x-b||< \hat{\delta}$ then $||f(x)-f(b)||\leq|| M(f,b,\hat{\delta})-m(f,b,\hat{\delta})||\leq \epsilon$ ?

REPLY [4 votes]: If $f$ is continuous at $b$, then for any $\epsilon > 0$ there exists $\hat{\delta}> 0 $, which may depend upon $b$, such that if $||x-b|| < \hat{\delta}$, then $||f(x) - f(b)|| < \epsilon/2$.
Suppose $x,y \in D \cap B(b;\hat{\delta}).$  Then
$$f(x) < f(b) + \epsilon/2 \\ \sup \{f(x):x \in D , ||x-b||< \hat{\delta}\} \leq f(b) + \epsilon/2$$
and
$$f(y) > f(b) - \epsilon/2 \\ \inf \{f(x):x \in D , ||x-b||< \hat{\delta}\} \geq f(b) - \epsilon/2.$$
Whence,
$$\sup \{f(x):x \in D , ||x-b||< \hat{\delta}\}-\inf \{f(x):x \in D , ||x-b||< \hat{\delta}\}  \\= M(f,b,\hat{\delta})-m(f,b,\hat{\delta})\leq \epsilon.$$
Furthermore, if $\delta \leq \hat{\delta},$ then
$$M(f,b,\delta)-m(f,b,\delta)\leq M(f,b,\hat{\delta})-m(f,b,\hat{\delta})\leq \epsilon,$$
and 
$$o(f,b)=\lim_{\delta \rightarrow 0}[M(f,b,\delta)-m(f,b,\delta)]=0.$$
Try to use a similar argument to prove the converse.