# Do these conditions imply homotopy equivalence?

Suppose we have maps $f:Z\leftrightarrows X:g$ both of which are $\pi_*$ isomorphisms and satisfy $f\circ g \simeq \operatorname{id}_X$. Suppose also that $Z$ is a CW complex.

Question: Do the maps form a homotopy equivalence?

The composition $f\circ g$ is homotopic to identity map of $X$ (because it already identity).
Note that $\pi_*(f)=\pi_*(g)^{-1}$, therefore $\pi_*(g\circ f)=\mathrm{Id}_{\pi_*(Z)}$. So $g\circ f$ is homotopic to $\mathrm{Id}_Z$ (using the fact that $Z$ is $CW$-complex).
• But why is $g\circ f$ homotopic to the identity? – iwriteonbananas Oct 8 '16 at 18:24
• @iwriteonbananas because of it is weak equivalence, and $Z$ is a $CW$-complex – Andrey Ryabichev Oct 8 '16 at 18:39
• Sorry, I don't understand. That implies that $g\circ f$ is a homotopy equivalence but why is it homotopic to the identity? – iwriteonbananas Oct 8 '16 at 18:43
• Since $g\circ f$ is a homotopy equivalence, it has an inverse $h$. Thus, $h\circ g\circ f \simeq 1_Z$. So, $h\circ g \simeq h\circ g\circ f \circ g \simeq g$. Finally, we obtain $g\circ f \simeq h\circ g \circ f \simeq 1_Z$. – Justin Young Oct 9 '16 at 13:25