define $f:(0,1]\to(0,1)$ by: if $x=\frac{1}{n}$ for $n\in\mathbb{N}$, then $f(x)=\frac{1}{n+1}$, else $f(x)=x$. Is this a bijection?

70 Views Asked by At

Injectivity:
Suppose $f(x_1)=f(x_2)$. If $x_1$ is a unit fraction, then $x_1=\frac{1}{n}$ for some $n\in\mathbb{N}$, and therefore $f(x_1)=f(\frac{1}{n})=\frac{1}{n+1}$. Clearly $x_2$ is a unit fraction aswell, so $x_2=\frac{1}{n'}$, and $f(x_2)=f(\frac{1}{n'})=\frac{1}{n'+1}$. Then $\frac{1}{n+1}=\frac{1}{n'+1}\to n'+1=n+1\to n'=n$, so $x_1=\frac{1}{n}=\frac{1}{n'}=x_2$.
If $x_1$ is not a unit fraction, then $x_2$ cant be a unit fraction and so $f(x_1)=x_1=x_2=f(x_2)$.

Surjectivity:
For any $y\in(0,1)$, if $y=\frac{1}{n}$ for some $n>1$, then $f(\frac{1}{n-1})=\frac{1}{n}=y$. If $y$ is not a unit fraction, $y\in(0,1]$ and $f(y)=y$.

Is it valid? The proof might seem a bit "overkill" but I want to make sure I haven't made a mistake.

EDIT: is it possible to check this by graphing?