Homotopy connectedness

I am trying to prove the following statement:

Let $X,Y$ be two homotopy equivalent topological spaces. If $X$ is connected then $Y$ is connected.

So far, this is my attempt: If $X,Y$ are homotopy equivalent then exist a continuous function $f: X \rightarrow Y$ (homotopy equivalence). For the principal theorem of connectedness then $f(X)$ is connected in $Y$. Suppose $Y$ is not connected, then exists a separation (namely a couple of nonempty open sets $\{U,V \}$ of $Y$) such that $Y=U \cup V$ (disjoint union). $f(X)$ is connected in $Y$ means that $f(X) \subset U$ or $f(X) \subset V$. Now I want to use the fact that exist unique map called homotopy inverse $g:Y \rightarrow X$ such that $g \circ f \sim id_X$ (where $\sim$ stands for homotopy equivalent) and I want to find a contradiction, but nothing comes into my mind at the moment. Any hint? thank you in advance

• Think about the composition $fg \sim id_Y$ instead. What has to happen to the points you know exist in $U, V$ when you apply this homotopy? – Zach L. Apr 23 '16 at 13:38

So $f\circ g \equiv Id_Y$ i.e $H:Y\times I\to Y$ is a continuous map and $H(y,0)=f\circ g (y)$ and $H(y,1)=y$. $Img(f\circ g) \subset U$ (lets say). Then consider the path $\gamma (t)=H(v,t)$. This connect $U$ with a point in $V$. But $U,V$ are disjoint open sets so they cannot be connected by a path. (Contradiction).