$A$ retract of $X$ and $X$ contractible implies $A$ contractible. I have constructed the following proof of the statement and have some questions (a question) about the correctness of the proof:
Statement:

$A$ retract of $X$ and $X$ contractible implies $A$ contractible.


Proof:
I make the following observations:


*

*Since $X$ is contractible we have $1_{X} \simeq constant $. This follows from a proposition that a space $X$ is contractible if and only if $1_{X}$ is nullhomotopic.

*$A$ retract of $X$ gives us that there exists a map $r: X \rightarrow A$ such that $r\circ i = 1_{A}$ where $i:A\rightarrow X$ is the inclusion map.


Now I conclude:
$1_{A} = r\circ i = r \circ 1_{X} \circ i \simeq r \circ constant \circ i$
Since $r \circ constant \circ i$ is a constant map we have that $1_{A}$ is nullhomotopic and thus we have $A$ is contractible.

Questions:


*

*Is this proof correct? 

*I use that $f \simeq f_{1}$ implies $g \circ f \simeq g\circ f_{1}$. Is this true? I think it makes sense. 

 A: When you write $r\circ 1_X\circ i\simeq r\circ \text{constant}\circ i,$ then you implicitely mean that the homotopy is $r\circ F\circ(i\times 1_I),$ so your proof is correct.
In general, if $f_1\simeq f_2$ by $F$ then $g\circ f_1\simeq g\circ f_2$ by $g\circ F,$ and $f_1\circ h\simeq f_2\circ h$ by $F\circ(h\times 1_I).$
A: Here is an alternative proof, demanding some familiarity with categories. 
The contractible objects in category $\mathbf{Top}$ are exactly the
terminal objects in category $\mathbf{hTop}$. If $X$ is a terminal object in $\mathbf{hTop}$, then for every object $Y$ the 
homset $\mathbf{hTop}\left(Y,X\right)$ contains exactly one arrow.
Let us denote this arrow by $\left[c\right]$. Then homset $\mathbf{hTop}\left(Y,A\right)$
contains arrow $\left[r\right]\left[c\right]$. Now let $\left[f\right]\in\mathbf{hTop}\left(Y,A\right)$.
Then $\left[i\right]\left[f\right]\in\mathbf{hTop}\left(Y,X\right)$
so $\left[i\right]\left[f\right]=\left[c\right]$. Then we find $\left[f\right]=\left[r\right]\left[i\right]\left[f\right]=\left[r\right]\left[c\right]$
demonstrating that $\left[r\right]\left[c\right]$ is the only element
of $\mathbf{hTop}\left(Y,A\right)$. Proved is now that $A$ is terminal
in $\mathbf{hTop}$, hence contractible in $\mathbf{Top}$.
In my view this proof is a good demonstration of 'the joy of cats'.

Later: A bit shorter:
$\left[\right]:\mathbf{Top}\rightarrow\mathbf{hTop}$ is a functor
and functors respect retractions (=arrows that have a right-inverse). So if $r:X\rightarrow A$ is a retraction
in $\mathbf{Top}$ then $\left[r\right]:X\rightarrow A$ is a retraction
in $\mathbf{hTop}$.
If $\left[r\right]:X\rightarrow A$ is a retraction and
$X$ is terminal then $\left[r\right]$ is an isomorphism, hence $A$
is terminal. (This is true in every category, but to maintain the line of the proof I keep on using the notation $\left[r\right]$.)
(Proof: some $\left[s\right]:A\rightarrow X$ exists with $\left[r\right]\left[s\right]=1$;
then $\left[s\right]\left[r\right]:X\rightarrow X$ and the identity
is the only endomorphism here, so $\left[s\right]\left[r\right]=1$.)
