# Showing range is countable

Let $f: \mathbb{R} \to \mathbb{R}$. For every $x \in \mathbb{R}$, there exists $\delta$, for every $y \in N(x, \delta)$ ($N$ stands for neighborhood) $f(y) \geq f(x)$.

Show that the range of $f$ is countable.

-
Please do not give orders. I'm sure you will find people are more willing to help if you just ask! –  JavaMan Jun 13 '11 at 1:53
thank you for your better fashion! –  Leitingok Jun 13 '11 at 2:02
No problem. The grammar to your post is still not quite right. If there is anything you would like to change, please do so. –  JavaMan Jun 13 '11 at 2:08

Suppose $a$ is in the range of $f(x)$. Then if $x_0$ is any number such that $f(x_0) = a$, one can find an interval $[b,c]$ containing $x_0$ with $b$ and $c$ rational such that $f(x) \geq a$ on $[b,c]$. Thus $a \rightarrow (b,c)$ gives a mapping from the range of $f(x)$ to ${\mathbb Q} \times {\mathbb Q}$, and this mapping is clearly injective. Hence the range of $f$ is countable.

-
Simple and nice. –  leo Jun 13 '11 at 5:54
How come the mapping is injective? You said "clearly" but I am not quite convinced... though if I would the proof would be pretty! EDIT: duh... I worked it out. Though you could've added one more line... It is not that much obvious. –  Patrick Da Silva Jun 13 '11 at 6:40
@Patrick: It looks like it could be an assignment so maybe I shouldn't write too much. –  Zarrax Jun 13 '11 at 11:06
Okay, cool then. –  Patrick Da Silva Jun 13 '11 at 20:03

In other words, $f$ has a local minimum everywhere. More generally, the same result holds if $f$ has a local extremum everywhere; according to this (Problem 2010-4/B), the result can be found in several places in the literature (a proof is also provided). Interestingly, as a corollary in the case where $f$ is further continuous, we get an answer to this question (note my answer given there).

EDIT (elaborating on the second part): Suppose that $f:\mathbb{R} \to \mathbb{R}$ is continuous and has a local extremum everywhere. From the latter property, it follows that the range of $f$ is countable. Hence we conclude from the intermediate value theorem that $f$ must be constant (for otherwise the range would be uncountable, a contradiction).

-