\chapter{The long exact sequence}
\label{ch:long_exact_sequence}
In this chapter we introduce the key fact about chain complexes that will allow us to compute
the homology groups of any space: the so-called ``long exact sequence''.

For those that haven't read about abelian categories:
a sequence of morphisms of abelian groups
\[ \dots \to G_{n+1} \to G_n \to G_{n-1} \to \dots \]
is \vocab{exact} if the image of any arrow is equal to the kernel of the next arrow.
In particular,
\begin{itemize}
	\ii The map $0 \to A \to B$ is exact if and only if $A \to B$ is injective.
	\ii The map $A \to B \to 0$ is exact if and only if $A \to B$ is surjective.
\end{itemize}
(On that note: what do you call a chain complex whose homology groups are all trivial?)
A short exact sequence is one of the form $0 \to A \injto B \surjto C \to 0$.

\section{Short exact sequences and four examples}
\prototype{Relative sequence and Mayer-Vietoris sequence.}
Let $\AA = \catname{AbGrp}$.
Recall that we defined a morphism of chain complexes in $\AA$ already.
\begin{definition}
Suppose we have a map of chain complexes
\[ 0 \to A_\bullet \taking f B_\bullet \taking g C_\bullet \to 0 \]
It is said to be \vocab{short exact} if \emph{each row} of the diagram below is short exact.
\begin{center}
\begin{tikzcd}[column sep=huge]
	& \vdots \ar[d, "\partial_A"] & \vdots \ar[d, "\partial_B"] & \vdots \ar[d, "\partial_C"] & \\
	0 \ar[r]
		& A_{n+1} \ar[hook, r, "f_{n+1}"] \ar[d, "\partial_A"]
		& B_{n+1} \ar[r, surjective head, "g_{n+1}"] \ar[d, "\partial_B"]
		& C_{n+1} \ar[r] \ar[d, "\partial_C"]
		& 0 \\
	0 \ar[r]
		& A_n \ar[hook, r, "f_n"] \ar[d, "\partial_A"]
		& B_n \ar[r, surjective head, "g_n"] \ar[d, "\partial_B"]
		& C_n \ar[r] \ar[d, "\partial_C"]
		& 0 \\
	0 \ar[r]
		& A_{n-1} \ar[hook, r, "f_{n-1}"] \ar[d, "\partial_A"]
		& B_{n-1} \ar[r, surjective head, "g_{n-1}"] \ar[d, "\partial_B"]
		& C_{n-1} \ar[r] \ar[d, "\partial_C"]
		& 0 \\
	& \vdots & \vdots & \vdots
\end{tikzcd}
\end{center}
\end{definition}

\begin{moral}
	This basically means $C_\bullet = B_\bullet / A_\bullet$, for suitable definition of
	$/$ on chain complexes.
\end{moral}
This agrees with the definition in \Cref{sec:exact_sequences}.

\begin{example}
	[Mayer-Vietoris short exact sequence and its augmentation]
	\label{ex:mayer_short_exact}
	Let $X = U \cup V$ be an open cover.
	For each $n$ consider
	\begin{center}
	\begin{tikzcd}[row sep=tiny]
		C_n(U \cap V) \ar[r, hook] & C_n(U) \oplus C_n(V) \ar[r, surjective head] & C_n(U + V) \\
		c \ar[r, mapsto] & (c, -c) \\
		& (c, d) \ar[r, mapsto] & c + d
	\end{tikzcd}
	\end{center}
	One can easily see (by taking a suitable basis)
	that the kernel of the latter map is exactly
	the image of the first map.
	This generates a short exact sequence
	\[ 0 \to  C_\bullet(U \cap V) \injto C_\bullet(U) \oplus C_\bullet(V)
	\surjto C_\bullet(U + V) \to 0. \]
