Show that open segment $(a,b)$, close segment $[a,b]$ have the same cardinality as $\mathbb{R}$ a) Show that any open segment $(a,b)$ with $a<b$ has the same cardinality as $\mathbb{R}$.
b) Show that any closed segment $[a,b]$ with $a<b$ has the same cardinality as $\mathbb{R}$.

Thoughts:
Since $a<b$, $a,b$ are two distinct real number on $\mathbb{R}$, we need to show it is 1 to 1 bijection functions which map between $(a,b)$ and $\mathbb{R}$, $[a,b]$ and $\mathbb{R}$.
But we know $\mathbb{R}$ is uncountable, so we show the same for $(a,b)$ and $[a,b]$?
and how can I make use of the Cantor-Schroder-Bernstein Theorem? The one with $|A|\le|B|$ and $|B|\le|A|$, then $|A|=|B|$?
thanks!!

Consider the function $f:(0,1)\to \mathbb{R}$ defined as,
$$f(x)=\frac{1}{x}+\frac{1}{1-x}$$
Prove that $f$ is a bijective function.
Now, by previous posts, $(0,1)$ and  $[0,1]$ have the same cardinality.
Consider the function $g:[0,1]\to[a,b]$, defined as,
$$g(x)=({b-a})x+a$$
Prove that $g$ is bijective function to conclude that $[0,1]$ and $[a,b]$ have the same cardinality as $\mathbb{R}$.
