Contractible Spaces and Homotopic Maps I'm trying to prove the following statement, but I am stuck. 

Let $X$ and $Y$ be topological spaces. If one of them is a contractible space, then every continuous function from $X$ to $Y$ is homotopic to a constant map. 

Start of my solution: Assume, without loss of generality, that $X$ is a contractible space. Then the identity map $\mathrm{id}_{X}:X\to X$ is nullhomotopic such that $\mathrm{id}_{X}\simeq c$, where $c$ is some constant map. In other words, there exists a continuous function $F:X\times[0,1]\to X$ such that $F(x,0)=\mathrm{id}_{X}$ and $F(x,1)=c$. Let $f:X\to Y$ be a continuous function. Then....
That's where I'm stuck. I'm not sure how to show that any arbitrary continuous function is necessarily homotopic to a constant map. Thanks in advance for any help!
 A: To provide a bit of a wider context on ulo's answer, consider the following general situation.  Suppose $g,g':A\to B$ and $f,f':B\to C$ are maps with $g\simeq g'$ and $f\simeq f'$ via homotopies $H:A\times [0,1]\to B$ and $I:B\times[0,1]\to C$.  Then $f\circ g$ is homotopic to $f'\circ g'$, by just "composing" the two homotopies.  To be precise, you use the homotopy $J:A\times [0,1]\to C$ defined by $J(a,t)=I(H(a,t),t))$.
In your case, you can take $A=B=X$, $C=Y$, $g=\mathrm{id}_X$, $g'=c$, and $f=f'$ to be your arbitrary map $X\to Y$.  You get that $f\circ g=f\circ\mathrm{id}_X=f$ is homotopic to $f'\circ g'=f\circ c$, and $f\circ c$ is a constant map because $c$ is a constant map.
A: Let $g:X \to Y$ be the function $g(x)=f(c)$. Then $g$ and $f$ are homotopic using the function $G: X \times [0,1]  \to Y$ which is $G(x,r)= f(F(x,r))$. Then $G(x,0)=f$ and $G(x,1)=g(x)= f(c)$.
A: As Lee Mosher said in the comments, it makes a difference when you're assuming X is contractible or Y is contractible. Since ulo only addressed the former, I will address the latter (which is similar to the X contractible case).
Suppose $\text{id}_Y \stackrel{H}{\simeq} c$ where $H(y,0) = \text{id}_Y$, and $H(y,1) = c$. For every $f: X \rightarrow Y$, define $\tilde{H}(x,t)=H(f(x),t)$, then $\tilde{H}(x, 0) = f(x)$ and $\tilde{H}(x, 1) = c$, which means $f \stackrel{\tilde{H}}{\simeq} c$ and every map from $X$ to $Y$ is nullhomotopic.
