Does there exists a continuous surjection from $\mathbb{R}$ to $\mathbb{R}^2$? I constructed a bijection by using decimal expansions of two real numbers and taking numbers 1 by 1 consecutively. (It took me hours to come up with this). I remember someone saying appealing to some sort of expansion is the only way to do this, and I think this type of method can never be continuous. Is there anyway to prove that no such function exists?
 A: Yes, there exists a continuous surjection from $\mathbb R$ to $\mathbb R^2$. The following is a simple way to construct one, although there should be more elegant constructions. Let $f:[0,1]\to[-1,1]^2$ be a spacefilling curve which starts and ends at the origin, for example the Sierpinski curve (although one could of course start with any space-filling curve $[0,1]\to[0,1]^2$, obtain a new space-filling curve $[0,1]\to[-1,1]^2$ by translation and scaling, and then append paths to the beginning and end of the curve to make it start and end at the origin). By scaling, we can define a space-filling curve $g_n:[0,1]\to[-n,n]^2$ by $g_n(x)=nf(x)$ for any integer $n>0$, which starts and ends at the origin. We can now define a space-filling curve from $[0,\infty)$ to $\mathbb R^2$ by first walking along the curve $g_1$, then walking along the curve $g_2$, then walking along the curve $g_3$, and so on. This is a continuous curve and it passes through every point of $(x,y)\in \mathbb R^2$ since for every $(x,y)$ there exists an $n>0$ such that $(x,y)\in[-n,n]^2$.
To be explicit, the curve $F:\mathbb R\to\mathbb R^2$ defined by $F(x)=0$ if $x<1$, and $F(x)=g_n(x-n)$ if $x\in[n,n+1)$, is a continuous surjection.
