I'm reading Hatcher and I did exercise 10 on page 19. Can you tell me if my answer is correct? Many thanks for your help!
Claim: $X$ contractible $\Leftrightarrow \forall$ arbitrary maps $f:X \rightarrow Y$, $Y$ arbitrary, $f \cong const.$
Proof:
$\implies$
Given the homotopy $H: I \times X \rightarrow X$, $H(0,x) = id_X$, $H(1,x) = id_{ \{ \ast \}}$ and an arbitrary map f: X \rightarrow Y construct a homotopy $H^\prime: I \times X \rightarrow Y$, $H^\prime(0,x) = f(x)$, $H^\prime(1,x)=const_{y_0 \in Y}$ as follows:
$H^\prime (t,x) := f(H(t,x))$.
Note that even though not stated in the exercise, $f$ is assumed to be continuous. (At least I think that's the case)
$\impliedby$
Given $\forall f:X \rightarrow Y$: $f \cong const.$ we pick $Y := X$ then $f:X \rightarrow X$ $\cong const_{x_0} \forall f$. Now pick $f := id_X$.
Second part of question:
Claim: $X$ contractible $\iff \forall f: Y \rightarrow X$: $f \cong const_X$
Proof:
$\implies$
Define $H^\prime(t,x) := H(t, f(x))$.
$\impliedby$
Choose $Y:=X$ and $f:=id_X$.