# Simple example of a continuous onto function mapping $[0,1]$ to $\mathbb R$

There should exist such a function, but I cannot think of any example. Onto continuous functions mapping $(0,1)$ to $\mathbb R$ are easy to find.

Edit: Sorry - I mentioned Tietze extension theorem proved the existence of such a function - that was wrong. I mixed it up with a different question.

-
do you mean onto? –  user20266 Mar 25 '12 at 17:24
Exactly. Sorry. It's now fixed. –  Polymorpher Mar 25 '12 at 17:25
@Poly Maybe you want $(0,1)$ into $\mathbb R$. You can use $\tan \pi z$ for example. –  Pedro Tamaroff Mar 25 '12 at 17:27
Pedro Tamaroff, You should wrote $\cot\pi z$ –  Hamid Mar 22 '14 at 14:28

No such function exists. $[0,1]$ is compact, $\mathbb{R}$ is not compact, and the continuous image of a compact space is compact.
You are right. I don't know why I forgot that... In fact I am looking for a continuous onto function mapping R to R^2. I was trying to find some functions to compose with space filling curve [0,1] to $[0,1]^2$ –  Polymorpher Mar 25 '12 at 17:34
No such function exists from $\mathbb{R}$ to $\mathbb{R}^2$. If you omit some lines from $\mathbb{R}$, it's not connected anymore, but $\mathbb{R}^2$ stays connected.
I'm not sure why you're talking about functions $f: \mathbb{R} \rightarrow mathbb{R}^2$, but what you're saying is incorrect: there are surjective continuous functions $f$. There are just not bijective continuous functions. –  Pete L. Clark May 28 '12 at 4:57
I'm not sure what you mean by lines in $\mathbb R$, but in any case, while it's certainly true that the continuous image of a connected set is connected, the converse doesn't hold: sometimes the continuous image of a disconnected set is also connected :) –  Ben Millwood May 28 '12 at 10:09
It's possible he read Polymorpher's comment to Chris Eagle's answer, where Polymorpher said that he is looking for a map $\mathbb{R} \to \mathbb{R}^2$. But the statement is still incorrect. –  mixedmath May 28 '12 at 10:19