https://link.springer.com/book/10.1007/978-1-4612-0881-5
https://link.springer.com/chapter/10.1007/978-3-030-70608-1_13
# Summary
The basic idea of homology is to count $n$-dimensional holes. Roughly speaking, an $n$-dimensional hole $H$ in $X$ is a compact $n$-dimensional manifold—an $n$-dimensional analogue of a surface—without boundary in $X$. But a hole is trivial if it is filled in; that is, if there is a compact $(n + 1)$-dimensional manifold with boundary in $X$, whose boundary is $H$. (This isn’t quite correct, but it will suffice for the sake of intuition for now.) For example, $S^2$ has no nontrivial $1$-dimensional holes, because for every $1$-dimensional manifold (namely, a circle) $C$ inside $S^2$, we can find a disk whose boundary is $C$. On the other hand, the sphere does have a $2$-dimensional hole, because the sphere itself is not the boundary of a $3$-dimensional manifold with boundary contained inside $S^2$. (In fact, there are no $3$-dimensional manifolds at all contained inside $S^2$.) The homology groups measure holes “up to triviality,” in a way that we will soon make precise.
To give the simplest example of a trivial hole and a nontrivial hole, let us consider the triangle on the left in Figure 13.1, by which we mean just the edges without the interior. This triangle is a 1-dimensional hole because we can map a circle (a 1-manifold) to it. This same hole also exists in the filled triangle on the right in Figure 13.1, except this time the hole is trivial: it’s the boundary of the filled triangle. Once we learn the definition of homology and compute it, we’ll find that the triangle on the left has nontrivial 1-dimensional homology, whereas the filled triangle on the right has trivial 1-dimensional homology.

# Simplices and Simplicial Complexes
$\textbf{Definition}$
The $n-simplex$, $\Delta^n$, is the simplest geometric figure determined by a collection of $n + 1$ points in Euclidean space $\mathbb{R}^n$. Geometrically, it can be thought of as the complete graph on $(n + 1)$ vertices, which is solid in $n$ dimensions.

Extrapolating from Figure 1, we see that the $3$-simplex is a tetrahedron.
Note: The $n$-simplex is topologically equivalent to $D^n$, the $n$-ball.
Given the set $S$ of vertices of a simplex, we define an orientation on the simplex by selecting some particular ordering of $S$. Vertex orderings that differ from this by an odd permutation are then designated as reversed, while even permutations are regarded as unchanged. Any simplex, then, has only two possible orientations.

