# $X,Y$ are homotopy equivalent, so the number of connected component in $X$ and $Y$ is equal

$(X,\mathcal{T}),(Y,\mathcal{O})$ are homotopy equivalent, denote the homotopy equivalent functions by $f$ and $g$ ($f\circ g\simeq Id_Y, g\circ f\simeq Id_X$). from $f,g$ continuity , taking a connected component $[x]$ (A maximal connected subset of $X$) we get $f([x])$ is connected in $Y$, $g(f([x]))$ is connected in $X$.

I was trying to show that $f([x])$ must be c connected component in Y, an another approach was assuming $[x_1],[x_2]$ are mapped by $f$ to $[y]$, means $f([x_1]\uplus [x_2])\subset[y]$ and then I tried to work with the Homotopy $F:X\times I\rightarrow X$ between $f\circ g$ to $Id_X$ , yet I didn't succeed in getting a contradiction.

Suppose that $gf\overset{H}{\simeq}\mathrm{id}_X$, where $H\colon X\times I\to X$ is continuous satisfying $H(\cdot,0)=gf$ and $H(\cdot,1)=\mathrm{id}_X$. Note that if $Z$ is a connected component of $X$, then $Z\times I$ is connected, from which it follows that $H(Z\times I)$ is contained in some component of $X$. However $H(Z\times\{1\})=\mathrm{id}_X(Z)=Z$ and this shows that $gf(Z)=H(Z\times\{0\})\subset Z$. Analogous argument also applies to $fg$. Then it can be seen that $f$ induces a bijection between the sets of connected components of $X$ and of $Y$.