Solution (source code)

= Solution

Choose a contraction
$$
h:A\times I\to A,
\qquad
h(a,0)=a,
\qquad
h(a,1)=a_0.
$$
Apply the <homotopy extension property> to the initial map $\operatorname{id}_X:X\to X$ and to $h$, regarded as a homotopy into $X$. It supplies
$$
H:X\times I\to X
$$
such that
$$
H(x,0)=x,
\qquad
H(a,t)=h(a,t).
$$

At $t=1$, the map $H_1$ sends every point of $A$ to $a_0$. It is therefore constant on the equivalence classes of the <quotient topology> $X/A$. By the <universal property of the quotient topology>, there is a continuous map
$$
g:X/A\to X
$$
such that
$$
g\circ q=H_1,
$$
where $q:X\to X/A$ is the <quotient map>. The homotopy $H$ immediately gives
$$
g\circ q=H_1\simeq H_0=\operatorname{id}_X.
$$

For every $t$, the map $q\circ H_t$ is constant on $A$, because $H(a,t)=h(a,t)\in A$. It therefore descends to
$$
\overline H:(X/A)\times I\to X/A,
\qquad
\overline H([x],t)=q(H(x,t)).
$$
This descended map is continuous: the product $q\times\operatorname{id}_I$ is a quotient map because $I$ is compact Hausdorff, and $q\circ H$ is constant on its fibres.
At the endpoints,
$$
\overline H([x],0)=[x],
\qquad
\overline H([x],1)=q(g([x])).
$$
Thus
$$
q\circ g\simeq\operatorname{id}_{X/A}.
$$
The maps $q$ and $g$ are homotopy inverses, so
$$
\boxed{X\simeq X/A}.
$$
This proves the theorem on <collapsing a contractible cofibration>.