# A problem about homotopy equivalence in Hatcher's book

In reading the proof of corollary 0.21 of Hatcher's algebraic toplology. I can not understand how the existence of homotopy equivalence $f:X\rightarrow Y$ implies that the inclusion $X\rightarrow M_f$ is a homotopy equivalence, where $M_f$ is a mapping cylinder. Clearly, $X$ is homotopy equivalent to $M_f$ by the map $if$, where $i: Y\rightarrow M_f$ is an inclusion.

It is because of the "2-out-of-3" property of homotopy equivalences: If $f:X\to Y$ and $g:Y\to Z$ are maps, then if any two of the maps $f,g,gf$ are homotopy equivalences, so is the third map. Now for any map $f:X\to Y$ you have a factorization $$X\stackrel i \hookrightarrow M_f\stackrel r\to Y$$ where $i$ is the cofibration which sends $x$ to $(x,1)$, and $r$ is the map $$\begin{cases} r(x,t)=f(x), &\text{for } (x,t)\in X\times I \\ r(y)=y, &\text{for } y\in Y \end{cases}$$ Then $r$ is a deformation retraction. Since $f=ri$, the map $i$ must be a homotopy equivalence.
• I think the point I can not get through is the "2-out-of-3" property of homotopy equivalences. Why homotopy equivalence has this property? I don't know how to construct a homotopy inverse of $i$ from $f$ and $r$, for $r$ does not have a inverse in general. – Lewis Zhang Feb 1 '15 at 1:38
• @LewisZhang: In this case, $r$ has a homotopy inverse, the inclusion $s:Y\hookrightarrow M_f$. Since $f$ has a homotopy inverse $g$, can you use these homotopy inverses to show that $gr$ and $i$ are homotopy inverses to each other? – Stefan Hamcke Feb 1 '15 at 10:05
• I got it. Since $gri\simeq id_X$, $gr$ is the left homotopy inverse of $i$. Since $igr\simeq (sr)igr=s(ri)gr=s(fg)r\simeq$$sr\simeq id_{M_f}$, $gr$ is the right homotopy inverse of $i$. – Lewis Zhang Feb 1 '15 at 12:02