Intervals and cardinality Let $x,y,a,b$ be real numbers. 
For $x<y$ and $a<b$, show the cardinality of $[a,b]$ equals the cardinality of $[x,y]$.
I did the above problem, by defining a linear function as a bijection between the intervals. The next part of the problem states,

Extend your result (from above) to open and half-open intervals. 

I'm just not sure what exactly I'm supposed to do next, the question seems vague. Am I supposed to show $(a,b)\sim (x,y)$? $[a,b]\sim (x,y)$? $[a,b)\sim (x,y]$?
 A: Hint: It is not clear whether you are supposed to take care of situations where the numbers of boundary points don't match. But if you are, the following idea will work. 
We find for example a bijection $\varphi$ from $[0,1)$ to $(0,1)$. Let $\varphi(1)=1/3$. For all $x$ of the shape $\frac{1}{3\cdot 2^n}$, where $n$ is a non-negative integer, let $\varphi(x)=\frac{1}{3\cdot 2^{n+1}}$. And for all other $x$, let $\varphi(x)=x$.
Remark: Suppose that we have a hotel with a finite number of rooms, all occupied. If a person comes wanting a room, she is out of luck. But if the hotel is countably infinite, the situation is much better. The manager just moves the occupant of Room $1$ into Room $2$, the occupant of Room $2$ into Room $3$, and so on forever. Now Room $1$ is free. Indeed if a countably infinite number of people come looking for a room, they can all be accommodated. Just move the occupant of Room $k$ to Room $2k$, and all the odd-numbered rooms are free. 
A: Hint:


*

*First note that all those calculations can be done over $(0,1)$ with various combinations of endpoints.

*Now note that the difference between $[0,1]$ and $[0,1)$ is only one point. Use the facts that $[0,1)$ has a countably infinite subset, and that $\mathbb N$ and $\mathbb N\setminus\{0\}$ have a bijection between them, to find a bijection between the two intervals.

*Repeat for other endpoints combination.
