Homotopy equivalence of a space with the sphere

Recall the following proposition (see Hatcher, Algebraic Topology, Proposition 0.18).

Proposition. Let $X$ be a topological space, let $Y$ be a CW complex, and let $A$ be a subcomplex of $Y$. If $f,g\colon A\to X$ are homotopic maps, then $X \cup_f Y$ and $X \cup_g Y$ are homotopy equivalent.

In this case, we can use this proposition twice to prove the desired homotopy equivalence. The space we are given is $$ (S^1 \cup_2 D^2)\cup_3 D^2, $$ where the subscript denotes the degree of the attaching map. By the above proposition, this is homotopy equivalent to $$ (S^1 \cup_2 D^2)\cup_1 D^2 $$ since $\pi_1(S^1 \cup_2 D^2) \cong \mathbb{Z}/2\mathbb{Z}$. But this is the same as $$ (S^1 \cup_1 D^2) \cup_2 D^2 $$ which by the above proposition is homotopy equivalent to $$ (S^1 \cup_1 D^2) \cup_1 D^2 $$ which is the sphere.


Too long for a comment, the answer of Jim is beautiful and clear and deserves the bounty. I'm adding a little bit of details for the OP.

The attaching map of $D^2 \to (S^1\cup_2 D^2)$ which is winding $3$ times, is an element of $\pi_1(S^1\cup_2 D^2)$ by definition.

Now it's only a matter to understand which element is a representative of: using Seifert Van Kampen you realise that (under the identification $S^1\cup_2 D^2\cong \mathbb{R}P^2$) the fundamental group is generated by the map $Id\colon S^1\to S^1$ which is winding $1$ times, and under the identification $\pi_1(S^1\cup_2 D^2)\cong \mathbb{Z}_2$, this map represents clearly the class $[1]$. In general this reasoning shows that the map "winding $k$-times represents the element $[k]$. Notice that $[1]=[3]$ in $\mathbb{Z}_2$ and therefore winding $1$ time is homotopic to winding $3$ times. Then use the result cited by Jim Belk in his answer to conclude.


Denote $2$-cells of $X$ by $D_1$ and $D_2$. There are glueing maps $\partial D_1\to S^1,z\mapsto z^2$ and $\partial D_2\to S^1,z\mapsto z^3$.

Consider the cellular decomposition of $S^2$ with two $2$-cells $D_1'$ and $D_2'$. $ $ Let $f_1:{D_1'}\to D_1$ be $z\mapsto z^3$, and $f_2:{D_2'}\to D_2$ be $z\mapsto z^2$. As it easy to see, the restrictions of $f_1$ and $f_2$ to the equator coincide, so we have well-defined map $f:S^2\to X$. This map is homology equivalence and $X$ is $1$-connected, therefore $f$ is a homotopy equivalence.