Continuous map from open unit interval to the square such that the range and its complement are both dense Is there a continuous map $f$ from the open unit interval $I=(0,1)$ to the square $I^2=(0,1)\times (0,1)$ such that both $f(I)$ and $I^2\setminus f(I)$ are dense in $I^2$?
 A: Let $d_2,d_3,\dots $ be a countable dense subset of $I^2.$ (Starting the indexing at $2$ helps a little.) On $[1/2,1),$ define $f$ to be $d_2.$ For $n>2$ we define $f$ on the interval $I_n=[1/(n+1),1/n]$ by
$$f(t) = d_{n+1} + (t-1/(n+1))n(n+1)(d_n - d_{n+1}).$$
The function $f$ then maps $I_n$ onto the line segment $[d_{n+1},d_n] \subset I^2.$ Note we have two possible definitions of $f$ at the points $1/2,1/3,\dots,$ but the two match up. We thus have a continuous map $f:I\to I^2$ with $f(1/n)=d_n, n=2,3,\dots$ It follows that $f(I)$ contains $\{d_2,d_3,\dots \}.$ Hence $f(I)$ is dense in $I^2.$
I see two ways to see that $I^2\setminus f(I)$ is dense in $I^2.$ One way is through measure theory. Each $f(I_n)$ has area measure $0.$ Hence so does $f(I) = \cup f(I_n),$ Therefore the area measure of $I^2\setminus f(I)$ is $1.$ And any subset of $I^2$ having measure $1$ is dense in $I^2.$ 
The other way is by Baire: Take a closed disc $D\subset I^2$ of positive radius. The sets $f(I_n)\cap D$ are then closed and nowhere dense in $D.$ Thus by Baire, $\cup f(I_n)\cap D$ is not all of $D.$ It follows that $I^2\setminus f(I)$ has nonempty intersection with $D.$ This true for all such discs $D,$ hence $I^2\setminus f(I)$ is dense in $I^2.$
