Theorem. Assume that Y is an arbitrary topological space
and X is a contractible
topological space. Then all maps f:X→Y are homotopic
if and only if Y is path connected.
Proof: Assume that all maps are homotopic. In particular constant maps are homotopic, so if y1,y2∈Y, then there exists a continous map H:I×Y→Y such that H(0,y)=y1 and H(1,y)=y2 for all y∈Y. Thus the map α:I→Y defined by the formula

α(t)=H(t,y0) for a fixed y0∈Y is the wanted path.
On the other hand assume that Y is path connected. Since X is contractible, then for any c∈X there exists a continous homotopy
H:I×X→X connecting the identity map and a constant map c. Let f:X→Y be an arbitrary map. Define a map F:I×X→Y by the formula: F(t,x)=f(H(t,x)). This map is a homotopy from f to a constant map f(c). Thus every map is homotopic to some constant map.
The space Y is path connected, so for all y1,y2∈Y there exists a path α:I→Y from y1 to y2. Therefore constant maps are homotopic via the homotopy H(t,x)=α(t).
Finaly for any continous maps f,g:X→Y and any point c∈X we get:
which completes





the proof. □
Corollary. If X is a contractible space, then for any topological space Y there exists a bijection between the set [X,Y] of homotopy classes of maps from X to Y and the set π0(Y) of path components of Y.
Proof: Assume that Y=⋃Yi, where Yi are path components of Y. It is well known that contractible spaces are path connected, thus the image of any continous map f:X→Y is contained in Yi for some i. It follows from the theorem that two maps from X to Y are homotopic if and only if their images are contained in the same Yi. Thus we have a well defined, injective map
where i is such that f(X)⊆Yi. This map is also surjective
, since for any i there exists y∈Yi, so the class of the constant map f(x)=y is mapped into Yi. □