# Show a function is continuous if and only if it is both upper and lower semi-continuous

Let $f$ be a real-valued function on $\mathbb{R}$. Show $f$ is continuous if and only if $f$ is both upper and lower semi-continuous, using the definition of continuity and semi-continuity based on open set.

It's difficult for me to be rigourous here. For example for necessity. Let $O=\{f(x) : f(x) > a, x \in \mathbb{R}\}$ with $a$ real. By continuity, if $O$ is open then the pre-image of $O$ is open whence $f$ is lower semi-continuous. Is $O$ open? If so why? This point blocks me.

I think I can do sufficiency correctly though. Suppose $f$ is both upper and lower semi-continuous. Let $O$ be an open set.  Since any open set in $\mathbb{R}$ can be expressed as a union of open sets of the form $(a,b)$, then $O=\cup (a_n,b_n)$ for some open sets $(a_n,b_n)$. Since each $(a_n,b_n)$ can be written has $(a_n,\infty) \cap (-\infty,b_n)$, by semi-continuity, the pre-image of each $(a_n,b_n)$ is open. Since $f^{-1}(O)=f^{-1}(\cup(a_n,b_n))=\cup f^{-1}(a_n,b_n)$, then the pre-image of $O$ is open anf $f$ is continuous.

Definition: A function is continuous if and only if the pre-image of any open set is open. A function is lower semi-continuous if and only if the set $\{x \in \mathbb{R} : f(x) > a\}$ is open for any $a$ real. A function is upper semi-continuous if and only if the set $\{x \in \mathbb{R} : f(x) < a\}$ is open for any $a$ real.

-
Using the open set definition is possible, but is useless pain. See my answer. If you absolutely wanted to use the open set definition, I must say I've never seen a semi-continuity definition based on open sets ; please put yours here. – Patrick Da Silva Feb 17 '12 at 22:39
To summarize Patrick's answer: your proof of sufficiency is essentially correct (although it seems you're mixing up "image" and "preimage" at one point). For necessity, your definition of $O$ is wrong, and it seems to be the main problem. Look up Patrick's solution if you want to know what went wrong. – M Turgeon Feb 17 '12 at 23:17
@MTurgeon Thanks for pointing the error in my sufficiency proof. I corrected it. – Nicolas Essis-Breton Feb 18 '12 at 23:13

What you want is use the $\varepsilon$-$\delta$ definition of continuity/semi-continuity

$$\forall \varepsilon > 0, \quad \exists \delta > 0 \quad \text{s.t.} \quad |x-x_0| < \delta \quad \Longleftrightarrow \quad |f(x) - f(x_0)| < \varepsilon.$$ Since $|f(x) - f(x_0)| < \varepsilon$ is equivalent to $f(x_0) - \varepsilon < f(x) < f(x_0) + \varepsilon$, this statement is equivalent to $$\forall \varepsilon > 0, \quad \exists \delta > 0 \quad \text{s.t.} \quad |x-x_0| < \delta \quad \Longleftrightarrow \quad f(x_0) - \varepsilon < f(x) < f(x_0) + \varepsilon$$ which means continuity is equivalent to upper and lower semi-continuity.

ADDED : I'll assume the definition of semi-continuity is the following, i.e. that the preimage of an open set of the form $\{ y \, | \, y > a \}$ is open for any upper semi-continuous function, and that the preimage of an open set of the form $\{ y \, | \, y < a \}$ is open for any lower semi-continuous function. If this is not the definition you have, let me know. I'm just guessing those definitions from the $\varepsilon$-$\delta$ definitions of continuity.

We show that continuity $\Longleftrightarrow$ upper and lower semi-continuity.

$(\Longrightarrow)$ This one is clear, since if the pre-image of any open set is open, then in particular are the pre-images of those of the form $(a, \infty)$ and $(-\infty,a)$.

$(\Longleftarrow)$ If $f^{-1}((a,\infty))$ and $f^{-1}((-\infty,b))$ are open sets, then since $f^{-1}((a,b)) = f^{-1}((a,\infty)) \cap f^{-1}((-\infty,b))$ and that the intersection of two open sets is open, then $f^{-1}((a,b))$ is open. Now any open set $\mathcal O$ in $\mathbb R$ is of the form $$\bigcup_{n=0}^{\infty} (a_n, b_n)$$ where all the intervals $(a_n,b_n)$ are pairwise disjoint and $a_n \in \mathbb R \cup \{-\infty\}$, $b_n \in \mathbb R \cup \{\infty\}$. But $$f^{-1} \left( \bigcup_{i \in I} \mathcal O_i\right) = \bigcup_{i \in I} f^{-1} (\mathcal O_i)$$ for any collection of sets indexed by any set $I$ (prove this trivially by the definition of pre-images and show $\subseteq$/$\supseteq$), thus, $$f^{-1}(\mathcal O) = \bigcup_{n=0}^{\infty} f^{-1}((a_n,b_n))$$ which is an open set.

Hope that helps,

-
Like I always say : downvoters, your downvotes are pointless if you don't justify yourself. Do it here please. – Patrick Da Silva Feb 17 '12 at 22:59
That's why I think votes shouldn't be anonymous. – Pedro Tamaroff Feb 17 '12 at 23:06
@Peter : Exactly, I agree. This way downvoters would feel the need to explain themselves, otherwise they would only attract hate towards them by downvoting. – Patrick Da Silva Feb 17 '12 at 23:16
Your definition is not different. $\{ x \in \mathbb R \, | \, f(x) > a \} = \{ x \in \mathbb R \, | \, f(x) \in (a, \infty) \} = f^{-1} ((a,\infty))$. Is that okay? (The same goes for lower semi-continuity.) – Patrick Da Silva Feb 17 '12 at 23:45
Thank you Patrick, all the concepts are link in my head now. It's great. – Nicolas Essis-Breton Feb 17 '12 at 23:49