TITLE: Cardinality of $\mathbb{R}$ and $\mathbb{R}^2$
QUESTION [17 upvotes]: I am working on this exercise for an introductory Real Analysis course:

Show that |$\mathbb{R}$| = |$\mathbb{R}^2$|.

I know that $\mathbb{R}$ is uncountable. I also know that two sets $A$ and $B$ have the same cardinality if there is a bijection from $A$ onto $B$. So if I show that there exists a bijection from $\mathbb{R}$ onto $\mathbb{R}^2$ then I beleive that shows that |$\mathbb{R}$| = |$\mathbb{R}^2$|. 
Let $x_i \in \mathbb{R}$, where each $x_i$ is expressed as an infinite decimal, written as $x_i = x_{i0}.x_{i1}x_{i2}x_{i3}...,$. Each $x_{i0}$ is an integer, and $x_{ik} \in \left \{ 0,1,2, 3, 4, 5, 6, 7, 8, 9 \right \}$. Then, let
$$f(x_i)=(x_{i0}.x_{i1}x_{i3}x_{i5}... ,x_{i0}.x_{i2}x_{i4}x_{i6}...)$$
What should I do to show that $f: \mathbb{R} \to \mathbb{R}^2$ is an injective function? Any suggestions or help with the question would be appreciated.

REPLY [17 votes]: Edited to add: As Andres pointed out in a comment, I had this the wrong way round: to use Schroeder-Bernstein, we want to exhibit injections (not surjections) in each direction. I think I have it right now.
Using decimal (or binary, ternary,...) expansions like this is very messy.

Your suggestion is obviously not an injection, because for every $(x,y)$ in the range, the integral parts of $x$ and $y$ are the same ($x_{i0}$ in your notation).
There are any number of bijections between $\mathbb R$ and the interval $(0,1)$. I'm sure you can think of a few. So we can reduce the problem to finding a bijection between $(0,1)$ and $(0,1)\times(0,1)$. In this case, your approach looks promising. But unfortunately it is spoilt by the fact that $0.abc09999...$ is equal to $0.abc10000...$. You can make the notion of decimal expansion unambiguous by always choosing the non-terminating one, but then when you try to extract two such decimal expansions as you have done, there is no guarantee that they will both be non-terminating. For instance, $0.7170707070707070...$ and $0.7079797979797979...$ both unpack to $(0.777777...,0.1)$.

So the usual approach is to show the existence of an injection in each direction, which guarantees the existence of a bijection by the Schroeder–Bernstein theorem.
There is the obvious injection from $(0,1)$ to $(0,1)\times(0,1)$ given by $x \mapsto (x,\frac12)$.
To go the other way, take $(x,y) \in (0,1)\times(0,1)$. We can express $x$ and $y$ as non-terminating decimal expansions $0.x_1x_2x_3\ldots$ and $0.y_1y_2y_3\ldots$ (non-terminating means that the number of non-zero digits is infinite). Now we map this to the number with decimal expansion $0.x_1y_1x_2y_2x_3y_3...$. This is not a bijection! But it is an injection, which is enough to prove that the cardinalities of $\mathbb R$ and $\mathbb R^2$ are equal.