# How can you define a function with domain the whole of RR and range the whole of CC?

## (It is possible to define a bijection constructively)

Dec 31, 2016

See explanation...

#### Explanation:

Define $h \left(x\right) : \left(0 , 1\right) \to \left(- \infty , \infty\right)$:

$h \left(x\right) = \frac{1 - 2 x}{x \left(x - 1\right)}$

graph{(sqrt(1/4-(x-1/2)^2))/(sqrt(1/4-(x-1/2)^2))(1-2x)/(x(x-1)) [-1, 2, -10, 10]}

Then:

${h}^{- 1} \left(y\right) = \frac{\left(y - 2\right) + \sqrt{{y}^{2} + 4}}{2 y}$

So $h \left(x\right)$ is a bijection between $\left(0 , 1\right)$ and $\mathbb{R}$, with inverse ${h}^{- 1} \left(y\right)$

Let $S = \left\{a + b i : a , b \in \left(0 , 1\right)\right\}$ i.e. the open unit square in Q1.

We can use $h \left(x\right)$ on the Real and imaginary parts of a Complex number to define a bijection $k \left(x\right)$ between $S$ and $\mathbb{C}$:

$k \left(a + b i\right) = h \left(a\right) + h \left(b\right) i$

${k}^{- 1} \left(a + b i\right) = {h}^{- 1} \left(a\right) + {h}^{- 1} \left(b\right) i$

Having found these bijections, next consider decimal representations of numbers in $\left(0 , 1\right)$.

Some numbers have two possible decimal representations; one with a tail of repeating $0$'s and the other with a tail of repeating $9$'s. For our purposes, we disallow representations with a tail of repeating $0$'s, choosing to use the representation with repeating $9$'s.

Then there is a bijection between $\left(0 , 1\right)$ and representations of the form $0. {a}_{1} {a}_{2} {a}_{3} {a}_{4} \ldots$, where ${a}_{i} \in \left\{0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9\right\}$ are decimal digits and no sequence has a tail of repeating $0$'s.

Given a number $0. {a}_{1} {a}_{2} {a}_{3} {a}_{4} \ldots$, split the sequence into a sequence of subsequences, each of which is as short as possible, but ends with a non-zero digit.

For example:

$0.0230040291 \ldots$

splits as:

$0. \text{ "02" "3" "004" "02" "9" "1" } \ldots$

Then recombine alternate subsequences to form two Real numbers in $\left(0 , 1\right)$:

$0.020049 \ldots$

$0.3021 \ldots$

These are the Real and imaginary parts of a corresponding Complex number in $S$

This process defines a function:

$s \left(x\right) : \left(0 , 1\right) \to S$

Conversely, given a Complex number in $S$, disassemble the Real and imaginary parts, then interlace them to form a Real number in $\left(0 , 1\right)$:

So given:

$0.020049 \ldots + 0.3021 \ldots i$

Split into subsequences:

$0. \text{ "02" "004" "9" } \ldots$

$0. \text{ "3" "02" "1" } \ldots$

Interlace:

$0.0230040291 \ldots$

This defines the inverse function ${s}^{- 1} \left(y\right) : S \to \left(0 , 1\right)$

Hence we can define a function with domain $\mathbb{R}$ and range $\mathbb{C}$ by:

$f \left(x\right) = {k}^{- 1} \left(s \left(h \left(x\right)\right)\right)$

This is a bijection, with inverse:

${f}^{- 1} \left(y\right) = {h}^{- 1} \left({s}^{- 1} \left(k \left(y\right)\right)\right)$