# bijection between the Cantor set and $R$

How can we construct a bijection between the Cantor set and $R$?

Both sets are uncountable. May the Dedekind cut help?

• Can you relate the Cantor set to ternary expansions? – Bungo Nov 22 '17 at 15:16

## 1 Answer

The Cantor set is the the subset of $[0,1]$ with open middle thirds removed. So every element of the Cantor set can be written as a ternary (base $3$) fraction with the digits $0$ and $2$, while the removed values require the digit $1$ in the ternary expression

So you might think we can get from the Cantor set to $[0,1]$ by taking the ternary expression, replacing all the $2$s by $1$s and reading the expression as a binary expression. We might then think of a suitable invertible expression to take the next step to get to $\mathbb R$ such as the log-odds or logit function $f(x) = \log\left(\frac{x}{1-x}\right)$

We still have a couple of problems:

• one is that $0$ and $1$ are in the original Cantor set but the second step will take them to $-\infty$ and $+\infty$, neither of which are in $\mathbb R$

• the other is that some pairs of values in the original Cantor set in fact get sent to the same value in the first step. As an example $\frac19$ in the Cantor set has ternary expression $0.0022222\ldots_3$ (or $0.01_3$, but that fails the requirement not to have $1$s) so gets sent to $0.0011111\ldots_2$, i.e. $\frac14$; meanwhile $\frac29$ in the Cantor set has ternary expression $0.02_3$ (or $0.0122222\ldots_3$, but that too fails the requirement) so gets sent to $0.01_2$, i.e. also $\frac14$

Fortunately the number of points in the Cantor set which are affected by either of these are countable and can be ordered, for example as $0,1,\frac13,\frac23,\frac19,\frac29,\frac79,\frac89,\frac1{27},\ldots$, and the points in $\mathbb R$ which might receive dual inputs are also countable and can be ordered, for example as $\log(\frac{1}{1}),\log\left(\frac{1}{3}\right),\log\left(\frac{3}{1}\right),\log\left(\frac{1}{7}\right),\log\left(\frac{3}{5}\right),\log\left(\frac{5}{3}\right),\log\left(\frac{7}{1}\right),\log\left(\frac{1}{15}\right),\log\left(\frac{3}{13}\right),\ldots$

So this now gives us a satisfactory approach:

• for elements of the Cantor set which are not $0$ or $1$ or other rationals with a lowest-terms denominator of a power of $3$: write them as a ternary fraction, replace the $2$s with $1$s, read as a binary fraction, and then apply the log-odds function to them

• for elements of the Cantor set which are $0$ or $1$ or other rationals with a lowest-terms denominator of a power of $3$: find their position in the list of such values ordered by lowest-terms denominator then lowest-terms numerator and chose the corresponding value from the list of positive rationals where lowest-terms numerator and denominator add to a power of $2$ ordered by this sum then lowest-terms numerator, and take the logarithm of the result

Both of these are invertible and so you have a bijection