Is there a continuous function defined on $\mathbb{R}$ which is a bijection on $\mathbb{R}\backslash\mathbb{Q}$ but not a bijection on $\mathbb{Q}$.

Is there a continuous function defined on $$\mathbb{R}$$ which is a bijection on $$\mathbb{R}\backslash\mathbb{Q}$$ but not a bijection on $$\mathbb{Q}$$.

I tried to argue in this way. Let $$p,q\in\mathbb{Q}$$ with $$f(p)=f(q)$$ but $$p\neq q$$. Suppose $$a_n\rightarrow p, b_n\rightarrow q$$. Then $$\lim f(a_n)=\lim f(b_n)$$. But the limit case seems of no use.

Another idea is to prove $$f$$ is strictly monotone in $$\mathbb{R}$$, but I do not know how to begin.

Appreciate any help or hint!

• I'm not sure I understand. Do you want a continuous map $f : \mathbb{R} \to \mathbb{R}$ so that $f \restriction_{\mathbb{R} \setminus \mathbb{Q}}$ is a bijection onto its image, but $f \restriction_\mathbb{Q}$ is not a bijection onto its image? – HallaSurvivor May 17 at 6:58
• Exactly. I want to prove such map does not exist. – user823011 May 17 at 7:02
• If $f$ is not constant on $[p,q]$ then there is some $r\in (p,q)$ such that $f(r)\ne f(p)$ which implies that $f([p,r])\supset [f(p),f(r)],f([q,r])\supset [f(q),f(r)]$. – reuns May 17 at 10:04