If $f:X\to Y$ is nullhomotopic, then any composition, with $g:Y\to Z$, has that $g\circ f$ is nullhomotopic.
Proof:
- if $f:X\to Y$ is nullhomotopic, then there is a homotopy $f_s:X\to Y$ where $f_0=f$ and $f_1=c_y$, where $c_y(x)=y$ for all $x\in X$ and $y\in Y$.
- If $f\cong c_y$, then $g\circ f\cong g\circ c_y$.
- $g\circ c_y(x)=g(y)$ for every $x\in X$, so that $g\circ f\cong c_{g(y)}$
Is this ok?
Looks fine. Another approach: a map is nullhomotopic if and only if it factors through a contractible space. If f factors, then so does gf.