Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Does there exist a bijective function $f:{\mathbb R}\rightarrow{\mathbb R}$ that is nowhere-continuous, assuming that both domain and range have the "standard topology"? 1

1 By this I mean the one generated by the open intervals $(a, b) \subset {\mathrm R}$. BTW, if this topology has a name more readily recognized than the standard topology (on ${\mathbb R}$), please toss me a comment!

EDIT: the original version of this question allowed for the possibility that $f$ be only injective, but shortly after I posted the following injective function came to mind: let $n:{\mathbb Q}\rightarrow {\mathbb N}$ be an ordering of the rationals, and define

$$f(x)=\begin{cases} n(x) & x\in\mathbb Q\\ x& x\notin\mathbb Q\end{cases}$$

It is clear that this $f$ is injective, and it seems to me that the proof of the nowhere-continuity of the Dirichlet function applies to this case as well.

EDIT2: OK, I was next going to try modifying the candidate above to make the function bijective, but Asaf Karagila got there first, with a much neater solution than what I was heading for...

share|cite|improve this question
You can call the topology the euclidean topology, because it's induced by the euclidean metric $d(x,y) = |x-y|$. – Dario Feb 3 '13 at 12:25
up vote 12 down vote accepted

How about: $$f(x)=\begin{cases} x+1 & x\in\mathbb Q\\ x& x\notin\mathbb Q\end{cases}$$

share|cite|improve this answer
Nice, thanks!!! – kjo Feb 2 '13 at 15:35

This function should work.

$ f(x) = \begin{cases} x & \text{if x $\in \mathbf{Q}$ and $x \neq 0$} \\ -x & \text{if x $\in \mathbf{R-Q}$}\\ \sqrt{2} & \text{if $ x = 0 $} \end{cases}$

You can find more counterexaples of this type in "Counterexamples in analysis" by Gelbaum and Holmsted.

By the way, as far as I know, the standard topology on $\mathbf{R}^{n}$ is usually called "euclidean topology"

share|cite|improve this answer
Not a bijection, $f(0)=f(-\sqrt{2})=\sqrt{2}$. – 1015 Feb 2 '13 at 15:39
does not the case $x\in\mathbb Q$ include $x=0$? – Stefan Hamcke Feb 2 '13 at 15:48
You are both right: I edited the answer including $x \in \mathbf{Q}$ and $x \neq 0$. By the way @Asaf example is really nice, instead my function works for $x \geq 0 $ – Alessandro Feb 3 '13 at 11:43

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.