52

Is there a simple, constructive, 1-1 mapping between the reals and the irrationals?

I know that the Cantor–Bernstein–Schroeder theorem implies the existence of a 1-1 mapping between the reals and the irrationals, but the proofs of this theorem are nonconstructive.

I wondered if a simple (not involving an infinite set of mappings) constructive (so the mapping is straightforwardly specified) mapping existed.

I have considered things like mapping the rationals to the rationals plus a fixed irrational, but then I could not figure out how to prevent an infinite (possible uncountably infinite) regression.

marty cohen
  • 107,799

7 Answers7

80

Map numbers of the form $q + k\sqrt{2}$ for some $q\in \mathbb{Q}$ and $k \in \mathbb{N}$ to $q + (k+1)\sqrt{2}$ and fix all other numbers.

WimC
  • 32,192
  • 2
  • 48
  • 88
  • 11
    What a beautiful, simple answer. – Stefan Smith Oct 02 '13 at 19:25
  • 1
    I am having trouble understanding how this should work: if $k$ is even this will map a rational number to an irrational, if $k$ is odd that will be reversed. – String Oct 02 '13 at 22:52
  • I would say $q+k\sqrt 2$ for $q\in\mathbb Q\cap[0,1)$ and $k\in\mathbb N$ maps to $q+(2k+1)\sqrt 2$. This maps $\mathbb R$ to $\mathbb R\setminus\mathbb Q$ as I see it. – String Oct 02 '13 at 22:58
  • @String $\sqrt{2}$ goes to $2\sqrt{2}$ which is not rational. Where would your proposal send rationals outside of $[0,1)$? – madth3 Oct 03 '13 at 00:14
  • 1
    This isn't technically an answer to his question, though. It's not 1-1. In particular, all irrational numbers are fixed by your map, so the rationals get mapped on top of them. – Chris Bonnell Oct 03 '13 at 00:27
  • 3
    @atomic: That's not true; you must be misreading the answer. – ruakh Oct 03 '13 at 02:20
  • 6
    @madth3: Ok, got it now. We must allow $k=0$ to have the rationals $\mathbb Q$ mapped to $\mathbb Q+\sqrt 2$. And then these irrationals must be moved 'to make space etc. – String Oct 03 '13 at 04:26
  • @ruakh Yeah, you're right, i was misreading it slightly. – Chris Bonnell Oct 03 '13 at 11:39
30

Let $\phi_i$ be an enumeration of the rationals. Let $\eta_i$ be some countable sequence of distinct irrationals; say for concreteness that $$\eta_i = \frac{\sqrt2}{2^{i}}.$$

Then define $$f(x) = \begin{cases} \eta_{2i} & \text{if $x$ is rational and so equal to $\phi_i$ for some $i$} \\ \eta_{2i+1} & \text{if $x$ is irrational and equal to $\eta_i$ for some $i$} \\ x & \text{otherwise} \end{cases}$$

$f$ is now a bijective mapping between the reals and the irrationals.

This mapping was found by Cantor in 1877; I saw it in the paper "Was Cantor Surprised?" by Fernando Q. Gouvêa. (American Mathematical Monthly, 118, March 2011, pp. 198–209.) The construction is described at the middle of page 208.

MJD
  • 65,394
  • 39
  • 298
  • 580
4

Consider $A = \{ \pi + n : n\in\Bbb N\}$. Clearly $A$ is countable. (Consider the bijection $n\rightarrow\pi + n, \forall n\in\Bbb N$). So elements of $A$ can be expressed as, $A = \{a_k : k \in \Bbb N\}$. And we also can have $\Bbb Q = \{b_k : k \in \Bbb N\}$.

Now consider the bijection $\phi : \Bbb R \rightarrow \Bbb R \setminus \Bbb Q$ by,

$$\phi(x) := \begin{cases} a_{2k+1} &\text{if}\;x = b_k, x \in \Bbb Q\\ a_{2k} &\text{if}\;x = a_k, x \in A\\ x &\text{if}\;x \in \Bbb R \setminus (A\cup \Bbb Q) \end{cases}$$

This example can be seen as a very general bijection from a general uncountable set to a proper subset of it which is also uncountable!

Ruslan
  • 6,775
4

There's a map between the irrational numbers and the non-eventually zero sequences of natural numbers, namely continued fractions.

