Does the subset $(0,1)$ of $\Bbb{R}$ have the same cardinality as $\Bbb{R}$? I want to check if the interval of real numbers $(0,1)$ has the same cardinality as $\Bbb{R}$. All that I need to prove is that I can get a bijective function in which domain is $\Bbb{R}$ and my image is the subset $(0,1)$. I have the function $$y=\frac{1}{2} + \frac{1}{2}\frac{x}{|x|+1}$$ I can formally prove that my function is bijective, but I don't know how to formally prove that this function is surjective. My question is: How can I prove $y$ is a surjection? And if I do so, is there still something else that my proof is lacking? 
 A: To show $y$ is a surjection, let $a \in (0,1)$. We want to show there is some $x \in \Bbb{R}$ such that $y(x)=a$. To do this, set $a = \frac{1}{2}+\frac{x}{2(|x|+1)}$. Then $$2a = 1+\frac{x}{|x|+1} \\ \implies 2a(|x|+1)=|x|+1+x$$ Because of the absolute value found in the denominator of $y$, we will need to make cases. 
Case 1: If $x \geq 0$ then $|x|=x$ so $$2a(|x|+1)=|x|+1+x \\ \implies 2a(x+1) = 2x+1 \\ \implies 2ax+2a-2x=1 \\ \implies x(2a-2)=1-2a \\ \implies x = \frac{1-2a}{2a-2} \\ = \frac{1}{2}\cdot\frac{2a-1}{1-a}$$ Now notice that $\frac{1}{2}\cdot\frac{2a-1}{1-a} \geq 0$ so long as $a \in [1/2,1)$. This is important to note since we got this equation by assuming $x \geq 0$. I will leave it up to you to complete the second case. You'll get a different equation when $x<0$ since $|x| = -x$, and you will need to verify that your equation behaves correctly for all $a \in (0,1/2)$. You can then conclude that no matter which $a \in (0,1/2) \cup [1/2,1) = (0,1)$ you begin with, you have a way of tracing it back to some $x \in \Bbb{R}$.
A: Your function can be written
$$
f(x)=\begin{cases}
\dfrac{1}{2}\left(1+\dfrac{x}{1+x}\right) & \text{if $x\ge0$}\\[4px]
\dfrac{1}{2}\left(1+\dfrac{x}{1-x}\right) & \text{if $x<0$}
\end{cases}
$$
For $x\ge0$, we have $f(x)\ge 1/2$, whereas, for $x<0$, we have $f(x)<1/2$.
Thus we can't have $f(x_1)=f(x_2)$ if $x_1<0$ and $x_2\ge0$ (or conversely). So, for injectivity, it suffices to show that


*

*if $x_1<0$, $x_2<0$ and $f(x_1)=f(x_2)$, then $x_1=x_2$;

*if $x_1\ge0$, $x_2\ge0$ and $f(x_1)=f(x_2)$, then $x_1=x_2$.


The same idea can be used for showing surjectivity. If $1/2\le y<1$, we want to find $x\ge0$ such that $f(x)=y$. This becomes
$$
2y=\frac{2x+1}{1+x}
$$
or
$$
x=\frac{2y-1}{2(1-y)}
$$
and this solution is good, for the right hand side is $\ge0$.
If $0<y<1/2$, we need
$$
2y=\frac{1}{1-x}
$$
or
$$
x=\frac{2y-1}{2y}
$$
and this solution is good, because the right hand side is $<0$.

An easier map that shows the same thing is
$$
f(x)=\frac{1}{2}+\frac{1}{\pi}\arctan x
$$
