Homology of a space obtained from $S^n$ by attaching a cell $e^{n+1}$ by a map of degree $m$ I am trying to understand how to use cellular homology on this simple example: let $X$ be a space obtained from $S^n$ by attaching a cell $e^{n+1}$ by a map of degree $m$. I understand that the generators of the group $H_k(X^{(k)},X^{(k-1)})$ are in one-to-one correspondence with the $k$-cells of $X$, and I am supposing the CW structure of $S^n$ with 2 cells in each dimension. But how do I calculate the $Ker(d_k)$ and $Im(d_k)$, where $d_k$ are the boundary maps in the cellular chain complex? I know about the cellular boundary map formula, but I understand how it works on this example.
 A: Chain complex for an easier CW structure.
Well, first it is easier to compute the homology if you use the CW structure on $S^n$ having one $n$-cell and one $0$-cell. The cellular chain complex just looks like $$\mathbb{Z}\to0\to\cdots\to0\to\mathbb{Z}$$ or if $n=1$, then $\mathbb{Z} \overset{0}\to\mathbb{Z}$.
Then if you adjoin one more cell via a degree $m$ map, by definition this gives you a cellular chain complex $$\mathbb{Z} \overset{m}\to\mathbb{Z}\to0\cdots\to0\to\mathbb{Z}.$$ Following the instructions for the cellular boundary formula, as on page 140 of Hatcher, there is really no work to do here since in this case the complement of our cell in dimension $n$ is already just a point.
Chain complex for the CW structure having two cells in each dimension.
If you are really set on using the CW structure with two cells in each dimension, it takes a little more work to find the cellular chain complex for $S^n$. Also there is some amibiguity here in that there is more than one CW structure with two cells in each dimension that produces $S^n$. Of course the chain complexes will all be quasi-isomorphic, but if you do it in an organized way then you will get $$\mathbb{Z}^2 \overset{d_n}\longrightarrow \mathbb{Z}^2 \overset{d_{n-1}}\longrightarrow \cdots \overset{d_1}\longrightarrow\mathbb{Z}^2$$
where each of the $d_i$ are just given by the matrix $\begin{pmatrix}1&-1\\1&-1\end{pmatrix}$. I will describe how to do this below. Once you see this, then attaching the $n+1$ cell via a degree $m$ map should give you
$$\mathbb{Z} \overset{\begin{pmatrix}m\\ m\end{pmatrix}}\longrightarrow\mathbb{Z}^2 \overset{d_n}\longrightarrow \mathbb{Z}^2 \overset{d_{n-1}}\longrightarrow \cdots \overset{d_1}\longrightarrow\mathbb{Z}^2.$$
Computing $d_{n+1}$ with the cellular boundary formula.
To compute that $d_{n+1}$ is as above using the cellular boundary formula, consider the two $n$-cells in $S^n$, one for each hemisphere. The coefficient of $d_{n+1}(e^{n+1})$ on the top hemisphere is obtained by crushing the lower hemisphere and checking the degree of the map $$\partial D^{n+1} \to S^n \overset{\text{crush}}\longrightarrow S^n.$$ By the local degree theorem, this only depends on the size of the preimage at a suitable point - but this is the same as for the original map since all we did was crush the lower hemisphere. So the degree of this map is still $m$. The same logic applies to the coefficient on the cell for the lower hemisphere. 
Seeing that $d_i = \begin{pmatrix}1&-1\\1&-1\end{pmatrix}$.
Label the cells in dimension $k$ by $e^k$ and $f^k$, which will be the correct ordered basis for the matrices above. Here is how to define attaching maps so that all chain maps are given by the matrix above.
Consider the $k$-skeleton $S^k$ inside of the plane $\mathbb{R}^{k+1}$ in $\mathbb{R}^{k+2}$ (you should probably take $k=1$ for visualization purposes).
Above $S^k$ in $\mathbb{R}^{k+2}$ is the top hemisphere of $S^{k+1}$ which is isomorphic to $D^{k+1}$ via the projection map. The attaching map is the identity, so as above we have that $d_{k+1}(e_{k+1}) = e_k + f_k$. The lower hemisphere of $S^{k+1}$ is isomorphic to $D^{k+1}$ as well, but the orientation of the boundary is the opposite, relative to $S^k$. To see this, note that the attaching map is the same identifying $e^k$ with the upper hemisphere, reflecting through $\mathbb{R}^{k+1}$, then attaching along the identity map. So, the cellular boundary formula tells you $d_{k+1}(f_{k+1}) = -e_k - f_k$.