We can prove, easily (using the Cantor-Bernstein theorem, anyway), that there is a bijection between $\Bbb R$ and the set of these non-eventually zero sequences of integers.

Now the composition works out just fine as a bijection from $\Bbb R$ and $\Bbb{R\setminus Q}$. But it's not nearly as sleek as MJD's solution.

Asaf Karagila
  • 393,674
2

A rather simple explicit formula for an injection $f:\mathbb{R} \rightarrow \mathbb{R/Q}$ is $f(x)=\frac{x}{1+|x|}+1$ if $x\in \mathbb{R/Q}$ and $f(x)=\sqrt{2}(\frac{x}{1+|x|}-1)$ if $x\in\mathbb{Q}$.

This function does not rely on the fact the rationals are countable or the properties of transcendental numbers. It moves away from the classic displacement technique, where a sequence of irrationals are defined and then the function bumps each term of the sequence to a different term of the sequence to make room for the rationals. It does rely on the existence of $\sqrt{2}\in \mathbb{R}/\mathbb{Q}$, but any irrational number can be used in its place.

It can be shown to be well defined because rational numbers are closed under addition and multiplication (and subtraction and division), but multiplying a rational and an irrational results in an irrational and adding a rational and an irrational results in an irrational. It is also useful to note $\frac{x}{|x|} = $sgn$(x)\in \mathbb{Q}$ for any $x\in \mathbb{R/Q}$.

It can be shown to be an injection directly from the definition of injective. It certainly is not a surjection, but the graph is fun.

nhurl
  • 21
  • 2
1

Rather similar, take your favorite transcendental-mine is $e$ because it is easy to type. For a first cut take each rational $q$ to $qe$, each number of the form $qe$ to $qe^2$, each $qe^2$ to $qe^3$ and so on. As $e$ is transcendental, we never run into a problem with coming back into the rationals. Unfortunately, this leaves us with a problem at $0$, but one point is easy to take care of. The final answer is (with $n$ being any non-negative integer)$$f(x)=\begin {cases}e&x=0\\e^{n+2}&x=e^n\\ex&x=qe^n, q \in \Bbb Q\\x&\text{otherwise} \end{cases}$$

Ross Millikan
  • 374,822
0

Here is a general approach that can be applied here. Suppose $A$, $B$, and $C$ are disjoint sets, where $A$ and $B$ are countably infinite. Then, we can construct an bijective function $\phi$ from $A\cup B\cup C$ to $B\cup C$, which maps $A\cup B$ onto $B$, and $C$ onto $C$. To do this, arrange the terms of $A$ and $B$ into sequences of distinct elements, so that $A=\{a_0,a_1,a_2,\dots\}$ and $B=\{b_0,b_1,b_2,\dots\}$. Define $\phi$ as follows: $$ \phi(x)= \begin{cases} b_{2i} &\text{if $x=a_i$ for some $i\in\mathbb N$} \, , \\ b_{2i+1} &\text{if $x=b_i$ for some $i\in\mathbb N$} \, , \\ x &\text{otherwise.} \end{cases} $$ This function maps the members of $A$ to the members of $B$ with even indices, and the members of $B$ to the members of $B$ with odd indices, while keeping the members of $C$ fixed in place.

To apply this method to construct a bijection between $\mathbb R$ and $\mathbb R\setminus\mathbb Q$, we can set:

  • $A=\mathbb Q$
  • $B=\{k\sqrt{2}:k\in\mathbb Z^+\}$
  • $C=\mathbb R\setminus(A\cup B)$

Let $f$ be a bijection from $\mathbb N$ to $\mathbb Q$ (see here for an explicit example), and put $a_i=f(i)$. Then, put $b_i=(i+1)\sqrt2$.

Finally, note that WimC's elegant answer uses the same principle. We split $\mathbb R$ into three disjoint sets:

  • $A=\mathbb Q$
  • $B=\{q+k\sqrt2:q\in\mathbb Q,k\in\mathbb Z^+\}$
  • $C=\mathbb R\setminus(A\cup B)$

Then, we map $A\cup B$ onto $B$, and $C$ onto $C$. The only difference between his and my approach is the way in which $A\cup B$ is mapped onto $B$.

Joe
  • 19,636