# $f:\mathbb{R}\rightarrow \mathbb{R}$ continuous and $f(\mathbb{R}$) is countable, then $f$ is constant. [duplicate]

Let $f:\mathbb{R}\rightarrow \mathbb{R}$ be a continuous function such that $f(\mathbb{R}$) is countable. Show that $f$ is constant.

Some ideas: proving the contrapositive. To suppose that $f$ is not constant and to use the intermediate value theorem to prove that $f(\mathbb{R})$ is not countable.

Any help?

## marked as duplicate by Clement C., user296602, carmichael561, Xander Henderson, JonMark PerrySep 12 '17 at 4:58

The image of a connected space under a continuous map is connected. The only connected subsets of $\mathbb{R}$ are one-point sets and intervals, but intervals are uncountable. QED.
If $f$ is continuous on $\mathbb{R}$, then it satisfies the intermediate value property on $\mathbb{R}$. That is, if $a < b$ and $y$ is between $f(a)$ and $f(b)$, then there exists some $c \in (a,b)$ such that $f(c)$ is between $f(a)$ and $f(b)$.
If $f$ takes more than one value, say $f(a) \ne f(b)$ (in fact, assume without loss of generality that $f(a) < f(b)$), then for any value $y\in (f(a),f(b))$, there must be some $c\in (a,b)$ such that $f(c) = y$. But the interval $(f(a),f(b))$ is uncountable, thus if a continuous function takes more than one value, then it's range must be uncountable.
If $x,y\in f(\Bbb R)$ and $x<y$, then $[x,y]\subset f(\Bbb R)$.