# Continuous function defined on (0,1) to {0,1}

I am trying to define a continuous function $$f:(0,1) \mapsto \{0,1\}$$. Intuitively, it seems that the possible continuous functions are the trivial functions of $$f(x) = 0$$ or $$f(x) =1$$.

Based on the definition of continuity (topology), I first set topologies on $$(0,1)$$ and $$\{0,1\}$$. Let $$(0,1)$$ be equipped the standard Euclidean metric space and $$\{0,1\}$$ be equipped with the discrete topology.

[Editted: [0.5,1) open -> closed]

Let define $$f_{0.5}(x) = 1_{x < 0.5}(x)$$. Then since $$f_{0.5}^{-1}(0) = [0.5,1)$$ is closed and $$f_{0.5}^{-1}(1) = (0,0.5)$$ is open, $$f_{0.5}(x)$$ is not continuous.

Can we prove that the only continuous function is a trivial one?

I am looking for some clear explanations or intuition behind this. Any comments/answers/suggestions will be very appreciated.

• Why do you think $[0.5, 1)$ is open? Commented Feb 6, 2019 at 5:28
• @RobertIsrael Oh you're right. [0.5,1) is closed as the complement (0,0.5) is open. Commented Feb 6, 2019 at 5:30
• Yes! Every continuous function $f$ from $(0,1)$ to $\{0,1\}$ is either $f \equiv0$ or $f\equiv1$, since $(0,1)$ is connected! Commented Feb 6, 2019 at 5:37

This follows from the connectedness of $$(0,1)$$. The sets $$f^{-1}(0)$$ and $$f^{-1}(1)$$ are open (by continuity) and clearly disjoint. If they were both non-empty, $$(0,1)=f^{-1}(0)\cup f^{-1}(1)$$ would be disconnected.
• Thanks for your answer. By the way, is the same true for any discrete set? That means, any continuous function $f:(0,1) \to A$ where $A$ is a set containing only a finite number of elements, then $f$ should be a constant. Commented Feb 6, 2019 at 15:22