Question 46
Consider $f:\mathbb R\to\mathbb R$ given by $$f(x)=\begin{cases}ax,&x\in\mathbb Q,\\bx,&x\in\mathbb R\setminus\mathbb Q,\end{cases}$$ where $a,b$ are nonzero real numbers. Prove that $f$ is injective if and only if it is surjective.
Math Olympiad Vault · MathNet 2012