# Homotopic maps and attaching spaces

Let $$f, g : \mathbb{S}^{n-1} \to X$$ be two continuous maps from the sphere into a compact and Hausdorff space $$X$$. I want to show that if $$f$$ and $$g$$ are homotopic, then attaching an $$n$$-cell to $$X$$ via $$f$$ or via $$g$$ yields spaces with the same homotopy type: $$D^n \cup_f X \cong D^n \cup_g X$$.

This has been answered in this post, but I didn't completely understand the answer. So I would like some help in the following steps:

I know that there is a deformation retraction $$r : (D^n \times I) \to (D^n \times \{0\}) \cup (\mathbb{S}^{n-1} \times I)$$, where $$I = [0,1]$$. Let $$H : \mathbb{S}^{n-1} \times I \to X$$ be a homotopy between $$f$$ and $$g$$ and let $$\pi : (D^n \times I) \,\dot{\cup} \, X \to (D^n \times I) \cup_H X$$ and $$\rho : ((D^n \times \{0\}) \cup (\mathbb{S}^{n-1} \times I)) \, \dot{\cup} \, X \to ((D^n \times \{0\}) \cup (\mathbb{S}^{n-1} \times I)) \cup_H X$$

be the projection maps.

1. How do I show that $$r$$ descends to the quotient to a deformation retraction $$R : (D^n \times I) \cup_H X \to ((D^n \times \{0\}) \cup (\mathbb{S}^{n-1} \times I)) \cup_H X \,\,?$$

2. How do I show that $$((D^n \times \{0\}) \cup (\mathbb{S}^{n-1} \times I)) \cup_H X$$ is homeomorphic to $$D^n \cup_f X \,\, ?$$

PS.: I know nothing about cofibrations.

1. Let $$B \subset Y \subset Z$$ with inclusion $$i : Y \to Z$$ and let $$r : Z \to Y$$ be a strong deformation retraction. Let $$f : B \to X$$ be a map. Then we get the two adjunction spaces $$Y \cup_f X$$ and $$Z \cup_f X$$ which are quotients of $$Z \dot{\cup} X$$ and $$YZ \dot{\cup} X$$ with respct to the equivalence relation $$\sim$$ generated by $$b \sim f(b)$$ for $$b \in B$$. The map $$r \dot{\cup} id : Z \dot{\cup} X \to Y \dot{\cup} X$$ respects $$\sim$$ and thus induces a map $$r' : Z \cup_f X \to Y \cup_f X$$ which is obviuously a retraction. A similar argument shows that a deformation $$D : Z \times I \to Z$$, $$d : id \simeq ir$$ rel. $$Y$$ induces a deformation $$D' : (Z \cup_f X) \times I \to Z \cup_f X$$, $$D' : id \simeq i'r'$$. This is true because if $$p$$ is quotient map, then so is $$p \times id_I$$.
2. Define $$\iota : D^n \to D^n \times \{ 0\}\ \cup S^{n-1} \times I, \iota(x) = (x,0)$$. The map $$\iota \dot{\cup} id$$ respects $$\sim$$ and thus induces a map $$\iota' : D^n \cup_f X \to (D^n \times \{ 0\}\ \cup S^{n-1} \times I) \cup_H X$$. It is a bijection because is the identity on $$X$$ and maps $$\mathring{D}^n \subset D^n \cup_f X$$ homeomophically onto $$\mathring{D}^n \times \{ 0\} \subset (D^n \times \{ 0\}\ \cup S^{n-1} \times I) \cup_H X$$. It is easy to see that $$\iota'$$ is a closed map, hence a homeomorphism.