$\textbf{Definition}$
An $n$-face of a simplex is a subset of the set of vertices of the simplex with order $n + 1$. The faces of an $n$-simplex with dimension less than $n$ are called its proper faces.
Two simplices are said to be $\textit{properly situated}$ if their intersection is either empty or a face of both simplices (i.e., a simplex itself). By ''gluing'' (identifying) simplices along entire faces, we get what are known as $\textit{simplicial complexes.}$ More formally:
$\textbf{Definition}$
A simplicial complex $K$ is a finite set of simplices satisfying the following conditions:
1. For all simplices $A \in K$ with $\alpha$ a face of $A$, we have $\alpha \in K$.
2. $A, B \in K \Rightarrow A, B$ are properly situated.
The $dimension$ of a complex is the maximum dimension of the simplices contained in it#
$\textbf{Definition}$
Given a set $A_{1}^n, \ldots, A_{k}^n$ of arbitrarily oriented $n$-simplices of a complex $K$ and an abelian group $G$, we define an $n$-chain $x$ with coefficients in $G$ as a formal sum:
\begin{equation}
x = g_1A_{1}^n + g_2A_{2}^n + \ldots + g_kA_{k}^n,
\end{equation}
where $g_i \in G$.
Henceforth, we will assume that $G = \mathbb{Z}$.
The set of $n$-chains forms an abelian group over addition: for $x = \sum_{i=1}^{k} g_i A_{n_i}$, $y = \sum_{i=1}^{k} h_i A_{i}^n$, we have $x + y = \sum_{i=1}^{k} (g_i + h_i) A_{i}^n$. We denote the abelian group of $n$-chains by $C_n$.
$\textbf{Definition}$
Suppose that we have an $n$-simplex $[v_0, \ldots, v_n]$. We define its $boundary$ to be:
\begin{equation}
\partial_n([v_0, \ldots, v_n]) = \sum_{i=0}^{n} (-1)^i [v_0, \ldots, \hat{v_i}, \ldots, v_n],
\end{equation}
where the hatted term $\hat{v_i}$ is omitted.
Observe that the boundary of an $n$-simplex is an $(n - 1)$-chain.
We now extend the boundary map to a homomorphism $\partial_n : C_n(X) \to C_{n-1}(X)$ in the only way possible:
\begin{equation}
\partial_n(g_1A_{1}^n + g_2A_{2}^n + \ldots + g_kA_{k}^n) = g_1 \partial_n(A_{1}^n) + g_2 \partial_n(A_{2}^n) + \ldots + g_k \partial_n(A_{k}^n).
\end{equation}
$\textbf{Theorem}$
If $A \in C_n(X)$ is any $n$-chain, then $\partial_{n-1} \circ \partial_n(A) = 0$.
$\textbf{Proof}$
We simply compute. It suffices to check this in the case that $A = [v_0,...,v_n]$ is an $n$-simplex because the boundary maps are homomorphisms. Then we have
\begin{aligned}
\partial_{n-1} \circ \partial_n(A) &= \partial_{n-1} \left( \sum_{i=0}^{n} (-1)^i [v_0,...,\hat{v}_i,...,v_n] \right) \\
&= \sum_{i=0}^{n} (-1)^i \partial_{n-1} [v_0,...,\hat{v}_i,...,v_n] \\
&= \sum_{i=0}^{n} (-1)^i \left( \sum_{j=0}^{i-1} (-1)^j [v_0,...,\hat{v}_j,...,\hat{v}_i,...,v_n] + \sum_{j=i+1}^{n} (-1)^{j-1} [v_0,...,\hat{v}_i,...,\hat{v}_j,...,v_n] \right).
\end{aligned}
In the final expression on the right, we see that there are exactly two terms missing both $v_i$ and $v_j$. But what are the signs? Suppose that $i < j$. Then it occurs once with coefficient $(-1)^i (-1)^{j-1} = (-1)^{i+j-1}$ by removing first $v_i$ and then $v_j$, and once with coefficient $(-1)^j (-1)^i = (-1)^{i+j}$ by first removing $v_j$ and then removing $v_i$. The sum of these two coefficients is $0$, so the coefficient of the $(n - 2)$-simplex $[v_0,...,\hat{v}_i,...,\hat{v}_j,...,v_n]$ is $0$. This is true for each $(n - 2)$-simplex, so $\partial_{n-1} \circ \partial_n(A) = 0$, as desired.
$\textbf{Definition}$
A sequence
\begin{equation}
\ldots \xrightarrow{\phantom{\partial_{n+1}}} C_{n+1} \xrightarrow{\partial_{n+1}} C_n \xrightarrow{\partial_n} C_{n-1} \xrightarrow{\partial_{n-1}} C_{n-2} \xrightarrow{\partial_{n-2}} \ldots \xrightarrow{\partial_2} C_1 \xrightarrow{\partial_1} C_0 \xrightarrow{\partial_{0}} 0
\end{equation}
of abelian groups is called a chain complex if $\partial_n \circ \partial_{n+1} = 0$ for all $n$.
$\textbf{Definition}$
We call $\ker(\partial_n) \leq C_n(X)$ the group of $n$-cycles and denote it by $Z_n(X)$, and we call $\text{im}(\partial_{n+1}) \leq C_n(X)$ the group of $n$-boundaries and denote it by $B_n(X)$.
$\textbf{Remark}$
Recall that we motivated homology by describing it as measuring $n$-dimensional holes, up to triviality. The cycles $Z_n(X)$ are the holes. Note that a hole, such as a loop, has trivial boundary—which is exactly what defines a cycle. The boundaries $B_n(X)$ are the trivial holes, because if $c \in B_n(X)$ is the boundary of some $a \in C_{n+1}(X)$, then the hole $c$ is filled in by $a$.
At last, we can define homology. We know that $B_n(X) \leq Z_n(X)$; the homology is a measure of the discrepancy between these two groups.
$\textbf{Definition}$ The $n$-th homology group of $X$ is the quotient group $H_n(X) = Z_n(X)/B_n(X)$.
Note that elements of $H_n$ are cosets of $\text{im}(\partial_{n+1})$, called $\textit{homology classes}$. Two cycles representing the same homology class are said to be $homologous$. This means their difference is a boundary.
$\textbf{EXAMPLE}$
Let us compute the homology groups of a torus, as shown in Figure 13.3.

