Consider $f : [0, 1] \to \mathbb R$ defined as:$$f(x) = \begin{cases}x &: x \text{ irrational} \\x + \sqrt{2} &: x \text{ rational}\end{cases}$$
I need to show that, $f$ is injective.
My attempt:
Case(i): If $x, y\in\mathbb{Q}$ and $f(x) =f(y)$ then by definition of $f$ we have $x+\sqrt{2}=y+\sqrt{2}$ which implies $x=y$
Case(ii): If $x, y\in\mathbb{Q}^c$& $f(x) =f(y)$ then by definition of $f$ we have $x=y$
But to show that, $f$ is injective, we must consider one more case
case(iii) if one of $x$& $y$ is rational & other is irrational. Say $x\in\mathbb{Q}$& $y\in\mathbb{Q}^c$. In this case, $f(x) =f(y)$ imply $x+\sqrt{2}=y$. But in this case, we didn't get $x=y$? (Or I am missing something?)
Please help.