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}.$
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$.