# If $\sup f(S) = f(\sup S)$ and $\inf f(S) = f(\inf S)$, $f$ is continous

Suppose $f: \mathbb{R} \to \mathbb{R}$ is a function. Suppose for any subset $S \subset \mathbb{R}$, $$\sup f(S) = f(\sup S)$$ and $$\inf f(S) = f(\inf S)$$
Prove that $f$ is continous.

Attempt:

We show $f$ is continuous at $x_0$
Take some open subset $S_1$ such that $\sup S_1 = x_0$ i.e. $S_1 := (a,x_0)$ for some $a \in \mathbb{R}$ with $a< x_0$. Then, $$f(x_0) = \sup_{s \in S_1} f(s).$$ So, by definition of $\sup$ there exists $s_1 \in S_1$ so that $f(x_0) - \epsilon < f(s_1)$. Note that every point $s_1 < s < x_0$ must lie in this range as well, since we can take open subsets $S' \subset S'' \subset S_1$ with $\sup S' = s_1$ and $\sup S'' = s$, so $$f(s_1) = \sup f(S') \leq f(s) = \sup f(S'') \leq f(x_0).$$ Let $d(x_0,s_1) = \delta_1$. Repeat the same process for $\inf S_2 = x_0$, $S_2 = (x_0,b)$ to obtain $f(s_2) < f(x_0)+\epsilon$, and call $\delta_2 = d(x_0,s_2)$. Then taking $\min\{\delta_1,\delta_2\}$ yields that $f$ is continuous at $x_0$.

Any issues with this? Any slicker ways to prove this? I believe on slick way is just to use the definition of the oscillation of $f$ at $x_0$ which seems to make things quite simple.

• I really don't understand your proof. What if you start with $S_1=\{ x_0\}$? What is $S_2$?? – Etienne Sep 25 '15 at 17:40
• It might be better and easier to explicitly define $S_1$ – user223391 Sep 25 '15 at 17:42
• @avid19 Edited accordingly – Anthony Peter Sep 25 '15 at 17:43
• I still do not understand your proof... – Etienne Sep 25 '15 at 17:49
• @Etienne $f(x_0 = \sup S_1) = \sup f(S_1)$. By definition of sup, we can find an element in $s_1$ such that $f(x_0) - \epsilon < f(s_1)$. Moreover, given anything between $s_1$ and $x_0$, say $s_1 < s < x_0$ for some $s \in S_1$, then $f(s_1) \leq f(s) \leq f(x_0)$ so in particular, $f(s)$ is in the lower half $\epsilon$ neighborhood of $f(x_0)$. Repeat for the upper half neighborhood. – Anthony Peter Sep 25 '15 at 17:52

First, observe that the assumption implies that $f$ is nondecreasing. Indeed, if you take $x,y$ with $x\leq y$ and $S:=\{ x,y\}$, then $f(x)=f(\inf S)=\inf f(S)=\inf\,\{ f(x),f(y)\}$, which means that $f(x)\leq f(y)$.
Now, fix $x_0\in\mathbb R$. Since $f$ is nondecreasing, it has a left-hand limit and a right-hand limit at $x_0$, and moreover $$\lim_{x\to x_0^-} f(x)=\sup\,\{ f(x);\; x\in\, ]-\infty,x_0[\}\quad{\rm and}\quad \lim_{x\to x_0^+}=\inf\,\{ f(x);\; x\in\,]x_0,+\infty[\}\, .$$ By assumption, the sup above is equal to $f(\sup\, ]-\infty,x_0[)=f(x_0)$, and likewise the inf is equal to $f(x_0)$. So the left-hand and right-hand limits of $f$ at $x_0$ are both equal to $f(x_0)$, i.e. $f$ is continuous at $x_0$.
• yes this is what I meant in regards to the "oscillation" proof in essence... Though I still don't understand the issue with the proof I've written.. The statement about $s$ in my proof is just saying that $f$ is non-decreasing – Anthony Peter Sep 25 '15 at 17:58