Showing two spaces are not homotopy equivalent I just started learning algebraic topology about 1 week ago. Today, eager to test what I've learned I tried the following exercise from Rotman's Algebraic Topology :


Let $X = \{0\} \cup \{1,1/2,1/3,\ldots,1/n,\ldots\}$, while let $Y$ be countable set with the discrete topology on it. Prove that $X$ and $Y$ are not of the same homotopy type.


Now the hint given in Rotman is to use the compactness of $X$. Although he does not state explicitly which topology is on $X$, I am guessing it is the subspace topology inherited from the usual Euclidean topology on $\Bbb{R}$. Otherwise if we put something else like say the discrete topology on $X$, it is clear that $X$ is not compact.
Now what I have done is the following: Suppose for a contradiction that $X$ is of the same homotopy type as $Y$. Then there is a continuous function $f : X \rightarrow Y$ and a continuous function $g : Y \rightarrow X$ such that 
$$g \circ f \simeq \textrm{id}_X, \hspace{3mm} f \circ g \simeq \textrm{id}_Y$$
where $\simeq$ means "is homotopic to". Now $f(0) = b$ for some $b \in Y$. Because $Y$ has the discrete topology, $\{b\}$ is open in $Y$ and so by continuity of $f$ the fibre $f^{-1}(\{b\})$ is an open set that contains the point $0$. Since the sequence $x_n = \{\frac{1}{n}\}$ converges to $0$, all but finitely many terms of $x_n$ are in $f^{-1}(\{b\})$. In other words, all but finitely elements of $X$ get mapped to the same $b$ under $f$. 
This also means that $g \circ f$ maps all of $X$ to finitely many points of $Y$. I think I want this to contradict $g \circ f \simeq \textrm{id}_X$, but how do I get the desired contradiction?
Please don't give it all away. Thanks.
 A: You've shown that $f$, and hence $f \circ g$, has finite image. Can we use this fact alone to show what we want? Let $H\colon Y \times [0, 1] \to Y$ be a homotopy starting at $f \circ g$. Then for each $y \in Y$ the set $H(\{y\} \times [0, 1])$ is connected. What are the connected subsets of $Y$?
A: Compactness of $X$ isn't actually needed here. This also follows from the fact that $X$ and $Y$ are both totally path-disconnected. That is, if the path-components are one-point sets.
Suppose $T$ is a topological space, and $h, k:T \to T$ are homotopic. Then for any $x \in T$, the homotopy gives us a path from $h(x)$ to $k(x)$, which must therefore be in the same path-component. So if the path-components are one-point sets, then we must have $h(x)=k(x)$ for all $x$.
Applying this to our example, we see that $X$ and $Y$ are both totally path-disconnected. Thus we have $gf=\textrm{id}_X$ and $fg=\textrm{id}_Y$, i.e. $f$ and $g$ are mutually inverse homeomorphisms. But $X$ and $Y$ are not homeomorphic, so we have our desired contradiction.
