$\mathbb R$ has the same cardinality of any interval

I'm trying to prove any interval has the same cardinality of the reals numbers $\mathbb R$. In order to prove this I define two functions $f:(s,t)\to (u,v),f(x)=\frac{v-u}{t-s}(x-s)+u$ and $g:\mathbb R\to (-1,1),g(x)=\frac{x}{1+|x|}$.

My question is are these functions bijections and from that can I conclude any interval has the same cardinality of $\mathbb R$?

• $g$ is not defined at $x=-1$. – T. Eskin May 6 '14 at 3:48
• @ThomasE. I changed the function, is it ok now? thanks for the remark. – user42912 May 6 '14 at 3:50
• The problem is a little different for open intervals $(a,b)$ than for closed intervals $[a,b]$, or half-open intervals. – André Nicolas May 6 '14 at 3:51
• The range of your new $g$ is not $(0,1)$. No big problem, you can work with $(-1,1)$. – André Nicolas May 6 '14 at 3:52
• @AndréNicolas is it of now? – user42912 May 6 '14 at 3:53

Your first function is a bijection and proves that any two finite intervals have the same cardinality. Your second fails because $g(-\frac 12) \not \in (0,1)$ but you have the right idea. There are many bijections between $\Bbb R$ and some finite interval. One of the simplest is $\arctan(x)\to (\frac {-\pi}2,\frac \pi 2)$ This solves the open intervals. For closed intervals, you need to "swallow" the endpoints somehow.
• $f(x)$ is a bijection because it is a linear function, and all linear functions are bijections (why?). For $g$ consider $\frac{x}{1+|x|}=\frac{x}{1+x}$ if $x \geq 0$. Its derivative is $\frac{1}{(1+x)^2}>0$. This means $g(x)$ is increasing when $x \geq 0$. Note the same is true about $g'(x)$ in the case $x<0$ and notice that $g(x)$ is continuous on $\mathbb{R}$. Conclude. – Darrin May 6 '14 at 4:03
• I defined two functions $g_1:\mathbb R^+\to (0,1), g_1(x)=\frac{x}{1+x}$ and $g_2:\mathbb R^-\to (-1,0], g_2(x)=\frac{x}{1-x}$ – user42912 May 6 '14 at 4:04