$X$ is a deformation retract of its mapping cylinder I am trying to show the following:

If $f : X \to Y$ is a homotopy equivalence and moreover a cellular map between finite CW-complexes, then $X$ is a deformation retract of $M_f$ via a cellular map. Here $M_f$ denotes the mapping cylinder of $f$.

To this end, we need to show that there exists a map $F : M_f \times I \to M_f$ such that $F(m,0)=m$, $F(x,1)=x$ and $F(m,1) \in X$, where $m \in M_f$ and $x \in X \subset M_f$ (for simplicity we identify $X \cong X \times \{1\} \subset M_f$).
So far, I have the following: we know that $f$ factors as
$$
f = q \circ j : X \hookrightarrow M_f \to Y,
$$
where $j$ is the canonical inclusion and $q$ is a homotopy equivalence, so in particular we get: there exists a map $p : Y \to M_f$ and a homotopy $H : M_f \times I \to M_f$ with $H_0 = \text{id}_{M_f}$ and $H_1 = p \circ q$.
Then I thought I could simply define $F(m,t) := H_t(m)$, since then it would already follow that
$$
F(m,0)=H_0(m)=\text{id}_{M_f}(m)=m \quad\text{and}\quad F(x,1)=H_1(x)=p(q(x))=p(f(x))=j(x)=x,
$$
where we used that $f=q\circ j$. However, for the last calculation we get $F(m,1) = H_1(m) = p(q(m))$, and we'd like to show that this lies in $X$, but I do not see how to do this.
My questions:

*

*Defining $F$ this way seemed promising. Am I on the right track?

*I am able to show that $j : X \hookrightarrow M_f$ is a cofibration. I read that because $f$ and $q$ are homotopy equivalences it follows that $j$ is a homotopy equivalence as well. Can we use this to show that $j$ is a deformation retract?

*I have not been able to include the fact that $f$ is a cellular map. How can I fix this?

Any hints on where I'm going wrong or how to save the proof are warmly appreciated!
 A: Your approach does not work. Indeed you must use fact that $f$ is a homotopy equivalence.
Note that we identify $X$ with the set $\{[x,1] \mid x \in X \} \subset M_f$ and $Y$ with the set $\{[y] \mid y \in Y \} \subset M_f$.
Under your assumptions the cellular approximation theorem implies that there exists a cellular $g :  Y \to X$ such that $g \circ f \simeq id_X$ and $f \circ g \simeq id_Y$ via cellular homotopies.

*

*$X$ is a retract of $M_f$ if $f$ has a left homotopy inverse (this is a map $g : Y \to X$ such that $g \circ f \simeq id_X$).
Let $L : X \times I \to X$ be a homotopy such that $L(x,0) =  (g \circ f)(x)$ and $L(x,1) = x$. Define
$$r : M_f \to X, r([x,t]) = [L(x,t),1], r([y]) = [g(y),1] .$$
This is a well-defined continuous map (check what happens if $[y] = [x,0]$ in $M_f$). Clearly it is a retraction. For the CW case we may assume that $g$ and $L$ are cellular. Then also $r$ is cellular.


*There exists a deformation of $M_f$ into $X$ (this is a homotopy $D : M_f \times I \to M_f$ such that $D(m,0) = m$ and $D(m,1) \in X$) if $f$ has a right homotopy inverse $g$.
$D$ is constructed in three steps:
a) Take the standard strong deformation retraction $\Phi :M_f \times I \to M_f$ beginning with the identity and ending with $i \circ q$, where $i : Y \to M_f$ is the canonical embedding and $q$ the canonical retraction.
b) Let $R : Y \times I \to Y$ be a homotopy such that  $R(y,0) = y$ and $R(y,1) = (f \circ g)(y)$. The homotopy $i \circ R \circ (q  \times id_I)$ begins with $i \circ q$ and ends with $i \circ f \circ g \circ q$.
c) Define $\Psi : Y \times I \to M_f, \Psi([y],t) = [g(y),t]$. Note that $\Psi([y],0)  = [g(y),0] = [(f \circ g)(y)]$. This homotopy shifts $Y$ into $X$. The homotopy $\Psi \circ (q \times id_I)$ begins with $i \circ f \circ g \circ q$ and ends with $j \circ g \circ q$.
d) Now $D$ is obtained by composing the above three homotopies. In the CW case we get again a cellular homotopy.


*We now prove that $X$ is a deformation retract of $M_f$. Take the retraction $r$ and the deformation $D$ from above. Define
$$\Delta : M_f \times I \to M_f, \Delta(m) = \begin{cases} D(m,2t) & t \le 1/2 \\ (j \circ r \circ D)(m,2-2t) & t \ge 1/2 \end{cases}$$
This homotopy deforms the identity on $M_f$ to $j \circ r$. It is cellular.
