What are the difference of the two following definitions of homotopy equivalence and homoemoprhism?

Definition 1 Let $X$ and $Y$ be topological spaces. $X$ and $Y$ are of the same homotopy type, written as $X\simeq Y,$ if there exists continous maps $f:X\rightarrow Y$ and $g:Y\rightarrow X$ such that $f\circ g\sim \operatorname{id}_Y$ and $g\circ f\sim \operatorname{id}_X$.

Definition 2 Let $X$ and $Y$ be topological spaces. A map $f:X\rightarrow Y$ is a homoeomorphism if it is continuous and has an inverse $f^{-1}:Y\rightarrow X$ which is also continuous.

What is difference between these two definitions because it look like they are the same thing. $g$ in the first definition and $f^{-1}$ in the second definition looks like the same thing.

• Well, $f^{-1} \circ f$ is the identity, but $g \circ f$ is homotopic to the identity. There is a clear difference in the two definitions : infact, it is also clear that being of the same homotopy type is (strictly) weaker than being homeomorphic. – астон вілла олоф мэллбэрг Feb 19 '18 at 12:19
• @астонвіллаолофмэллбэрг. A simple example please. – William Elliot Feb 19 '18 at 20:30
• An interval, say on the real line, is homotopy equivalent to the a single point, because you can consider the function $f$ to be constant i.e. taking the entire interval to the point, and $g$ taking the single point to anywhere on the interval, then $f \circ g$ is the identity on $Y$, and $g \circ f$ is a constant function on the interval, which is homotopic to the identity map via a stretching. Of course, any interval is not homeomorphic to a single point, because they have different cardinalities. – астон вілла олоф мэллбэрг Feb 19 '18 at 23:12