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

continuitygeneral-topology

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.

Best Answer

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.