# Is continuous function $f:X=A \cup B \rightarrow \{-1,1\}$ constant?

Let $A$ and $B$ be disjoint. Let $X$ be a topological space.

Is every continuous function $f:X=A \cup B \rightarrow \{-1,1\}$ constant?

-
What is the topology of $\{-1,1\}$? –  Neal Dec 14 '12 at 13:59
What is the topology of X? :) –  madprob Dec 14 '12 at 14:31

Claim: A topological space $\,X\,$ is connected iff there is not a continuous surjective function $\,f:X\to\{0,1\}\,$ , taking $\,\{0,1\}\,$ with the inherited euclidean (i.e. the usual one) topology on $\,\Bbb R\,$
Of course, we can always take $\,\{-1,1\}\,$ instead of $\,\{0,1\}\,$
Let $A=(-2,-1)$ and $B=(1,2)$. Then let $f(x)=\mbox{sign}(x)=x/|x|$. Then $f$ is continuous but not constant.