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

I'm trying to prove that any proper 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$?

Thanks in advance


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.