TITLE: f is a continuous function from (X,$\tau$) to {0,1} with discrete topology, if f non constant then (X,$\tau$) disconnected
QUESTION [5 upvotes]: Let $f$ be a continuous function such that $f : (X,\tau) \rightarrow (\{0,1\},\tau_1\}$. Where $(X,\tau)$ is a generic topological space and $\tau_1$ is the discrete topology. I want to prove that if f is non-constant then $(X,\tau)$ is disconnected. 
I started by describing $(\{0,1\},\tau_1\}$. This topological space is compact, totally disconnected and Hausdorff. However,from here I do not know how to continue. Any tips?

REPLY [3 votes]: Hints:

An image of a connected set via continuous mapping is connected.
A nonempty subset of a discrete space is connected if and only if it is a singleton (i.e. contains exactly one point).