# A simple bijection between $\mathbb{R}$ and $\mathbb{R}^4$ or $\mathbb{R}^n$?

How to form a bijection from $(0,1]$ to $\mathbb{R}$:

$$f(x) = \left\{\begin{array}{ll} 2-\frac{1}{x}&\text{if }x\in(0, .5]\\ \frac{2x-1}{1-x}&\text{if }x\in(.5, 1]. \end{array}\right.$$

So, to go from $\mathbb{R}$ to $\mathbb{R}^4$ shouldn't be so hard... First we convert all of $\mathbb{R}$ in to a decimal representation. The numbers then have the form: $$a_1a_2a_3a_4\ldots$$  Where the $a_i$s are the digits $0$, $1$, $2,\ldots,9$.

At some point there is a decimal point, suppose it precedes the $a_j$th digit (could be the first)

Eliminate all duplicate representations:  $3.41=3.4099999\ldots$ and $0002 = 2$, by choosing the one with the fewest digits.

Now map the remaining representations to $$( a_1a_5a_9\ldots, a_2a_6a_{10}\ldots, a_3a_7a_{11}\ldots, a_4a_8a_{12}\ldots)$$

Put a decimal point in each one preceding the $a_j$, $a_{j+1}$, $a_{j+2}$ and $a_{j+3}$ digits.

This is not bijective, though! I know such a mapping exists, but I don't want in existence proof I want a scalable mapping I can use.

Is there some modification I can make to make it bijective?

-
Yes; replace $\mathbb{R}$ with $\{ 0, 1 \}^{\mathbb{N}}$ and everything works out much more nicely. – Qiaochu Yuan Mar 22 '12 at 16:38
If you know how to biject $\mathbb{R}$ with $\mathbb{R}^2$ via $\psi$, then you can biject $\mathbb{R}^2=\mathbb{R}\times\mathbb{R}$ with $\mathbb{R}^4=\mathbb{R}^2\times\mathbb{R}^2$ by taking the map $(\psi\times\psi)(a,b) = (\psi(a),\psi(b))$. Using this and the identity map you can construct bijections from $\mathbb{R}$ to $\mathbb{R}^n$ for any $n$. – Arturo Magidin Mar 22 '12 at 16:43
Your $f$ is not well defined for $x=1$. – WimC Mar 22 '12 at 17:27

Let $f$ be any bijection from $\mathbb{R}$ to $P(\mathbb{N})$ (the simplest one I could think of uses continued fractions, e.g. see here). To construct a bijection from $\mathbb{R}$ to $\mathbb{R}^n$ take $$g_i(A) = \left\{ \left.\frac{x-i}{n} \right|\ x\in A, x =i\ (\mathrm{mod}\ n) \right\}$$ and set $$h_i = f^{-1} \circ g_i \circ f$$ and then $$h(x) = \langle h_0(x), h_1(x), \ldots, h_{n-1}(x) \rangle$$ will be your bijection.