Show that if $X$ is a pointed retract of $Y$, and $Y$ is a $H$-space, then $X$ is a $H$-space too. "Pointed retract of $Y$" means that the following diagram homotopy commutes for some continuous pointed maps $r$ and $s$.


Because $Y$ is a $H$-space, I know there is a map $m: Y\times Y\to Y$ such that $m$ composed with inclusion is homotopic to the identity. I suppose I need to show there is a similar map $n$ for $X\times X\to X$ too. My guess is that I form $n$ with $r$ and $s$ somehow, but I just can't see how to do that.
Any help is appreciated! Thanks in advance
 A: Couple of things before I explain the argument. I think you want that diagram to commute strictly, since a pointed retraction would usually mean a map $r:(Y,x_0)\to(X,x_0)$ such that pre-composing with the inclusion $s:(X,x_0)\hookrightarrow(Y,x_0)$ gives the identity: $r\circ s=id_X$. Of course correct me if you do only want that diagram to commute up to homotopy. Lastly, I think you need the homotopy identity $e\in Y$ to lie in $X$ as well.
As $Y$ is an H-space, you have a map $m_Y:Y\times Y\to Y$ and an element $e\in Y$ such that the restrictions:
$$m|_{Y\times\{e\}}:Y\to Y\quad\text{and}\quad m|_{\{e\}\times Y}:Y\to Y$$
are homotopic to the identity. Let $s:(X,x_0)\hookrightarrow (Y,x_0)$ be the basepoint preserving inclusion, and let $r:(Y,x_0)\to (X,x_0)$ be the guaranteed retraction, so that $r\circ s = id_X$. Define the map $m_X:X\times X\to X$ as the composition:
$$X\times X\xrightarrow{\ s\times s \ }Y\times Y\xrightarrow{\ m_Y \ }Y\xrightarrow{\ r \ }X.$$
Now, let $H:Y\times I\to Y$ be the homotopy giving
$$H(y,0) = id_Y\quad\text{and}\quad H(y,1) = m|_{Y\times\{e\}}(y).$$
Then, you can form the homotopy* $H':X\times I\to X$ given by the composition:
$$X\times I\xrightarrow{\ s\times id_I \ }Y\times I\xrightarrow{\ H \ }Y\xrightarrow{\ r \ }X.$$
I'll leave examining the properties of this homotopy as an exercise. Constructing the other homotopy is similar.
*Note that if $H$ is relative to $\{e\}$, then so is $H'$.
