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

  • 10
    $\begingroup$ What is the value of $x$ that gives $f(x)=\frac{1}{3}$? $\endgroup$ Aug 2, 2019 at 18:23
  • $\begingroup$ 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. $\endgroup$
    – Derek Luna
    Aug 2, 2019 at 18:26
  • 1
    $\begingroup$ Related: How to define a bijection between $(0,1)$ and $(0,1]$? $\endgroup$
    – JMoravitz
    Aug 2, 2019 at 18:29
  • $\begingroup$ 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. $\endgroup$
    – Derek Luna
    Aug 2, 2019 at 18:46

2 Answers 2


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


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .