Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

While reading about cardinality, I've seen a few examples of bijections from the open unit interval $(0,1)$ to $\mathbb{R}$, one example being the function defined by $f(x)=\tan\pi(2x-1)/2$. Another geometric example is found by bending the unit interval into a semicircle with center $P$, and mapping a point to its projection from $P$ onto the real line.

My question is, is there a bijection between the open unit interval $(0,1)$ and $\mathbb{R}$ such that rationals are mapped to rationals and irrationals are mapped to irrationals?

I played around with mappings similar to $x\mapsto 1/x$, but found that this never really had the right range, and using google didn't yield any examples, at least none which I could find. Any examples would be most appreciated, thanks!

share|improve this question
For "explicit" examples mathoverflow.net/questions/48910/… is relevant –  Colin McQuillan Jan 15 '11 at 10:18
Just to make it clear: if you are asking for a bijection with no further properties (e.g. no continuity etc. conditions) then this is true simply for cardinality reasons: $\mathbb Q$ and $\mathbb Q\cap (0,1)$ are both countably infinite, and so we can find a bijection $\phi$ from the first to the second. Also $\mathbb R\setminus \mathbb Q$ and $(0,1) \setminus \mathbb Q$ both have the cardinality of the continuum, so we can find a bijection $\psi$ from the first to the second. Gluing $\phi$ and $\psi$ gives a bijection from $\mathbb R$ to $(0,1)$ that takes (ir)rationals to (ir)rationals. ... –  Matt E Jan 15 '11 at 21:42
... This is discussed more carefully in Asaf Karagila's answer, and the accompanying comments. –  Matt E Jan 15 '11 at 21:42
add comment

3 Answers 3

up vote 17 down vote accepted

$(1/x)-2$ on $(0,1/2]$ and $2-(1/(x-1/2))$ on $(1/2,1)$.

share|improve this answer
Modify this to $2-1/(1-x)$ on $({1\over2},1)$, and it is even continuous. –  Christian Blatter Jan 15 '11 at 12:55
@ Christian. You can find a $C^k$ function composing by a well chosen polynomial. But I don't know if it is possible to find a smooth function. –  Nabyl Bod Jan 15 '11 at 18:11
Thanks Nabyl Bod, this was nice and clear and easy for me to verify for myself. –  yunone Jan 15 '11 at 19:40
@Nabyl: Can could please tell me what kind of polynomial you think of? I can't figure it out. –  Hendrik Vogt Jan 16 '11 at 14:22
@Hendrik. I think of composing by a rational polynomial (taking non negative coefficients to make it one-to-one) with a degree greater than the constraints at point $1/2$ BUT this construction does not preserve irrationality. Thanks for your comment ;) But you can find a $C^1$ function: $1/(4x)-1/2$ on $(0,1/2)$ and $1/2-1/(4(1-x))$ on $[1/2,1)$ that answers the question. –  Nabyl Bod Jan 16 '11 at 16:50
show 1 more comment

With the axiom of choice we can find well orderings of $\mathbb{R}$ and of $(0,1)$ such that the first $\omega$ elements are all the rationals of the set, then we can define our map to go from one well ordering to another by preserving the index (that is $a_\alpha\mapsto b_\alpha$, for $\alpha<2^{\aleph_0}$)

As discussed in the comments below by Colin and Jason (and myself), one does not need the axiom of choice for that. Using the Cantor-Schroeder-Bernstein theorem one can have two bijections, one from $(0,1)\setminus\mathbb{Q}$ to $\mathbb{R}\setminus\mathbb{Q}$ and one from $(0,1)\cap\mathbb{Q}$ to $\mathbb{Q}$, and define a bijection as needed without the use of the axiom of choice.

share|improve this answer
One can use the en.wikipedia.org/wiki/… to avoid using the axiom of choice –  Colin McQuillan Jan 15 '11 at 10:21
Colin: How can you ensure that the map you have from CSB preserves rationals? –  Asaf Karagila Jan 15 '11 at 10:25
@Asaf: Apply CBS theorem to injections between $(0,1) \setminus \mathbb{Q}$ and $\mathbb{R} \setminus \mathbb{Q}$ to get a bijection between the two sets and then extend by the identity function. –  Jason Jan 15 '11 at 10:37
@Jason: The identity function is not a bijection from $(0,1)\cap\mathbb{Q}$ to $\mathbb{Q}$. However you can in fact well order the rationals without AC, and then you can create the bijection. –  Asaf Karagila Jan 15 '11 at 10:44
True, that was a lazy answer by me. –  Jason Jan 15 '11 at 10:50
show 2 more comments

$$ f(x) = \frac{2x - 1}{1 - |2x - 1|}. $$

share|improve this answer
Thanks for your response also, mjqxxxx. –  yunone Jan 15 '11 at 19:42
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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