We need to calculate the boundary maps for the torus. For the 2-chains, we have $\partial_2(U) = -e - f + g$ and $\partial_2(L) = e + f - g$. We can see this geometrically: as we go around the edges of $U$ (for example), in the direction indicated by the orientation of $U$, we go along $g$ in the "right direction," but we go along $e$ and $f$ in the "wrong direction." Hence, the signs on $\partial_2(U)$ are positive for $g$ and negative for $e$ and $f$. For the 1-chains, we have $\partial_1(e) = \partial_1(f) = \partial_1(g) = a - a = 0$: there's only one vertex $a$, and all three of those edges both start and end at $a$. All other boundary maps in dimensions other than 1 and 2 are 0.
Now let us compute the homology. We start with $H_2$. We have $Z_2(T) = \langle U + L \rangle$, because $\partial_2(U + L) = 0$. Now, $B_2(T) = 0$, because there are no 3-chains. Hence $H_2(T) = \langle U + L \rangle \cong \mathbb{Z}$: the free abelian group with one generator, called $U + L$.
Now let us compute $H_1$. We have $Z_1(T) = \langle e, f, g \rangle$, because all the boundaries are 0, whereas $B_1(T) = \langle e + f - g \rangle$. Calculating $H_1(T)$ out of this data requires a bit of finesse now: it's $Z_1(T)/B_1(T)$, but what is that as an abstract abelian group? If we quotient out by $\langle e + f - g \rangle$, that means that $e + f - g = 0$ in $H_1(T)$. Thus, we may "solve for $g$" and replace every instance of $g$ with $e + f$. So, given a cycle $a_1e + a_2f + a_3g$, we may rewrite that as $(a_1 + a_3)e + (a_2 + a_3)f$ in $H_1(T)$. Furthermore, every cycle involving only $e$'s and $f$'s is distinct in $H_1(T)$, so we have
\begin{equation}
H_1(T) \cong \langle e, f \rangle \cong \mathbb{Z}^2.
\end{equation}
Finally, there's $H_0$. We have $Z_0(T) = C_0(T) = \langle a \rangle \cong \mathbb{Z}$, whereas $B_0(T) = 0$, because the boundary of every 1-chain is 0. Hence $H_0(T) \cong \mathbb{Z}$. All other homology groups are 0. Thus we have calculated:
\begin{equation}
H_n(T) \cong
\begin{cases}
\mathbb{Z} & \text{if } n = 0, 2, \\
\mathbb{Z}^2 & \text{if } n = 1, \\
0 & \text{if } n \geq 3.
\end{cases}
\end{equation}
# The Zeroth Homology Group
The 0-dimensional homology group $H_0$ is easy to understand in general. If $X$ is path-connected, then $H_0(X) \cong \mathbb{Z}$. Why? Pick a vertex (0-simplex) $a$ in the triangulation of $X$. Then $\{na\}$ are all distinct elements in $H_0(X)$, for if $ma$ and $na$ were equal in $H_0(X)$, then they would have to differ by a boundary $\partial_1(c)$ for some $c \in C_1(X)$. However, the sum of the coefficients in $\partial_1(c)$ is always zero, so this cannot happen. Now, suppose that $a$ and $b$ are two vertices in $X$. Then there is some sequence of (oriented) edges $e_1, \ldots, e_r$ that starts at $a$ and ends at $b$. Thus $\partial_1(e_1 + \ldots + e_r) = b - a$, so $b - a \in B_0(X)$, so it is zero in $H_0(X)$, i.e., $a = b$ in $H_0(X)$. Thus we have shown the following:
$\textbf{Proposition}$
If $X$ is path-connected, then $H_0(X) \cong \mathbb{Z}$.
More generally, if $X$ consists of $k$ path-components, then $H_0(X) \cong \mathbb{Z}^k$ for the same reason.
# Homology of the Klein Bottle
We now compute the homology of the Klein bottle, which will turn out to have a special surprise! We can use almost the same picture as a torus, but now one of the edges (say, the left edge) must switch orientation, as shown in Figure 13.4.

We now compute the boundary maps. We have
\begin{align}
\partial_2(U) & = e - f + g, \\
\partial_2(L) & = e + f - g, \\
\partial_1(e) & = \partial_1(f) = \partial_1(g) = 0.
\end{align}
Hence
\begin{align}
Z_2(X) & = 0, \\
B_2(X) & = 0, \\
Z_1(X) & = \langle e, f, g \rangle, \\
B_1(X) & = \langle e - f + g, e + f - g \rangle.
\end{align}
We don't need to compute $H_0$, because we already know it: The Klein bottle is path-connected, so $H_0(K) \cong \mathbb{Z}$.
Clearly, $H_2(K) = 0$, but what about $H_1(K)$? We have
\begin{aligned}
H_1(K) & = Z_1(K)/B_1(K) \\
& = \langle e, f, g \rangle/\langle e - f + g, e + f - g \rangle \\
& = \langle e, f, g \,|\, e - f + g, e + f - g \rangle \\
& = \langle e, f \,|\, 2e \rangle \\
& \cong \mathbb{Z} \times \left(\mathbb{Z}/{2\mathbb{Z}}\right).
\end{aligned}
This means that, while $e$ is not a boundary of any 2-dimensional submanifold, $2e$ is! What is this submanifold? It's just the Klein bottle itself: cut along $e$, and you have a cylinder, with two boundary components, both labeled $e$. But here, the boundary components have the same orientation, so the boundary consists of both copies of $e$. Contrast this with the case of the torus, where we can again cut along $e$ to obtain a cylinder, but then the boundary components are oriented in opposite directions, so they cancel out in $Z_1(T^2)$.