As part of a HW assignment in the course elementary set theory, I was given the following question:
Prove explicitly (don't use any theorems or known facts, but find a bijective function) that $\vert\mathbb R\vert=\vert \mathbb R\times \mathbb R\vert$
I've already encountered with the following suggestion:
for any $(x,y)\in \mathbb R$ with the decimal expansion $x=n_1+0.a_1 a_2 a_3 \ldots$
for some $n_1\in \mathbb Z$ and $0\leq a_i \leq 9$ and $y=n_2+0.b_1 b_2 b_3 \ldots$
for some $n_2\in \mathbb Z$ and $0\leq b_i \leq 9$.
if $x$ or $y$ have two different decimal expansions then take the one that ends with an infinite string of 9's. then define $f : \mathbb R\times \mathbb R\longrightarrow \mathbb R$ by: $f((x,y))=n_1 +n_2 +0.a_1 b_1 a_2 b_2 a_3 b_3 \ldots$
$f$ is injective (I know that it is not accurate because I can choose $n_1$ and $n_2$ as I wish as long as their sum remains the same but the following was the more important part) but it is not onto $\mathbb R$ because for example: $0.12020202\ldots \in \mathbb R$ but there is no $(x,y)\in \mathbb R\times \mathbb R$ such that $f((x,y))=0.12020202\ldots$ because the only "candidates" are $x=0.10000\ldots$ and $y=0.2222\ldots$ but the number $0.10000\ldots $ does not belong to the representation that we agreed upon.
I feel that it can be fixed somehow but I can't manage to do it. I would really appreciate if anyone can give me a bijective function that fits.
(also how can I fix $f$ to be injective).