MathOverflow is a question and answer site for professional mathematicians. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Possible Duplicate:
Function with range equal to whole reals on every open set

I was told that it is possible to define a function $f:\mathbb R\to \mathbb R$ such that it takes every value on every interval. I have not been able to come up with such a function. Could someone show me one?

share|cite|improve this question

marked as duplicate by Willie Wong, Ryan Budney, Mark Sapir, François G. Dorais Nov 5 '10 at 19:42

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

This is an exact duplicate. See here – Willie Wong Nov 5 '10 at 19:04
I didn't see this comment before posting the answer below... – Sándor Kovács Nov 5 '10 at 19:29
Perhaps post your answer there (and remove the one from here) to keep things in one place? – j.c. Nov 5 '10 at 19:35
...and I hadn't known about Conway's base 13 function. – Sándor Kovács Nov 5 '10 at 19:35
@jc: that's a possibility, although this formulation of the question seems a little better for me. – Sándor Kovács Nov 5 '10 at 19:37

This happens to be one of my favorite examples... :)

I know two solutions. They are both "algebraic" which seems appropriate for me being an algebraic geometer. I believe there should be a solution using classical analysis tools such as ${\rm lim}\ {\rm sup}$ and things like that, but that is not my territory. (However, I would be interested in seeing such a solution).

Anyway, here are my solutions. The first one is somewhat "high tech" but the second one only uses elementary notions.

1) Consider the group $(\mathbb R, +)$ and its (normal) subgroup $(\mathbb Q, +)$. Let $g:\mathbb R\to \mathbb R/\mathbb Q$ be the natural map to the quotient. Observe that $\mathbb R/\mathbb Q$ has the same cardinality as $\mathbb R$ and let $h:\mathbb R/\mathbb Q\to \mathbb R$ a bijective function. (Obviously this is not a group homomorphism, I only needed that to define $\mathbb R/\mathbb Q$ easily). Now, $f=h\circ g$ has the property you are looking for: For an arbitrary $\alpha\in\mathbb R$ let $\beta\in g^{-1}(\alpha)$ be a real number representing the coset $g^{-1}(\alpha)$, i.e., $\beta+\mathbb Q=g^{-1}(\alpha)$. Since $\beta+\mathbb Q$ is everywhere dense, every interval will contain an element (in fact infinitely many) of it, so $\alpha$ is taken as a value of $f$.

2) Using a bijective function between $\mathbb R$ and the interval $(0,1)$ that takes intervals to intervals shows that it is enough to construct a function $f:(0,1)\to (0,1)$ with the required property. Let $x\in(0,1)$ and write it in base $3$, that is $x$ will be expressed as a number between $0$ and $1$ with only $0,1,2$ appearing in it, something like $0.0101212222001222....$. Now, here is the rule to define the function:

a) If $x$ contains infinitely many $2$'s, then let $f(x)=1/2$ (or any number you want between $0$ and $1$).

b) If $x$ contains finitely many $2$'s, then remove all the digits of $x$ between the decimal point and the last $2$ (including that last $2$) and let $f(x)$ be the number defined by the remaining digits considered as a number written in base $2$.

The reason this function works is because on any interval one may find a number whose base $3$ expression is finite, ends in a $2$ and appending any variation of digits to this number is still in the interval.

share|cite|improve this answer

There is also the Conway base 13 function, which is similar to Sandor's second example

share|cite|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.