$f(\mathbb{R})$ continuous iff $m(k)=\lbrace x\in \mathbb{R} \mid f(x)k \rbrace$ are open

continuitygeneral-topologyproof-writingsolution-verification

Let $f: \mathbb{R} \rightarrow \mathbb{R}$ a continuous function if and only if $m(k)=\lbrace x\in \mathbb{R} \mid f(x)<k\rbrace$ and $M(k)=\lbrace x \in \mathbb{R} \mid f(x)>k \rbrace$ are both open.

Attempt

Suppose that $f: \mathbb{R} \rightarrow \mathbb{R}$ a continuous function and $k\in \mathbb{R}$ consider $\alpha \in m(k)$, then $f(\alpha)<k$.We shall prove that exists $V_{\delta}(\alpha)\subset m(k)$

Since $f$ is continuous function $\forall \varepsilon>0$ $\exists \delta>0$ such that $|x-\alpha|<\delta$ then $|f(x)-f(\alpha)|< \varepsilon$ .

Let $\varepsilon=k-f(\alpha)>0$.Then $\exists \delta>0$ such that $|x-\alpha|<\delta$ implies
$$|f(x)-f(\alpha)|<k-f(\alpha) $$
$$-k+f(\alpha)<f(x)-f(\alpha)<k-f(\alpha) $$
$$-k+2f(\alpha)<f(x)<k$$
this is $V_{\delta}(\alpha) \subset m(k)$ As desired.
Now consider $\alpha\in M(k)$.Then $f(\alpha)>k$.
Since $f$ is continuous function $\forall \varepsilon>0$ $\exists \delta>0$ such that $|x-\alpha|<\delta$ then $|f(x)-f(\alpha)|< \varepsilon$
now
let $\varepsilon=f(\alpha)-k>0$ and notice that
$$|f(x)-f(\alpha)|<f(\alpha)-k $$
$$k<f(x)<2f(\alpha)-k $$
Hence $V_{\delta} \subset M(k)$
Therfore $m(k),M(k)$ are both open sets in $\mathbb{R}$

Conversely Suppose that $m(k),M(k)$ are both open we should prove that $f:\mathbb{R} \rightarrow \mathbb{R}$ is a continuous function.

if $f$ is not a continuous function then exists an open set $U=(a,b):a<b\subset \mathbb{R}$ such that
$f^{-1}(U)$ is not open in $\mathbb{R}$.
Since $f^{-1}(U)=\lbrace x\in \mathbb{R} \mid f(x)\in U \rbrace $ that is
$f^{-1}(U)=\lbrace x\in \mathbb{R} \mid a<f(x)<b \rbrace$

Notice the fact that
$a<b$ then $f^{-1}(U)=\lbrace x\in \mathbb{R} \mid a<f(x)<b \rbrace$
then since $m(K),M(k)$ are both open for any $k\in \mathbb{R}$, set $k=a$ and $M(k)$
then $f^{-1}(U)=M(k)\cup m(k)$ wich is open.Contradiction.
Then $f$ is a continuous function.
is my proof right?

Best Answer

Your proof is correct (with one inattentiveness in line -2: $f^{-1}(U) = M(a) \cap m(b)$). For a shorter proof see William Elliot's anwer.

It sticks out that in the first part you work with the $\varepsilon$-$\delta$-definition of continuity, whereas in the second part you use a theorem about continuity: A function $f$ is not continuous if for some open interval $U$ the set $f^{-1}(U)$ is not open. I conclude that you know that a function $f$ is continuous if and only if preimages of open sets are open, the latter being equivalent to "preimages of open intervals are open". The final equivalence is due the facts that each open subset of $\mathbb R$ is the union of open intervals and that $f^{-1}(\bigcup_\alpha M_\alpha) = \bigcup_\alpha f^{-1}(M_\alpha)$.

Using this characterization, you can shorten your proof.

We have $m(k) = f^{-1}((-\infty,k))$ and $M(k) = f^{-1}((k,\infty))$.

  1. Let $f$ be continuos. Since $(-\infty,k), (k,\infty)$ are open, also $m(k)$ and $M(k)$ are open for all $k$.

  2. Let $m(k)$ and $M(k)$ be open for all $k$. Since $(a,b) = (a,\infty) \cap (-\infty,b)$, we get $f^{-1}((a,b)) = m(a) \cap M(b)$ which is open. Thus $f$ is continuous.

Note that if all $m(k)$ are open, then $f$ is called upper semi-continuous and if all $M(k)$ are open, then $f$ is called lower semi-continuous.

Related Question