Prove there doesn't exist a such continuous function $f$ on $\Bbb{R}$ 
Prove there doesn't exist a continuous function $f$ on $\Bbb{R}$ such that $f$ is one-to-one on $\Bbb{R}\backslash\Bbb{Q}$ while not one-to-one on $\Bbb{Q}$.

Well, I get stuck at the beginning.  I think we must do this by constructing some contradiction. But I don't know what assumptions to make:  either that there exists such a function  or that $f$ is one-to-one on both $\Bbb{R}\backslash\Bbb{Q}$ and $\Bbb{Q}.$
 A: Let $f$ be a function such that $f(a)=f(b)$ for some $a\neq b$ both in $\Bbb Q$.
Then there exists $c\in(a,b)$ such that $f(c)$ is a local minimum or maximum for $f$.
In a small neighborhood of $c$ the function $f$ must be $2$ to $1$, i.e. for all $y$ close to $f(c)$ from above or below there are exactly two values $x_1,x_2$ close to $c$ such that $f(x_1)=f(x_2)$.
This sets up an involution $x_1\leftrightarrow x_2$ in a small neighborhood of $c$. Since there are uncountably many $y$, and since $\Bbb Q$ is countable, there must be two such $x_1, x_2$ which are both in $\Bbb R\setminus\Bbb Q$.
Hence $f$ cannot be injective on $\Bbb R\setminus\Bbb Q$.
A: One argument using measure theory. Let's consider a function $f$, injective on $\mathbb R \setminus \mathbb Q$ and not injective on $\mathbb Q$. We can find two numbers $p\neq q \in \mathbb Q$ such that $f(p)= f(q)$; WLOG we can suppose that $max_{[p,q]}(f)> f(p)$, so by continuity of f, (let's call $c$ the point where the maximum is reached), there exists $\alpha > 0$ such that if $|x- c| <\alpha$, $f(x) > f(p)$. Now let's consider the set  $f_{inj} =\{x \in \mathbb R, \exists  y \neq x \in \mathbb R, f(x) = f(y)\}$; by our hypothesis $f_{inj} \subset \mathbb Q$ and has Lebesgue measure $0$, but by our continuity argument $[c-\alpha, c +\alpha] \subset f_{inj}$ and so $\mu (f_{inj}) > 2 \cdot \alpha > 0$. This is a contradiction, and $f$ has to be injective on $\mathbb{Q}$.
