# Contractions and Map Extensions

I'm going through Spanier and got stuck on the following problem:

Show that a space $Y$ is contractible if and only if given a pair $(X,A)$ having the homotopy extension property with respect to $Y$, any map $f:A\rightarrow Y$ can be extended over $X$.

The forward direction is pretty easy, but I'm having some trouble with the converse.

I was thinking about trying the contrapositive:

Suppose $Y$ is not contractible. Then there exists a map $f:Y\rightarrow Y$ that is not null-homotopic. Since the mapping cylinder $(M_f,Y)$ has the homotopy extension property maybe I could arrive at a contradiction if $f$ extends to $M_f$?

What if you use the mapping cone of $f$ instead of the mapping cylinder? (Also, you may as well take $f$ to be the identity.) – Dan Ramras Jun 30 '11 at 16:24
Ahh, of course! If $(C(Y),Y)$ has the homotopy extension property and $\mathrm{id}_Y$ extends to $C(Y)$ if and only if $Y$ is a retract of $C(Y)$, which happens if and only if $Y$ is contractible. – Brian Fitzpatrick Jun 30 '11 at 18:37