f is a continuous function from (X,$\tau$) to {0,1} with discrete topology, if f non constant then (X,$\tau$) disconnected 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?

If $X$ is connected and $f:X\to Y$ is continuous then $f(X)$ is connected. 
So if moreover $f$ is surjective then $Y=f(X)$ is connected. 
In your case non-constant comes to the same as surjective.
Draw conclusions.
