TITLE: Existence of embeddings does not imply the existence of a homeomorphism
QUESTION [11 upvotes]: Suppose there exist embeddings $f:X\to Y$ and $g:Y\to X$. Show by means of an example that $X$ and $Y$ need not be homeomorphic.
I set $X=(0,1)$ and $Y=(0,\frac{1}{2})\cup (\frac{1}{2}, 1)$. 
I think $f:X\to Y$ defined by $f(x)=\frac{x}{2}$ is an embedding, correct? 
Also, clearly $g:Y\to X$ defined by $g(y)=y$ is an embedding. 
But as $X$ is connected and $Y$ is disconnected, there is no homeomorphism between them.
Is this okay?

REPLY [3 votes]: Here is another example, perhaps nicer:
Take $X=(0,1)$ and $Y=[0,1]$. Clearly the spaces are not homeomorphic because one is compact and the other is not; but the map $x\mapsto\frac{1+x}4$ is an imbedding from $X$ into $Y$ and from $Y$ into $X$.