\end{example}
\begin{example}
	[Augmented Mayer-Vietoris sequence]
	We can \emph{augment} each of the chain complexes in the Mayer-Vietoris
	sequence as well, by appending
	\begin{center}
	\begin{tikzcd}[row sep=large]
		0 \ar[r]
		& C_0(U \cap V) \ar[r, hook] \ar[d, "\eps"', surjective head]
			& C_0(U) \oplus C_0(V) \ar[r, surjective head] \ar[d, "\eps \oplus \eps"', surjective head]
			& C_0(U+V) \ar[r] \ar[d, "\eps"']
			& 0 \\
		0 \ar[r]
			& \ZZ \ar[r]
			& \ZZ \oplus \ZZ \ar[r]
			& \ZZ \ar[r]
			& 0
	\end{tikzcd}
	\end{center}
	to the bottom of the diagram.
	In other words we modify the above into
	\[ 0 \to  \wt C_\bullet(U \cap V)
		\injto \wt C_\bullet(U) \oplus \wt C_\bullet(V)
		\surjto \wt C_\bullet(U + V) \to 0 \]
	where $\wt C_\bullet$ is the chain complex defined in \Cref{def:augment}.
\end{example}

\begin{example}
	[Relative chain short exact sequence]
	\label{ex:rel_short_exact}
	Since $C_n(X,A) \defeq C_n(X) / C_n(A)$, we have a short exact sequence
	\[ 0 \to C_\bullet(A) \injto C_\bullet(X) \surjto C_\bullet(X,A) \to 0 \]
	for every space $X$ and subspace $A$.
	%The maps for each $n$ are the obvious ones:
	%$C_n(A) \injto C_n(X)$ inclusion and $C_n(X) \surjto C_n(X,A)$ projection.
	This can be augmented: we get
	\[ 0 \to \wt C_\bullet(A) \injto \wt C_\bullet(X)
		\surjto C_\bullet(X,A) \to 0 \]
	by adding the final row
	\begin{center}
	\begin{tikzcd}
		0 \ar[r]
		& C_0(A) \ar[r, hook] \ar[d, "\eps", surjective head]
			& C_0(X) \ar[r, surjective head] \ar[d, "\eps", surjective head]
			& C_0(X,A) \ar[r]
			& 0 \\
		0 \ar[r] & \ZZ \ar[r, "\id"'] & \ZZ \ar[r] & 0 \ar[r] & 0.
	\end{tikzcd}
	\end{center}
\end{example}

\section{The long exact sequence of homology groups}
Consider a short exact sequence $0 \to A_\bullet \taking f B_\bullet \taking g C_\bullet \to 0$.
Now, we know that we get induced maps of homology groups, i.e.\ we have
\begin{center}
\begin{tikzcd}
	\vdots & \vdots & \vdots  \\
	H_{n+1}(A_\bullet) \ar[r, "f_\ast"] & H_{n+1}(B_\bullet) \ar[r, "g_\ast"] & H_{n+1}(C_\bullet) \\
	H_{n}(A_\bullet) \ar[r, "f_\ast"] & H_{n}(B_\bullet) \ar[r, "g_\ast"] & H_{n}(C_\bullet) \\
	H_{n-1}(A_\bullet) \ar[r, "f_\ast"] & H_{n-1}(B_\bullet) \ar[r, "g_\ast"] & H_{n-1}(C_\bullet) \\
	\vdots & \vdots & \vdots \\
\end{tikzcd}
\end{center}
But the theorem is that we can string these all together,
taking each $H_{n+1}(C_\bullet)$ to $H_n(A_\bullet)$.

\begin{theorem}[Short exact $\implies$ long exact]
	\label{thm:long_exact}
	Let $0 \to A_\bullet \taking f B_\bullet \taking g C_\bullet \to 0$
	be \emph{any} short exact sequence of chain complexes we like.
	Then there is an \emph{exact} sequence
	\begin{center}
	\begin{tikzcd}
		& \dots \ar[r] & H_{n+2}(C_\bullet) \ar[lld, "\partial"'] \\
		H_{n+1}(A_\bullet) \ar[r, "f_\ast"']
			& H_{n+1}(B_\bullet) \ar[r, "g_\ast"]
			& H_{n+1}(C_\bullet) \ar[lld, "\partial"'] \\
		H_{n}(A_\bullet) \ar[r, "f_\ast"']
			& H_{n}(B_\bullet) \ar[r, "g_\ast"]
			& H_{n}(C_\bullet) \ar[lld, "\partial"'] \\
		H_{n-1}(A_\bullet) \ar[r, "f_\ast"']
			& H_{n-1}(B_\bullet) \ar[r, "g_\ast"]
			& H_{n-1}(C_\bullet) \ar[lld, "\partial"'] \\
		H_{n-2}(A_\bullet) \ar[r] & \dots
	\end{tikzcd}
	\end{center}
	This is called a \vocab{long exact sequence} of homology groups.
\end{theorem}
\begin{proof}
	A very long diagram chase, valid over any abelian category.
	(Alternatively, it's actually possible to use the snake lemma twice.)
\end{proof}

\begin{remark}
	\label{rem:leftdownleft}
	The map $\partial \colon H_n(C_\bullet) \to H_{n-1}(A_\bullet)$ can be written explicitly as follows.
	Recall that $H_n$ is ``cycles modulo boundaries'', and consider the sub-diagram
	\begin{center}
	\begin{tikzcd}
		& B_n \ar[r, "g_n", surjective head] \ar[d, "\partial_B"'] & C_n \ar[d, "\partial_C"] \\
		A_{n-1} \ar[r, "f_{n-1}"', hook] & B_{n-1} \ar[r, "g_{n-1}"', surjective head] & C_{n-1}
	\end{tikzcd}
	\end{center}
	We need to take every cycle in $C_n$ to a cycle in $A_{n-1}$.
	(Then we need to check a ton of ``well-defined'' issues,
	but let's put that aside for now.)

	Suppose $c \in C_n$ is a cycle (so $\partial_C(c) = 0$).
	By surjectivity, there is a $b \in B_n$ with $g_n(b) = c$,
	which maps down to $\partial_B(b)$.
	Now, the image of $\partial_B(b)$ under $g_{n-1}$ is zero by commutativity of the square,
	and so we can pull back under $f_{n-1}$ to get a unique element of $A_{n-1}$
	(by exactness at $B_{n-1}$).

	In summary: we go ``\emph{left, down, left}'' to go from $c$ to $a$:
	\begin{center}
	\begin{tikzcd}
		& b \ar[r, mapsto, "g_n"] \ar[d, "\partial_B"', mapsto]
			& \boxed{c} \ar[d, "\partial_C", mapsto] \\
		\boxed{a} \ar[r, mapsto, "f_{n-1}"']
			& \partial_B(b) \ar[r, "g_{n-1}"', mapsto]
			& 0
	\end{tikzcd}
	\end{center}
\end{remark}
\begin{exercise}
	Check quickly that the recovered $a$ is actually a cycle,
	meaning $\partial_A(a) = 0$.
	(You'll need another row, and the fact that $\partial_B^2 = 0$.)
\end{exercise}

The final word is that:
\begin{moral}
	Short exact sequences of chain complexes give
	long exact sequences of homology groups.
\end{moral}
In particular, let us take the four examples given earlier.
\begin{example}[Mayer-Vietoris long exact sequence, provisional version]
	The Mayer-Vietoris ones give, for $X = U \cup V$ an open cover,
	\[ \dots \to H_n(U \cap V) \to H_n(U) \oplus H_n(V) \to H_n(U+V) \to H_{n-1}(U \cap V) \to \dots. \]
	and its reduced version
	\[ \dots \to \wt H_n(U \cap V) \to \wt H_n(U) \oplus \wt H_n(V)
	\to \wt H_n(U+V) \to \wt H_{n-1}(U \cap V) \to \dots. \]
\end{example}
This version is ``provisional'' because in the next section
we will replace $H_n(U+V)$ and $\wt H_n(U+V)$ with something better.
As for the relative homology sequences, we have:
\begin{theorem}[Long exact sequence for relative homology]
	\label{thm:long_exact_rel}
	Let $X$ be a space, and let $A \subseteq X$ be a subspace.
	There are long exact sequences
	\[ \dots \to H_n(A) \to H_n(X) \to H_n(X,A) \to H_{n-1}(A) \to \dots. \]
	and
	\[ \dots \to \wt H_n(A) \to \wt H_n(X) \to H_n(X,A) \to \wt H_{n-1}(A) \to \dots. \]
\end{theorem}
The exactness of these sequences will give \textbf{tons of information}
about $H_n(X)$ if only we knew something about what $H_n(U+V)$
or $H_n(X,A)$ looked like.  This is the purpose of the next chapter.

\section{The Mayer-Vietoris sequence}
\prototype{The computation of $H_n(S^m)$ by splitting $S^m$ into two hemispheres.}

Now that we have done so much algebra, we need to invoke some geometry.
There are two major geometric results in the Napkin.
One is the excision theorem, which we discuss next chapter.
The other we present here, which will let us take advantage of the
Mayer-Vietoris sequence.
The proofs are somewhat involved and are thus omitted;
see \cite{ref:hatcher} for details.

The first theorem is that the notation $H_n(U+V)$ that we have kept until now
is redundant, and can be replaced with just $H_n(X)$:
\begin{theorem}[Open cover homology theorem]
	\label{thm:open_cover_homology}
	Consider the inclusion $\iota \colon C_\bullet(U+V) \injto C_\bullet(X)$.
	Then $\iota$ induces an isomorphism
	\[ H_n(U+V) \cong H_n(X). \]
	% Then there exists a $\rho \colon C_\bullet(X) \to C_\bullet(U+V)$ such that
	% $\rho\iota$ and $\iota\rho$ are chain homotopic to the identities.
	% Thus $\iota$ induces an isomorphism
\end{theorem}
\begin{remark}
	In fact, this is true for any open cover (even uncountable),
	not just those with two covers $U \cup V$.
	But we only state the special case with two open sets,
	because this is what is needed for \Cref{ex:mayer_short_exact}.
\end{remark}
So, \Cref{ex:mayer_short_exact} together with the above theorem implies,
after replacing all the $H_n(U+V)$'s with $H_n(X)$'s:
\begin{theorem}[Mayer-Vietoris long exact sequence]
	If $X = U \cup V$ is an open cover, then we have long exact sequences
	\[ \dots \to H_n(U \cap V) \to H_n(U) \oplus H_n(V)
		\to H_n(X) \to H_{n-1}(U \cap V) \to \dots. \]
	and
	\[ \dots \to \wt H_n(U \cap V) \to \wt H_n(U) \oplus \wt H_n(V) \to
		\wt H_n(X) \to \wt H_{n-1}(U \cap V) \to \dots. \]
\end{theorem}

At long last, we can compute the homology groups of the spheres.
\begin{theorem}[The homology groups of $S^m$]
	\label{thm:reduced_homology_sphere}
	For integers $m$ and $n$,
	\[ \wt H_n(S^m) \cong
	\begin{cases}
		\ZZ & n=m \\
		0 & \text{otherwise}.
	\end{cases}
	\]
	The generator $\wt H_n(S^n)$ is an $n$-cell which covers $S^n$
	exactly once (for example, the generator for $\wt H_1(S^1)$
	is a loop which wraps around $S^1$ once).
\end{theorem}
\begin{proof}
	This one's fun, so I'll only spoil the case $m=1$, and leave the rest to you.
	Decompose the circle $S^1$ into two arcs $U$ and $V$, as shown:
	\begin{center}
		\begin{asy}
			size(4cm);
			draw(unitcircle);
			label("$S^1$", dir(45), dir(45));
			real R = 0.1;
			draw(arc(origin,1-R,-100,100), red+1);
			label("$V$", (1-R)*dir(0), dir(180), red);
			draw(arc(origin,1+R,80,280), blue+1);
			label("$U$", (1+R)*dir(180), dir(180), blue);
		\end{asy}
	\end{center}
	Each of $U$ and $V$ is contractible, so all their reduced homology groups vanish.
	Moreover, $U \cap V$ is homotopy equivalent to two points,
	hence
	\[ \wt H_n(U \cap V) \cong
		\begin{cases}
			\ZZ & n = 0 \\
			0 & \text{otherwise}.
		\end{cases}
	\]
	Now consider again the segment of the short exact sequence
	\[
		\dots \to
		\underbrace{\wt H_n(U) \oplus \wt H_n(V)}_{= 0} \to
		\wt H_n(S^1) \taking{\partial} \wt H_{n-1}(U \cap V) \to
		\underbrace{\wt H_{n-1}(U) \oplus \wt H_{n-1}(V)}_{=0} \to \dots.
	\]
	From this we derive that $\wt H_n(S^1)$ is $\ZZ$ for $n=1$ and $0$ elsewhere.

	It remains to analyze the generators of $\wt H_1(S^1)$.
	Note that the isomorphism was given by the connecting homomorphism $\partial$,
	which is given by a ``left, down, left'' procedure (\Cref{rem:leftdownleft})
	in the diagram
	\begin{center}
	\begin{tikzcd}
		& C_1(U) \oplus C_1(V) \ar[r] \ar[d, "\partial \oplus \partial"] & C_1(U+V) \\
		C_0(U \cap V) \ar[r] & C_0(U) \oplus C_0(V)
	\end{tikzcd}
	\end{center}
	Mark the points $a$ and $b$ as shown in the two disjoint paths of $U \cap V$.
	\begin{center}
		\begin{asy}
			size(3cm);
			label("$S^1$", dir(45), dir(45));
			real R = 0.1;
			/*
			draw(arc(origin,1-R,-100,100), red+1);
			label("$V$", (1-R)*dir(0), dir(180), red);
			draw(arc(origin,1+R,80,280), blue+1);
			label("$U$", (1+R)*dir(180), dir(180), blue);
			*/
			dot("$a$", dir(90), dir(90));
			dot("$b$", dir(-90), dir(-90));
			draw(arc(origin,1,90,270), EndArrow, Margins);
			draw(arc(origin,1,90,-90), EndArrow, Margins);
			label("$c$", dir(180), dir(180));
			label("$d$", dir(0), dir(0));
		\end{asy}
	\end{center}
	Then $a-b$ is a cycle which represents a generator of $H_0(U \cap V)$.
	We can find the pre-image of $\partial$ as follows:
	letting $c$ and $d$ be the chains joining $a$ and $b$, with $c$ contained
	in $U$, and $d$ contained in $V$, the diagram completes as
	\begin{center}
	\begin{tikzcd}
		& (c,d) \ar[r, mapsto]  \ar[d, mapsto] & c-d \\
		a-b \ar[r, mapsto] & (a-b, a-b)
	\end{tikzcd}
	\end{center}
	In other words $\partial(c-d) = a-b$, so $c-d$ is a generator for $\wt H_1(S^1)$.

	Thus we wish to show that $c-d$ is (in $H_1(S^1)$) equivalent to the loop $\gamma$
	wrapping around $S^1$ once, counterclockwise.
	This was illustrated in \Cref{ex:S1_c_minus_d}.
\end{proof}

Thus, the key idea in Mayer-Vietoris is that
\begin{moral}
	Mayer-Vietoris lets us compute $H_n(X)$
	by splitting $X$ into two open sets.
\end{moral}

Here are some more examples.
\begin{proposition}[The homology groups of the figure eight]
	Let $X = S^1 \vee S^1$ be the figure eight.
	Then
	\[
		\wt H_n(X) \cong
		\begin{cases}
			\ZZ^{\oplus 2} & n = 1 \\
			0 & \text{otherwise}.
		\end{cases}
	\]
	The generators for $\wt H_1(X)$ are the two loops of the figure eight.
\end{proposition}
\begin{proof}
	Again, for simplicity we work with reduced homology groups.
	Let $U$ be the ``left'' half of the figure eight plus a little bit of the right,
	as shown below.
	\begin{center}
		\begin{asy}
			size(4cm);
			draw(unitcircle);
			draw(CR(2*dir(180),1), blue+2);
			draw(arc(origin,1,135,225), blue+2);
			label("$U$", 2*dir(180)+dir(135), dir(135), blue);
			label("$S^1 \vee S^1$", dir(15), dir(15));
		\end{asy}
	\end{center}
	The set $V$ is defined symmetrically.
	In this case $U \cap V$ is contractible, while each of $U$ and $V$
	is homotopic to $S^1$.

	Thus, we can read a segment of the long exact sequence as
	\[
		\dots \to
		\underbrace{\wt H_n(U \cap V)}_{=0}
		\to \wt H_n(U) \oplus \wt H_n(V) \to \wt H_n(X) \to
		\underbrace{\wt H_{n-1}(U \cap V)}_{=0} \to \dots.
	\]
	So we get that $\wt H_n(X) \cong \wt H_n(S^1) \oplus \wt H_n(S^1)$,
	The claim about the generators follows from the fact that,
	according to the isomorphism above,
	the generators of $\wt H_n(X)$ are the generators of $\wt H_n(U)$
	and $\wt H_n(V)$, which we described geometrically
	in the last theorem.
\end{proof}

Up until now, we have been very fortunate that we have always been able to make
certain parts of the space contractible.
This is not always the case, and in the next example we will have to
actually understand the maps in question to complete the solution.

\begin{proposition}
	[Homology groups of the torus]
	\label{prop:homology_torus}
	Let $X = S^1 \times S^1$ be the torus.
	Then
	\[
		\wt H_n(X)
		=
		\begin{cases}
			\ZZ^{\oplus 2} & n = 1 \\
			\ZZ & n = 2 \\
			0 & \text{otherwise}.
		\end{cases}
	\]
\end{proposition}
\begin{proof}
	To make our diagram look good on 2D paper,
	we'll represent the torus as a square with its edges identified,
	though three-dimensionally the picture makes sense as well.
	Consider $U$ (shaded light orange) and $V$ (shaded green) as shown.
	(Note that $V$ is connected due to the identification of the left and right (blue) edges,
	even if it doesn't look connected in the picture).
	\begin{center}
		\begin{asy}
			pair A = (0,0);
			pair B = (1,0);
			pair C = (1,1);
			pair D = (0,1);
			draw(A--B, red+1.5, MidArrow);
			draw(B--C, blue+1.5, MidArrow);
			draw(D--C, red+1.5, MidArrow);
			draw(A--D, blue+1.5, MidArrow);
			fill(box((0.2,0),(0.8,1)), orange+opacity(0.2));
			fill(box(A,(0.3,1)), heavygreen+opacity(0.2));
			fill(box((0.7,0),C), heavygreen+opacity(0.2));
			draw( (0.3,0)--(0.3,1), heavygreen+dashed+1.2);
			draw( (0.7,0)--(0.7,1), heavygreen+dashed+1.2);
			draw( (0.2,0)--(0.2,1), orange+dashed+1.2);
			draw( (0.8,0)--(0.8,1), orange+dashed+1.2);

			label("$U$", (0.5, 0.5));
			label("$V$", (0.1, 0.8));
			label("$V$", (0.9, 0.8));
		\end{asy}
	\end{center}
	In the three dimensional picture, $U$ and $V$ are two cylinders which together give the torus.
	This time, $U$ and $V$ are each homotopic to $S^1$, and the intersection $U \cap V$
	is the disjoint union of two circles: thus $\wt H_1(U \cap V) \cong \ZZ \oplus \ZZ$,
	and $H_0(U \cap V) \cong \ZZ^{\oplus 2} \implies \wt H_0(U \cap V) \cong \ZZ$.

	For $n \ge 3$, we have
	\[
		\dots \to
		\underbrace{\wt H_n(U \cap V)}_{=0}
		\to \wt H_n(U) \oplus \wt H_n(V) \to \wt H_n(X) \to
		\underbrace{\wt H_{n-1}(U \cap V)}_{=0} \to \dots.
	\]
	and so $H_n(X) \cong 0$ for $n \ge 3$.
	Also, we have $H_0(X) \cong \ZZ$ since $X$ is path-connected.
	So it remains to compute $H_2(X)$ and $H_1(X)$.

	Let's find $H_2(X)$ first.
	We first consider the segment
	\[
		\dots \to
		\underbrace{\wt H_2(U) \oplus \wt H_2(V)}_{=0} \to \wt H_2(X) \xhookrightarrow{\partial}
		\underbrace{\wt H_1(U \cap V)}_{\cong \ZZ \oplus \ZZ} \xrightarrow{\phi}
		\underbrace{\wt H_1(U) \oplus \wt H_1(V)}_{\cong \ZZ \oplus \ZZ} \to \dots
	\]
	Unfortunately, this time it's not immediately clear what $\wt H_2(X)$ is because
	we only have one zero at the left.
	In order to do this, we have to actually figure out what the maps $\partial$ and $\phi$ look like.
	Note that, as we'll see, $\phi$ isn't an isomorphism even though the groups are isomorphic.

	The presence of the zero term has allowed us to make the connecting map $\partial$ injective.
	First, $\wt H_2(X)$ is isomorphic to the image of $\partial$, which is
	exactly the kernel of the arrow $\phi$ inserted.
	To figure out what $\ker \phi$ is, we have to think back to how the map
	$C_\bullet(U \cap V) \to C_\bullet(U) \oplus C_\bullet(V)$ was constructed:
	it was $c \mapsto (c, -c)$.
	So the induced map of homology groups is actually what you would guess:
	a $1$-cycle $z$ in $\wt H_1(U \cap V)$ gets sent to $(z, -z)$ in $\wt H_1(U) \oplus \wt H_1(V)$.

	In particular, consider the two generators $z_1$ and $z_2$ of
	$\wt H_1(U \cap V) = \ZZ \oplus \ZZ$,
	i.e.\ one cycle in each connected component of $U \cap V$.
	(To clarify: $U \cap V$ consists of two ``wristbands'';
	$z_i$ wraps around the $i$th one once.)
	Moreover, let $\alpha_U$ denote a generator of $\wt H_1(U) \cong \ZZ$,
	and $\alpha_V$ a generator of $\wt H_1(V) \cong \ZZ$.

	The elements are depicted below:
	\begin{center}
	\begin{asy}
		pair A = (0,0);
		pair B = (1,0);
		pair C = (1,1);
		pair D = (0,1);
		fill(box((0.2,0),(0.8,1)), orange+opacity(0.2));
		fill(box(A,(0.3,1)), heavygreen+opacity(0.2));
		fill(box((0.7,0),C), heavygreen+opacity(0.2));

		draw( (0.25,1)--(0.25,0), MidArrow, L=Label("$z_1$", align=E*2.5, Relative(0.67)));
		draw( (0.5,1)--(0.5,0), MidArrow, L=Label("$\alpha_U$", align=E, Relative(0.67)));
		draw( (0.72,1)--(0.72,0), MidArrow, L=Label("$z_2$", align=E, Relative(0.67)));
		draw( (0.88,1)--(0.88,0), MidArrow, L=Label("$\alpha_V$", align=E, Relative(0.67)));

		draw( (0.3,0)--(0.3,1), heavygreen+dashed+1.2);
		draw( (0.7,0)--(0.7,1), heavygreen+dashed+1.2);
		draw( (0.2,0)--(0.2,1), orange+dashed+1.2);
		draw( (0.8,0)--(0.8,1), orange+dashed+1.2);

		draw(A--B, red+1.5, MidArrow);
		draw(B--C, blue+1.5, MidArrow);
		draw(D--C, red+1.5, MidArrow);
		draw(A--D, blue+1.5, MidArrow);
	\end{asy}
	\end{center}
	Note that $z_1$, $z_2$, $\alpha_U$, $\alpha_V$ are
	elements of the homology group, so you can move the paths around a bit --- for instance, as
	elements of $\wt H_1(U)$, the chain drawn as $z_1$ and $\alpha_U$ represents the same element.

	Then we have that
	\[ z_1 \mapsto (\alpha_U, -\alpha_V) \qquad\text{and}\qquad z_2 \mapsto (\alpha_U, -\alpha_V). \]
	(The signs may differ on which direction you pick for the generators;
	note that $\ZZ$ has two possible generators.)
	We can even format this as a matrix:
	\[ \phi = \begin{bmatrix} 1 & 1 \\ -1 & -1 \end{bmatrix}. \]
	And we observe $\phi(z_1 - z_2) = 0$, meaning this map has nontrivial kernel!
	That is, \[ \ker\phi = \left< z_1 - z_2 \right> \cong \ZZ. \]
	Thus, $\wt H_2(X) \cong \img \partial \cong \ker \phi \cong \ZZ$.
	We'll also note that $\img \phi$ is the set generated by $(\alpha_U, -\alpha_V)$;
	(in particular $\img\phi \cong \ZZ$ and the quotient by $\img\phi$ is $\ZZ$ too).

	The situation is similar with $\wt H_1(X)$: this time, we have
	\[
		\dots
		%\to \underbrace{\wt H_1(U \cap V)}_{\cong \ZZ \oplus \ZZ}
		\xrightarrow{\phi} \underbrace{\wt H_1(U) \oplus \wt H_1(V)}_{\cong \ZZ \oplus \ZZ}
		\overset{\psi}{\to} \wt H_1(X) \overset\partial\surjto
		\underbrace{\wt H_0(U \cap V)}_{\cong \ZZ}
		\to \underbrace{\wt H_0(U) \oplus \wt H_0(V)}_{=0} \to \dots
	\]
	and so we know that the connecting map $\partial$ is surjective,
	hence $\img \partial \cong \ZZ$.
	Now, we also have
	\begin{align*}
		\ker \partial \cong \img \psi &\cong \left( \wt H_1(U) \oplus \wt H_1(V) \right) / \ker \psi \\
		&\cong \left( \wt H_1(U) \oplus \wt H_1(V) \right) / \img \phi
		\cong \ZZ
	\end{align*}
	by what we knew about $\img \phi$ already.
	To finish off we need some algebraic tricks. The first is \Cref{prop:break_exact},
	which gives us a short exact sequence
	\[
		0 \to \underbrace{\ker\partial}_{\cong \img\psi \cong \ZZ}
		\injto \wt H_1(X)
		\surjto \underbrace{\img\partial}_{\cong \ZZ} \to 0.
	\]
	You should satisfy yourself that $\wt H_1(X) \cong \ZZ \oplus \ZZ$ is the
	only possibility, but we'll prove this rigorously with \Cref{lem:split_exact}.
\end{proof}

\begin{remark}
	Earlier, we remarked (without proof) that $\pi_2(X)$ is trivial --- that is, homotopy does not
	find any ``$2$-dimensional holes'' in the torus. Why is it that $H_2(X) \cong \ZZ$?

	You may want to manually compute the nontrivial element in $H_2(X)$ using the long
	exact sequence using the following method. Look at the long exact sequence:
	\begin{center}
	\begin{tikzcd}
		\cdots \ar[r]
			& \underbrace{H_2(U) \oplus H_2(V)}_{= 0} \ar[r]
			& \underbrace{H_2(X)}_{\cong \ZZ} \ar[lld, "\partial"', swap] \\
		\underbrace{H_1(U \cap V)}_{\cong \ZZ \oplus \ZZ} \ar[r, "\phi"']
			& \underbrace{H_1(U) \oplus H_1(V)}_{\cong \ZZ \oplus \ZZ} \ar[r]
			& \cdots
	\end{tikzcd}
	\end{center}
	We wish to find some nontrivial element in $H_2(X)$ --- in order to do that, we can take an
	element in $\ker \phi \subseteq H_1(U \cap V)$ and take its preimage under $\partial$.

	For that, $z_1 - z_2$ would suffice. In order to take its preimage under $\partial$, we need to
	recall how $\partial$ was constructed --- it was a ``left, down, left'' procedure in the
	diagram:
	\begin{center}
	\begin{tikzcd}
		& C_2(U) \oplus C_2(V) \ar[r, surjective head] \ar[d] & C_2(X) \\
		C_1(U \cap V) \ar[r, hook] & C_1(U) \oplus C_1(V)
	\end{tikzcd}
	\end{center}
	So, we find a (closed) element in $C_1(U \cap V)$ whose image under the quotient map is
	$z_1 - z_2$, then move it ``right, up, right'' to an element in $C_2(X)$.

	If you did everything correctly, the result should be \emph{the whole torus}!
\end{remark}
Which emphasizes the point:
\begin{moral}
	A ``hole'' detected by homology need not look like the interior of $S^n$.
\end{moral}

Note that the previous example is of a different attitude than the previous ones,
because we had to figure out what the maps in the long exact sequence actually were
to even compute the groups.
In principle, you could also figure out all the isomorphisms in the previous proof
and explicitly compute the generators of $\wt H_1(S^1 \times S^1)$,
but to avoid getting bogged down in detail I won't do so here.

Finally, to fully justify the last step, we present:
\begin{lemma}[Splitting lemma]
	\label{lem:split_exact}
	For a short exact sequence $0 \to A \taking f B \taking g C \to 0$
	of abelian groups, the following are equivalent:
	\begin{enumerate}[(a)]
		\ii There exists $p \colon B \to A$ such that $A \taking f B \taking p A$ is the identity.
		\ii There exists $s \colon C \to B$ such that $C \taking s B \taking g C$ is the identity.
		\ii There is an isomorphism from $B$ to $A \oplus C$ such that the diagram
		\begin{center}
		\begin{tikzcd}
			&& B \ar[rd, "g", surjective head] \ar[dd, leftrightarrow, "\cong"] \\
			0 \ar[r] & A \ar[ru, hook, "f"] \ar[rd, hook] && C \ar[r] & 0 \\
			&& A \oplus C \ar[ru, surjective head]
		\end{tikzcd}
		\end{center}
		commutes. (The maps attached to $A \oplus C$ are the obvious ones.)
	\end{enumerate}
	In particular, (b) holds anytime $C$ is free.
\end{lemma}
In these cases we say the short exact sequence \vocab{splits}. The point is that
\begin{moral}
	An exact sequence which splits lets us obtain $B$ given $A$ and $C$.
\end{moral}
In particular, for $C = \ZZ$ or any free abelian group,
condition (b) is necessarily true.
So, once we obtained the short exact sequence $0 \to \ZZ \to \wt H_1(X) \to \ZZ \to 0$,
we were done.
\begin{remark}
	Unfortunately, not all exact sequences split:
	An example of a short exact sequence which doesn't split is
	\[ 0 \to \Zc 2 \xhookrightarrow{\times 2} \Zc 4 \surjto \Zc 2 \to 0 \]
	since it is not true that $\Zc 4 \cong \Zc2 \oplus \Zc 2$.
\end{remark}
\begin{remark}
	The splitting lemma is true in any abelian category.
	The ``direct sum'' is the colimit of the two objects $A$ and $C$.
\end{remark}

\section\problemhead
\begin{problem}
	Complete the proof of \Cref{thm:reduced_homology_sphere},
	i.e.\ compute $H_n(S^m)$ for all $m$ and $n$.
	(Try doing $m=2$ first, and you'll see how to proceed.)
	\begin{hint}
		Induction on $m$, using hemispheres.
	\end{hint}
\end{problem}

\begin{problem}
	Compute the reduced homology groups
	of $\RR^n$ with $p \ge 1$ points removed.
	\begin{hint}
		One strategy is induction on $p$, with base case $p=1$.
		Another strategy is to let $U$ be the desired space and let $V$
		be the union of $p$ non intersecting balls.
	\end{hint}
	\begin{sol}
		The answer is $\wt H_{n-1}(X) \cong \ZZ^{\oplus p}$,
		with all other groups vanishing.
		For $p=1$, $\RR^n - \{\ast\} \cong S^{n-1}$ so we're done.
		For all other $p$, draw a hyperplane dividing the $p$ points into two halves
		with $a$ points on one side and $b$ points on the other (so $a+b=p$).
		Set $U$ and $V$ and use induction.

		Alternatively, let $U$ be the desired space and let $V$
		be the union of $p$ disjoint balls, one around every point.
		Then $U \cup V = \RR^n$ has all reduced homology groups trivial.
		From the Mayer-Vietoris sequence we can read $\wt H_k(U \cap V) \cong \wt H_k(U) \oplus \wt H_k(V)$.
		Then $U \cap V$ is $p$ punctured balls, which are each the same as $S^{n-1}$.
		One can read the conclusion from here.
	\end{sol}
\end{problem}

\begin{sproblem}
	Let $n \ge 1$ and $k \ge 0$ be integers.
	Compute $H_k(\RR^n, \RR^n \setminus \{0\})$.
	\begin{hint}
		Use \Cref{thm:long_exact_rel}.
		Note that $\RR^n \setminus \{0\}$ is homotopy
		equivalent to $S^{n-1}$.
	\end{hint}
	\begin{sol}
		It is $\ZZ$ for $k=n$ and $0$ otherwise.
	\end{sol}
\end{sproblem}

\begin{problem}
	[Nine lemma]
	Consider a commutative diagram
	\begin{center}
	\begin{tikzcd}
		& 0 \ar[d] & 0 \ar[d] & 0 \ar[d] \\
		0 \ar[r] & A_1 \ar[r] \ar[d] & B_1 \ar[r] \ar[d] & C_1 \ar[r] \ar[d] & 0 \\
		0 \ar[r] & A_2 \ar[r] \ar[d] & B_2 \ar[r] \ar[d] & C_2 \ar[r] \ar[d] & 0 \\
		0 \ar[r] & A_3 \ar[r] \ar[d] & B_3 \ar[r] \ar[d] & C_3 \ar[r] \ar[d] & 0 \\
		& 0 & 0 & 0 &
	\end{tikzcd}
	\end{center}
	and assume that all rows are exact,
	and two of the columns are exact.
	Show that the third column is exact as well.
	\begin{hint}
		$0 \to A_\bullet \to B_\bullet \to C_\bullet \to 0$
		is a short exact sequence of chain complexes.
		Write out the corresponding long exact sequence.
		Nearly all terms will vanish.
	\end{hint}
\end{problem}

\begin{sproblem}[Klein bottle]
	\onechili
	Show that the reduced homology groups of the Klein bottle $K$ are given by
	\[
		\wt H_n(K) =
		\begin{cases}
			\ZZ \oplus \Zc 2 & n = 1 \\
			0 & \text{otherwise}.
		\end{cases}
	\]
	\begin{hint}
		It's possible to use two cylinders with $U$ and $V$.
		This time the matrix is $\begin{bmatrix} 1 & 1 \\ 1 & -1 \end{bmatrix}$
		or some variant though; in particular, it's injective, so $\wt H_2(X) = 0$.
	\end{hint}
\end{sproblem}

\begin{sproblem}
	[Triple long exact sequence]
	\label{prob:triple_long_exact}
	Let $A \subseteq B \subseteq X$ be subspaces.
	Show that there is a long exact sequence
	\[
		\dots \to H_n(B,A) \to H_n(X,A)
		\to H_n(X,B) \to H_{n-1}(B,A) \to \dots.
	\]
	\begin{hint}
		Find a new short exact sequence
		to apply \Cref{thm:long_exact} to.
	\end{hint}
	\begin{sol}
		Use the short exact sequence
		\[ 0 \to C_\bullet(B,A) \to C_\bullet(X,A) \to C_\bullet(X,B) \to 0 \]
		of chain complexes.
	\end{sol}
\end{sproblem}
