# Given a group $G$, the existence of a space such that $\pi_1(X)\simeq G$.

I'm having trouble understanding Corollary 1.28 of Hatcher which proves that for every group $G$ there is a space $X_G$ such that $\pi_1(X_G)=G$.

Since $G$ is the quotient of a free group $F$, we have some map $\varphi\colon F\to G$ with kernel $K$. Let $g_\alpha$ be the generators of $F$, and $r_\beta$ the generators of $K$. He gets $G=\langle g_\alpha\mid r_\beta\rangle$ is a presentation of the group. I follows this so far.

Then the construction follows by attaching $2$-cells $e_\beta^2$ to the wedge $\bigvee_\alpha S^1_\alpha$ by the words specified by $r_\beta$. I don't get why attaching the $2$-cells in this ways makes things work out.

There is a proposition on the preceding page that says the inclusion $X\to Y$ induces a surjection $\pi_1(X,x_0)\to\pi_1(Y,x_0)$ with kernel the space generated by all loops $\gamma_\alpha\varphi_\alpha\gamma_\alpha^{-1}$ for varying $\alpha$, where $\gamma_\alpha$ is a path from $x_0$ to $\varphi_\alpha(s_0)$ for each attaching map $\varphi_\alpha$ of $e_\alpha^2$.

So I assume the specific case here is that the inclusion $\bigvee_\alpha S^1_\alpha\to X_G$ leads to an isomorphism $\pi_1(X_G)\simeq\pi_1(\bigvee S^1_\alpha)/N$. I know $\pi_1(\bigvee S^1_\alpha)\simeq F$, but I can't see why the $N$ generated by the loops should be the same as $K$ generated by the words to get the desired isomorphism.

The subgroup $K < F$ is the kernel of $\phi$. Being a kernel, it's a normal subgroup. Its generators (as a subgroup) are the $r_\beta$.
In the definition of $X_G$, the $\phi_\beta$ are taken to be loops such that $[\phi_\beta] = r_\beta \in \pi_1(X, x_0)$. Therefore as you say $N$ is generated (as a subgroup) by all the $[\gamma] r_\beta [\gamma]^{-1}$. This group $N$ clearly contains $K$ (because for $\gamma$ a constant loop you get that $r_\beta \in N$, $\forall \beta$). On the other hand, $K$ is normal, so every $[\gamma] r_\beta [\gamma]^{-1}$ is actually also in $K$, and therefore $N \subset K$. Therefore, $N = K$.