Could any one give an example of a bijective map from $\mathbb{R}^3\rightarrow \mathbb{R}$?

Thank you.

  • 18
    $\begingroup$ The basic idea is that you can take the decimal digits of the three input numbers and interleave them, mapping $(0.a_1a_2\ldots, 0.b_1b_2\ldots, 0.c_1c_2\ldots)$ to $0.a_1b_1c_1a_2b_2c_2\ldots$. This doesn't quite work because of the $0.4999\ldots = 0.5$ problem, but that detail can be cleaned up. $\endgroup$
    – MJD
    Aug 16, 2012 at 20:04

2 Answers 2


First, note that it is enough to find a bijection $f:\Bbb R^2\to \Bbb R$, since then $g(x,y,z) = f(f(x,y),z)$ is automatically a bijection from $\Bbb R^3$ to $\Bbb R$.

Next, note that since there is a bijection from $[0,1]\to\Bbb R$ (see appendix), it is enough to find a bijection from the unit square $[0,1]^2$ to the unit interval $[0,1]$. By constructions in the appendix, it does not really matter whether we consider $[0,1]$, $(0,1]$, or $(0,1)$, since there are easy bijections between all of these.

Mapping the unit square to the unit interval

There are a number of ways to proceed in finding a bijection from the unit square to the unit interval. Usully one starts with the "interleaving" technique I mentioned in the comments, mapping $$\langle 0.a_1a_2a_3\ldots,\\\qquad 0.b_1b_2b_3\ldots\rangle$$ to $$0.a_1b_1a_2b_2a_3b_3\ldots.$$ To see why this doesn't quite work, consider the numbers $\frac 12=0.50000\ldots$ and $\frac9{22} = 0.40909\ldots$. Both of these are the image of the pair $\langle\frac12, 0\rangle$, so we have not described a bijection.

This problem can be fixed.

(In answering this question, I tried many web searches to try to remember the fix, and I was amazed at how many sources I found that ignored the problem, either entirely, or by handwaving. I never did find it; I had to remember it. Sadly, I cannot remember where I saw it first.)

First, we will deal with $(0,1]$ rather than with $[0,1]$; bijections between these two sets are well-known, or see the appendix. For real numbers with two decimal expansions, such as $\frac12$, we will agree to use only the expansion that ends with nines rather than the one that ends with zeroes. So for example we represent $\frac12$ as $0.4999\ldots$.

Now instead of interleaving single digits, we will break each input number into chunks, where each chunk consists of some number of zeroes (possibly none) followed by a single non-zero digit. For example, $\frac1{200} = 0.00499\ldots$ is broken up as $$004\ 9\ 9\ 9\ldots,$$ and $0.01003430901111\ldots$ is broken up as $$01\ 003\ 4\ 3\ 09\ 01\ 1\ 1\ldots.$$

This chunking process is well-defined since we are ignoring representations that contain infinite sequences of zeroes.

Now instead of interleaving digits, we interleave chunks. To interleave $0.004999\ldots$ and $0.01003430901111\ldots$, we get $$0.004\ 01\ 9\ 003\ 9\ 4\ 9\ldots.$$ This is obviously reversible. It can never produce a result that ends with an infinite sequence of zeroes, and similarly the reverse mapping can never produce a number with an infinite sequence of trailing zeroes, so we win. A problem example similar to the one from a few paragraphs ago is resolved as follows: $\frac12 = 0.4999\ldots$ is the unique image of $\langle 0.4999\ldots, 0.999\ldots\rangle$ and $\frac9{22} = 0.40909\ldots$ is the unique image of $\langle 0.40909\ldots, 0.0909\ldots\rangle$.

This is enough to answer the question posted, but I will give some alternative approaches.

Continued fractions

According to the paper "Was Cantor Surprised?" by Fernando Q. Gouveâ, Cantor originally tried interleaving the digits himself, but Dedekind pointed out the problem of nonunique decimal representations. Cantor then switched to an argument like the one Robert Israel gave in his answer, based on continued fraction representations of irrational numbers. He first constructed a bijection from $(0,1)$ to its irrational subset (see this question for the mapping Cantor used and other mappings that work), and then from pairs of irrational numbers to a single irrational number by interleaving the terms of the infinite continued fractions. Since Cantor dealt with numbers in $(0,1)$, he could guarantee that every irrational number had an infinite continued fraction representation of the form $$x = x_0 + \dfrac{1}{x_1 + \dfrac{1}{x_2 + \ldots}}$$

where $x_0$ was zero, avoiding the special-case handling for $x_0$ in Robert Israel's solution.

Cantor-Schröder-Bernstein mappings

The Cantor-Schröder-Bernstein theorem takes an injection $f:A\to B$ and an injection $g:B\to A$, and constructs a bijection between $A$ and $B$.

