# Is $f:[0,1] \to \{0,1\}$ constant? [duplicate]

Let $$f:[0,1] \to \{0,1\}$$ be continuous, where the spaces have the usual topology inherited by $$\Bbb R$$. Must $$f$$ be constant? I think it should because $$[0,1]$$ is connected and it can't be divided into two open disjoint sets, which should be the preimages of $$0$$ and $$1,$$ but I'd like to know if that is correct or not.

• Your argument is correct. – Clement Yung Jan 7 at 3:53
• How can a function be constant when the range contains more than one value? How can it be continuous when the domain is compact and the range is discrete? – WindSoul Jan 7 at 4:20
• I think you need to mention that $\{0\}$ and $\{1\}$ are open since you're using it. – pigeon Jan 7 at 4:27

Yep, your argument is sound. To put it more succinctly: the set $$[0,1]$$ is connected, its image under $$f$$ must be nonempty and connected, and the only connected nonempty subsets of $$\{0,1\}$$ are singletons. So the image of $$f$$ is a singleton, ie $$f$$ is a constant map.