# How to show that the following function is not continuous?

Let $f: \mathbb R \rightarrow \{a,b\}$ for some $a,b \in \mathbb R$ such that $a \neq b$. I claim that such a function is not continuous on $\mathbb R$ since there exists a point $c \in \mathbb R$ such that $$\lim_{x\to c^+} f \neq \lim_{x\to c^-} f$$ and thus $\lim_{x\to c} f$ does not exist. Informally, this would be the point or points where $f$ swiches from mapping to $a$ to mapping to $b$ or vice versa. To prove that $f$ is not continuous, should I proceed this way? If so, how to prove that such a point exists?

• To get this conclusion, I think more detail for the map is needed. For example, if $f:R\rightarrow \{a\}\in\{a,b\}$, that is $f$ is not a surjection, then $f$ is continuous everywhere because it is a constant function. – Lion May 19 '14 at 2:09
• This is true much more generally. That is if $f:C\rightarrow 2$ is a continuous function where $2=\{0,1\}$ with the discrete topology and $C$ is connected, then $f$ must be constant. – Robert Wolfe May 19 '14 at 3:09

I would choose a starting place in the domain. Perhaps $0$. Then WLOG $f(0) = a$. Consider the set $S = \{x | x > 0 \mbox{ and }f(x) = b \}$. If this set is non-empty, then it will have a finite infimum. This infimum is the point where you try to apply your reasoning and show the function is not continuous. Either left limit is not equal to the right limit or the limit is not equal to the function value.
If $S$ is empty, then consider $T = \{x | x < 0 \mbox{ and }f(x) = b \}$, and show it can't be empty and apply your reasoning.
There is a $c\in dom f$, such that the for all open balls $B_r(c)$, there are points $x\in B_r(c)$ with $f(x)=a$ or $f(x)=b$, if $f(c)=a$ then for a $\epsilon=\frac{\mid a-b\mid}{2}$ you always can, choice a $x\in(c-\delta,c+\delta)$ with $f(x)=b$ then $\mid f(x)-f(c)\mid>\epsilon$. Then $f$ is not confinuous in $c$.
Assuming that $f(\mathbb R)=\{a,b\}$ and that all sets involved have the usual topology, then if $f$ were continuous you would immediately obtain a disconnection of $\mathbb R$ as $f^{-1}(a)\cup f^{-1}(b)$, contrary to its connectedness.