So if we can find an injection $f:[0,1)^2\to[0,1)$ and an injection $g:[0,1)\to[0,1)^2$, we can invoke the CSB theorem and we will be done.

$g$ is quite trivial; $x\mapsto \langle x, 0\rangle$ is one of many obvious injections.

For $f$ we can use the interleaving-digits trick again, and we don't have to be so careful because we need only an injection, not a bijection. We can choose the representation of the input numbers arbitrarily; say we will take the $0.5000\ldots$ representation rather than the $0.4999\ldots$ representation. Then we interleave the digits of the two input numbers. There is no way for the result to end with an infinite sequence of nines, so we are guaranteed an injection.

Then we apply CSB to $f$ and $g$ and we are done.


  1. There is a bijection from $(-\infty, \infty)$ to $(0, \infty)$. The map $x\mapsto e^x$ is an example.

  2. There is a bijection from $(0, \infty)$ to $(0, 1)$. The map $x\mapsto \frac2\pi\tan^{-1} x$ is an example, as is $x\mapsto{x\over x+1}$.

  3. There is a bijection from $[0,1]$ to $(0,1]$. Have $0\mapsto \frac12, \frac12\mapsto\frac23,\frac23\mapsto\frac34,$ and so on. That takes care of $\left\{0, \frac12, \frac23, \frac34,\ldots\right\}$. For any other $x$, just map $x\mapsto x$.

  4. Similarly, there is a bijection from $(0,1]$ to $(0,1)$.

  • 3
    $\begingroup$ You can find the "fix" in a book such as R.L. Wilder's Introduction to the foundations of mathematics. $\endgroup$ Jun 23, 2013 at 16:14
  • 1
    $\begingroup$ @ M J D : Sir please tell me What is interleaving digit and how to find the injective function $f : [0,1)^2 \rightarrow [0,1)$ $\endgroup$
    – Struggler
    Aug 2, 2014 at 15:29
  • 1
    $\begingroup$ Your solution is way over complicated. The standard algorithm for converting to decimal representation of a number generates a unique output. E.g. to get the 5th digit of a number, multiply by 10 5 times and then floor. so floor(0.4999... * 10^5) is 0. See Wolfram Alpha: wolframalpha.com/input/?i=floor(0.4999...+*+10%5E5) $\endgroup$
    – Houshalter
    Apr 18, 2016 at 19:29
  • 5
    $\begingroup$ Late to the party, but I thought I would mention that the "chunks" method is used in the wonderful Theory of sets by Kamke (Dover reprint edition, p 31) $\endgroup$
    – Mark
    Mar 22, 2018 at 6:14
  • 1
    $\begingroup$ @Larry $[0,1]→(0,1]→(0,1)$ with bijections 3 and 4. Then $(0,1)→(0,∞)→(-∞,∞)$ with bijections 2 and 1. $\endgroup$
    – MJD
    Jul 19, 2021 at 1:47

First, note that the exponential function is a bijective map of $\mathbb R$ to $(0,\infty)$.
Now let $G$ be the irrationals in $(0,\infty)$. I'd like a bijective map of $(0,\infty)$ to $G$. It can be done as follows: if $x = r \pi^n$ for some nonnegative integer $n$ and rational $r$, let $f(x) = \pi x$, otherwise $f(x) = x$.

Finally, it suffices to find a bijective map of $G^3$ to $G$. This can be obtained using continued fractions. Each $x \in G$ can be expressed in a unique way as an infinite continued fraction $x = x_0 + \dfrac{1}{x_1 + \dfrac{1}{x_2 + \ldots}}$ where $x_0$ is a nonnegative integer and $x_1, x_2, \ldots$ are positive integers. Denote this as $[x_0; x_1, x_2, \ldots]$. We then map $(x,y,z) \in G^3$ to $[x_0; y_0+1, z_0+1, x_1, y_1, z_1, \ldots]$.

  • 1
    $\begingroup$ Why any irrational should be of the form $r\pi^n$? $\endgroup$
    – Phani Raj
    Oct 2, 2013 at 18:11
  • 4
    $\begingroup$ It doesn't have to be. If it isn't, $f$ maps it to itself. $\endgroup$ Oct 3, 2013 at 2:29
  • 1
    $\begingroup$ Is this order preserving? $\endgroup$
    – shinzou
    Apr 24, 2017 at 11:06
  • 3
    $\begingroup$ Certainly not preserving any of the "standard" orders. $\endgroup$ Apr 24, 2017 at 15:37
  • 1
    $\begingroup$ @DustanLevenstein It doesn't matter as long as we alter $\pi$'s exponent injectively while making sure $0$ isn't in the image of the exponent's transformation. The successor function is just the simplest such function whereas your proposal is $n \mapsto 2n+1$. Both suffice. $\endgroup$
    – Fytch
    Jul 4, 2019 at 9:58

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .