# If $S^1 \hookrightarrow X$ induces an injection of $H_1$, then $X$ retracts onto $S^1$

This is an exercise in Hatcher, section 4.3, exercise 3, page 419, on which I'm struggling.

Suppose that a CW complex X contains a subcomplex $S^1$ such that the inclusion $S^1 \hookrightarrow X$ induces an injection $H_1(S^1;\mathbb Z) \to H_1(X; \mathbb Z)$ with image a direct summand of $H_1(X;\mathbb Z)$. Show that $S^1$ is a retract of $X$.

I've been trying to use obstruction theory to solve this, but I'm stuck. Showing that $S^1$ is a retract is equivalent to showing there is a map $r : X \to S^1$ extending the identity $id : S^1 \to S^1$. By obstruction theory ($S^1$ is an abelian space, we can assume $X$ is connected), we need to consider groups of the form $H^n(X, S^1; \pi_{n-1}(S^1))$. The only nonzero such group is $H^2(X, S^1)$ (with integer coefficients).

Let $H_1(X) = H_1(S^1) \oplus M$. The long exact sequence in homology gives an exact sequence:

$0 \to H_2(X) \to H_2(X, S^1) \to H_1(S^1) \to H_1(X) \to H_1(X, S^1) \to 0$

Thanks to the hypothesis on $H_1$, we therefore have that $H_2(X) \simeq H_2(X, S^1)$ and $H_1(X, S^1) \simeq M$. By universal coefficients:

\begin{align} H^2(X, S^1) & \simeq \mathrm{Hom}(H_2(X,S^1), \mathbb Z) \oplus \mathrm{Ext}(H_1(X,S^1), \mathbb Z) \\ & \simeq \mathrm{Hom}(H_2(X), \mathbb Z) \oplus \mathrm{Ext}(M, \mathbb Z) \oplus \mathrm{Ext}(\mathbb Z, \mathbb Z)\\ & \simeq \mathrm{Hom}(H_2(X), \mathbb Z) \oplus \mathrm{Ext}(H_1(X), \mathbb Z) \\ & \simeq H^2(X) \end{align}

And this is where I'm stuck. There's an obstruction $\omega_2(id) \in H^2(X, S^1; \pi_1(S^1)) \simeq H^2(X)$, and I'd like to show that it's zero, but I don't know how. Could you give me some insight?

EDIT: Sorry, I forgot the initial step of the argument. Your calculation shows that the map $H^2(X,S^1;\pi_1 S^1) \to H^2(X;\pi_1 S^1)$ is an isomorphism. This means that the obstruction cocycle for constructing a map extending the one on $S^1$ is zero precisely when the obstruction cocycle for an unconstrained map, and it suffices to show that the latter is always zero.
Roughly, this particular obstruction is always zero, because this obstruction cocycle only depends on an existing choice of map from the $0$-skeleton.
More in detail. Obstruction cocycles answer particular questions. Given a map from the $s$-skeleton of $X$ to $Y$, we have such an obstruction cocycle measuring whether it's possible (given a current choice of map on the $(s-1)$-skeleton) to make some choice of maps on the $s$-cells to get a map which can be extended to the $(s+1)$-skeleton. This is the obstruction that lives in $H^{s+1}(X, \pi_s Y)$, roughly because it's asking about whether the attaching maps for the $(s+1)$-cells can be made nullhomotopic in $Y$.
In your case, $s=1$. You can take whatever map $X^{(0)} \to S^1$ that you are given and lift it up to a map $X^{(0)} \to \mathbb{R}$, and all such maps automatically have an extension to a map $X^{(2)} \to \mathbb{R} \to S^1$.
This pattern continues for Eilenberg-Mac Lane spaces: the obstruction cocycle for a map $X \to K(G,n)$ depends only on a map from the $(n-1)$-skeleton, and all the maps from the $(n-1)$-skeleton to a $K(G,n)$ are nullhomotopic. The obstruction cocycle is then the same as that for a constant map. You only tend to get interesting obstructions when you've had the opportunity to make interesting choices on the lower skeleta.