# Is this a bijection from $[0,1)$ to $(0,1)$?

$$f(n) = \begin{cases} n & \text{if n is irrational} \\ (n+1)/2, & \text{if n is rational} \end{cases}$$

The way the function is constructed we can get to every rational in $$(0,1)$$ and every $$f(n)$$ is in $$(0,1)$$. Also $$0$$ maps to $$1/2$$ and $$f(n)$$ maps to $$0$$ if and only $$f(n) = -1$$, which we don't need to consider since $$n$$ must be in $$(0,1)$$. The function is clearly injective.

• What is the value of $x$ that gives $f(x)=\frac{1}{3}$? Aug 2, 2019 at 18:23
• Ok understood. This is confusing because the book I am using asks these questions in chapter $1$ and every construction I see for the solutions to these problems is rather complicated. Aug 2, 2019 at 18:26
• Aug 2, 2019 at 18:29
• Exactly the same argument in that link except let $x_{0} = 0$. I just thought there would be a simpler construction since I didn't see anything in this book (Abbott) that would make me consider such an argument. Aug 2, 2019 at 18:46

$$f$$ is surjective if $$y \in (0,1)\cap \mathbb{Q} \Rightarrow \exists x \in [0,1) \cap \mathbb{Q} \ y=f(x) = \frac{x+1}{2}$$.
But $$y< \frac{1}{2} \Rightarrow x <0$$, so it isn't surjective.
Rational numbers $$< \frac{1}{2}$$ in the second set doesn't map to any element in the first set, so there do not exist an inverse function. Therefore, it is not a bijection.
On the other hand, I think the function from $$[0,1) \cup \mathbb{Q(-1,0)}$$ to $$(0,1)$$ is a bijection.