Homotopy composition Hatcher exercise Show that composition of paths satisfies the following cancellation property: if $f_0 \cdot g_0 \simeq f_1 \cdot g_1 $ and $g_0 \simeq g_1$, then $f_0 \simeq f_1$. 

So I have two homotopies. 

So say $g_0,g_1: X \rightarrow Y$ and $f_0,f_1:Y \rightarrow Z$.

Then we know that $G:X \times I \rightarrow Z$ s.t. $G(x,0)=f_0 \cdot g_0(x)$ and $G(x,1)=f_1 \cdot g_1 (x)$. Also, $H:X \times I \rightarrow Y$ s.t. $H(x,0)=g_0(x)$ and $H(x,1)=g_1(x)$. 

I was wondering how do you construct the homotopy for f? or is there a simplier way. 

I would think you construct a homotopy, but can't see how to.
It helps if you first show that inverses of homotopic paths are homotopic, which is relatively easy to do from the definitions.  That is, show that if $f_1 \simeq f_2$, then $\bar{f_1} \simeq \bar{f_2}$.  Once you have that, start with $f_0 \simeq f_0 \cdot (g_0 \cdot \bar{g_0}) \simeq (f_0 \cdot g_0) \cdot \bar{g_0}$, and notice that there's a nice copy of $f_0 \cdot g_0$ in there.
Since $f \cdot g(s) = f(2s){\kern 1pt} {\kern 1pt} {\kern 1pt} for{\kern 1pt} 0 \le s \le \frac{1}{2}{\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} ;g(2s - 1){\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} for{\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} \frac{1}{2} \le s \le 1
$ and $G$ is a homotopy between $f_0 \cdot g_0
$and $f_1 \cdot g_1$.we could find a homotopy $F$ between $f_0$ and $f_1$ by $F(s)=G(1/2 s)$