# Example of a continuous function from $(0,1) \times (0,1)$ to $\mathbb{R}^2$

The question is: Give an example of a function $f$, continuous on $S=(0,1) \times (0,1)$, such that $f(S)=\mathbb{R}^2$.

I'm getting stuck on $f(x)=\tan\left(\pi \left(x-\frac{1}{2}\right)\right)$, which covers all of $\mathbb{R}$ but not all of $\mathbb{R}^2$.

-
Why wouldn't $\tan\left(\pi\left(x-\frac12\right)\right)\tan\left(\pi\left(y-\frac12\right)\r‌​ight)$ work? – J. M. Oct 22 '10 at 2:30
Given the second line, I think the OP actually wants a function from $(0, 1)$, not $(0, 1)^2$. Is this what you intended? (There's a theorem stating that such a mapping can't be continuous, but I can't remember the reference.) – Vandermonde Oct 22 '10 at 2:33
@J.M. Haha! Thank you for pointing out the obvious for me... this is why we have math-friends – JimJones Oct 22 '10 at 2:46
FWIW, $\ln\left(\frac{x}{1-x}\right)\ln\left(\frac{y}{1-y}\right)$ works also. – J. M. Oct 22 '10 at 2:59
The statisticians among you might already be recognizing a pattern in the "suggestions" I've given so far... – J. M. Oct 22 '10 at 3:53

In what follows I assume that a map $f:\ ]0,1[\to \mathbb R^2$ is wanted.  There are continuous surjective maps $p:[0,1]\to[0,1]^2$; they are called Peano curves. One may choose $p$ in such a way that the "curve" begins at $(0,0)$ and ends at $(1,1)$. Therefore it is possible to construct a continuous map $f:\ ]0,1]\to\mathbb R^2$ such that the restrictions of $f$ to the intervals $[{1\over n+1},{1\over n}]$ are Peano curves covering an increasing sequence of squares $Q_n$ whose union is $\mathbb R^2$. At the end, the point $1$ may safely be omitted from the domain of $f$.