\chapter{Homological Algebra}
\label{homological}


Homological algebra begins with the notion of a \emph{differential object,}
that is, an object with an endomorphism $A \stackrel{d}{\to} A$ such that $d^2 =
0$. This equation leads to the obvious inclusion $\im(d) \subset \ker(d)$, but
the inclusion generally is not equality. We will find that the difference
between $\ker(d)$ and $\im(d)$, called the \emph{homology}, is a highly useful
variant of a differential object: its first basic property is that if an exact
sequence
\[ 0 \to A' \to A \to A'' \to 0  \]
of differential objects is given, the homology of $A$ is related to that of
$A', A''$ through a long exact sequence. The basic example, and the one we
shall focus on, is where $A$ is a
chain complex, and $d$ the usual differential.
In this case, homology simply measures the failure of a complex to be exact.

After introducing these preliminaries, we develop the theory of \emph{derived
functors}. Given a functor that is only left or right-exact, derived functors
allow for an extension of a partially exact sequence to a long exact sequence.
The most important examples to us, $\mathrm{Tor}$ and $\mathrm{Ext}$, provide
characterizations of flatness, projectivity, and injectivity.

\section{Complexes}


\subsection{Chain complexes}
The chain complex is the most fundamental construction in
homological algebra.

\begin{definition} Let $R$ be a ring. A \textbf{chain complex} is a collection
of $R$-modules
$\{C_i\}$ (for $i \in \mathbb{Z}$)
together with boundary
operators
$\partial_i:C_i\rightarrow C_{i-1}$ such that
$\partial_{i-1}\partial_i=0$. The boundary map is also
called the
\textbf{differential.} Often, notation is abused and the indices for
the boundary map are dropped.

A chain complex is often simply denoted $C_*$.
\end{definition}

In practice, one often has that $C_i = 0$ for $i<0$.


\begin{example} All exact sequences are chain complexes.
\end{example}

\begin{example} Any sequence of abelian groups $\left\{C_i\right\}_{i \in
\mathbb{Z}}$ with the boundary operators
identically zero forms a chain complex. 
\end{example}

We will see plenty of more examples in due time.

At each stage, elements in the image of the boundary $C_{i+1} \to C_i$ lie in
the kernel of $\partial_i: C_i \to C_{i-1}$. 	Let us recall that a chain
complex is \emph{exact} if the kernel and the image coincide. In general, a
chain complex need not be exact, and this failure of exactness is measured by
its homology.

\begin{definition} 
Let $C_*$
The submodule of cycles $Z_i\subset C_i$ is
the kernel $\ker(\partial_i)$. The submodule of boundaries
$B_i\subset C_i$ is the image $Im(\partial_{i+1})$. Thus
homology is said to be ``cycles mod boundaries,'' i.e.
$Z_i/B_i$.
\end{definition}

To further simplify notation, often all differentials regardless
of what chain complex they are part of are denoted $\partial$,
thus the commutativity relation on chain maps is
$f\partial=\partial f$ with indices and distinction between the
boundary operators dropped.


\begin{definition} Let $C_*$ be a chain complex with boundary
map $\partial_i$.
We define the \textbf{homology} of the complex $C_*$ via
$H_i(C_*)=\ker(\partial_i)/Im(\partial_{i+1})$.
\end{definition}

\begin{example} In a chain complex $C_*$ where all the boundary
maps are
trivial, $H_i(C_*)=C_i$. 
\end{example}

Often we will bundle all the modules $C_i$ of a chain complex
together to form a graded module $C_*=\bigoplus_i C_i$. In this
case, the boundary operator is a
endomorphism that takes elements from degree $i$ to degree
$i-1$. Similarly, we
often bundle together all the homology modules to give a graded
homology module
$H_*(C_*)=\bigoplus_i H_i(C_*)$.

\begin{definition} 
A \textbf{differential module} is a module $M$ together with a morphism $d:
M\to M$ such that $d^2 =0$.
\end{definition} 

Thus, given a chain complex $C_*$, the module $\bigoplus C_i$ is a
differential module with the direct sum of all the differentials $\partial_i$.
A chain complex is just a special kind of differential module, one where the
objects are graded and the differential drops the grading by one.

\subsection{Functoriality}
We have defined chain complexes now, but we have no notion of a morphism
between chain complexes.
We do this next; it turns out that chain complexes form a category when morphisms
are appropriately defined.

\begin{definition} A \textbf{morphism} of chain complexes $f:C_*\rightarrow
D_*$, or a \textbf{chain map}, is a sequence of maps $f_i:C_i\rightarrow
D_i$ such that $f\partial = \partial' f$ where $\partial$ is the
boundary map of $C_*$ and $\partial'$ of $D_*$ (again we are
abusing notation and dropping indices). 
\end{definition}

There is thus a \emph{category} of chain complexes where the morphisms are
chain maps.

One can make a similar definition for differential modules. If $(M, d)$ and
$(N,d')$ are differential modules, then a \emph{morphism of differential
modules} $(M,d) \to (N,d')$ is a morphism of modules $M \to N$ such that the diagram 
\[ 
\xymatrix{
M \ar[d] \ar[r]^d &  M \ar[d] \\
N \ar[r]^{d'} &  N
}
\]
commutes. 
There is therefore a category of differential modules, and the map $C_* \to
\bigoplus C_i$ gives a functor from the category of chain complexes to that of
differential modules.


\begin{proposition} A chain map $C_* \to D_*$ induces a map in homology $H_i(C)
\to H_i(D)$ for each $i$; thus homology is a covariant functor from
the category of chain complexes to the category of graded
modules.
\end{proposition}

More precisely, each $H_i$ is a functor from chain complexes to modules.
\begin{proof}
Let $f:C_*\rightarrow D_*$ be a chain map. Let $\partial$ and
$\partial'$ be the differentials for $C_*$ and $D_*$
respectively. Then we have a commutative diagram:

\begin{equation}
\begin{CD}
C_{i+1} @>\partial_{i+1}>> C_i @>>\partial_i> C_{i-1}\\
@VV f_{i+1} V          @VV f_i V             @VVf_{i-1} V\\
D_{i+1} @>\partial'_{i+1}>> D_i @>>\partial'_i> D_{i-1}
\end{CD}
\end{equation}

Now, in order to check that a chain map $f$ induces a map $f_*$
on homology, we need to check that $f_*(Im(\partial))\subset
Im(\partial')$ and $f_*(\ker(\partial))\subset
\ker(\partial)$. We first check the condition on images: we want
to look at $f_i(Im(\partial_{i+1}))$. By commutativity of $f$
and the boundary maps, this is equal to
$\partial'_{i+1}(Im(f_{i+1})$. Hence we have
$f_i(Im(\partial_{i+1}))\subset Im(\partial_{i+1}')$. For the
condition on kernels, let $x\in \ker(\partial_i)$. Then by
commutativity, $\partial'_i(f_i(x))=f_{i-1}\partial_i(x)=0$.
Thus we have that $f$ induces for each $i$ a homomorphism
$f_i:H_i(C_*)\rightarrow H_i(D_*)$ and hence it induces a
homomorphism on homology as a graded module. \end{proof}

\begin{exercise} 
Define the \emph{homology} $H(M)$ of a differential module $(M, d)$ via $\ker d / \im
d$. Show that $M \mapsto H(M)$ is  a functor from differential modules to
modules.
\end{exercise} 


\subsection{Long exact sequences}
\add{OMG! We have all this and not the most basic theorem of them all.}

\begin{definition} If $M$ is a complex then for any integer $k$, we define a new complex $M[k]$ by shifting indices, i.e. $(M[k])^i:=M^{i+k}$.\end{definition}

\begin{definition} If $f:M\rightarrow N$ is a map of complexes, we define a complex $\mathrm{Cone}(f):=\{N^i\oplus M^{i+1}\}$ with differential
$$d(n^i,m^{i+1}):= (d_N^i(n_i)+(-1)^i\cdot f(m^{i+1}, d_M^{i+1}(m^{i+1}))$$
\end{definition}

Remark:  This is a special case of the total complex construction to be seen later.

\begin{proposition} A map $f:M\rightarrow N$ is a quasi-isomorphism if and only if $\mathrm{Cone}(f)$ is acyclic.\end{proposition}

\begin{proposition}  Note that by definition we have a short exact sequence of complexes
$$0\rightarrow N\rightarrow \mathrm{Cone}(f)\rightarrow M[1]\rightarrow 0$$
so by Proposition 2.1, we have a long exact sequence
$$\dots \rightarrow H^{i-1}(\mathrm{Cone}(f))\rightarrow H^{i}(M)\rightarrow H^{i}(N)\rightarrow H^{i}(\mathrm{Cone}(f))\rightarrow\dots$$
so by exactness, we see that $H^i(M)\simeq H^i(N)$ if and only if $H^{i-1}(\mathrm{Cone}(f))=0$ and $H^i(\mathrm{Cone}(f))=0$.  Since this is the case for all $i$, the claim follows. $\blacksquare$
\end{proposition}



\subsection{Cochain complexes}
Cochain complexes are much like chain complexes except the
arrows point in the
opposite direction.

\begin{definition} A \textbf{cochain complex} is a sequence of modules
$C^i$ for $i \in \mathbb{Z}$ with \textbf{coboundary operators}, also
called
\textbf{differentials}, $\partial^i:C^i\rightarrow C^{i+1}$ such that
$\partial^{i+1}\partial^i=0$. \end{definition}

The theory of cochain complexes is entirely dual to that of chain complexes,
and we shall not spell it out in detail.
For instance, we can form a category of cochain complexes and
\textbf{chain maps} (families of morphisms commuting with the
differential). Moreover, given a cochain complex $C^*$, we
define the
\textbf{cohomology objects} to be
$h^i(C^*)=\ker(\partial^i)/Im(\partial^{i-1})$; one obtains cohomology
functors.

It should be noted that the long exact sequence in cohomology runs in the
opposite direction. 
If $0 \to C_*' \to C_* \to C_*'' \to 0$ is a short exact sequence of cochain
complexes, we get a long exact sequence
\[ \dots \to H^i(C' ) \to H^i(C) \to H^{i}(C'') \to H^{i+1}(C' ) \to H^{i+1}(C) \to
\dots.  \]

Similarly, we can also turn cochain complexes and cohomology
modules into a
graded module.

Let us now give a standard example of a cochain complex.
\begin{example}[The de Rham complex] Readers unfamiliar with differential
forms may omit this example. Let $M$ be a smooth manifold. For each $p$, let
$C^p(M)$ be the $\mathbb{R}$-vector space of smooth $p$-forms on $M$.
We can make the $\left\{C^p(M)\right\}$ into a complex by defining the maps
\[ C^p(M) \to C^{p+1}(M)  \]
via $\omega \to d \omega$, for $d$ the exterior derivative. 
(Note that $d^2 = 0$.)  This complex is called the \textbf{de Rham complex} of
$M$, and its cohomology is called the \textbf{de Rham cohomology.} It is known
that the de Rham cohomology is isomorphic to singular cohomology with real
coefficients. 

It is a theorem, which we do not prove, that the de Rham cohomology is
isomorphic to the singular cohomology of $M$ with coefficients in $\mathbb{R}$.
\end{example} 

\subsection{Long exact sequence}

\subsection{Chain Homotopies}

In general, two maps of complexes $C_* \rightrightarrows D_*$ need not be
equal to induce the same morphisms in homology. It is thus of interest to
determine conditions when they do. One important condition is given by chain
homotopy: chain homotopic maps are indistinguishable in homology. In algebraic
topology, this fact is used to show that singular homology is a homotopy
invariant.
We will find it useful in showing that the construction (to be given later) of a
projective resolution is essentially unique.

\begin{definition} Let $C_*, D_*$ be chain complexes with differentials $d_i$. A chain homotopy between two chain maps
$f,g:C_*\rightarrow D_*$ is a series of homomorphisms
$h^i:C^i\rightarrow D^{i-1}$ satisfying $f^i-g^i=d h^i+
h^{n+1}d$. Again often notation is abused and the
condition is written $f-g=d h +
hd$.
\end{definition}

\begin{proposition} If two morphisms of complexes $f,g: C_* \to D_*$ are chain homotopic, they are taken
to the same induced map after applying the homology functor.
\end{proposition}

\begin{proof} 
Write $\left\{d_i\right\}$ for the various differentials (in both complexes).
Let $m\in Z_i(C)$, the group of $i$-cycles. 
Suppose there is a chain homotopy $h$ between $f,g$ (that is, a set of
morphisms $C_i \to D_{i-1}$).
Then
$$f^i(m)-g^i(m)= h^{i+1}\circ d^i(m) + d^{i-1}\circ h^i(m)= d^{i-1}\circ H^i(m) \in \Im(d^{i-1})$$
which is zero in the cohomology $H^i(D)$. 
\end{proof}


\begin{corollary} If two chain complexes are chain homotopically equivalent
(there are maps $f: C_*\rightarrow D_*$ and $g:D_*\rightarrow
C_*$ such that both $fg$ and $gf$ are chain homotopic to the
identity), they have isomorphic homology.
\end{corollary}
\begin{proof} 
Clear.
\end{proof} 

\begin{example}  Not every quasi-isomorphism is a homotopy equivalence.  Consider the complex
$$\dots \rightarrow 0\rightarrow\mathbb{Z}/{\cdot 2}\rightarrow \mathbb{Z}\rightarrow 0\rightarrow 0\rightarrow\dots$$
so $H^0=\mathbb{Z}/2\mathbb{Z}$ and all cohomologies are 0.  We have a quasi-isomorphism from the above complex to the complex
$$\dots \rightarrow 0\rightarrow 0 \rightarrow \mathbb{Z}/2\mathbb{Z}\rightarrow 0\rightarrow 0\rightarrow\dots$$
but no inverse can be defined (no map from $\mathbb{Z}/2\mathbb{Z}\rightarrow \mathbb{Z}$).
\end{example}


\begin{proposition} Additive functors preserve chain homotopies
\end{proposition}
\begin{proof} Since an additive functor $F$ is a homomorphism on $Hom(-,-)$,
the chain homotopy condition will be preserved; in
particular, if $t$ is a chain homotopy, then $F(t)$ is a chain
homotopy.
\end{proof}

In more sophisticated homological theory, one often makes the
definition of the ``homotopy category of chain complexes.''
\begin{definition} The homotopy category of chain complexes is
the category $hKom(R)$ where objects are chain complexes of
$R$-modules and morphisms are chain maps modulo chain homotopy.
\end{definition}


\subsection{Topological remarks}

\add{add more detail}
The first homology theory
to be developed was simplicial homology - the study of homology
of simplicial
complexes. To be simple, we will not develop the general theory
and instead
motivate our definitions with a few basic examples.

\begin{example} Suppose
our simplicial complex has one line segment with both ends
identified at
one point $p$. Call the line segment $a$. The $n$-th homology
group of this
space roughly counts how many ``different ways'' there are of
finding $n$
dimensional sub-simplices that have no boundary that aren't the
boundary of
any $n+1$ dimensional simplex. For the circle, notice that for
each integer,
we can find such a way (namely the simplex that wraps counter
clockwise that
integer number of times). The way we compute this is we look at
the free abelian group generated by $0$ simplices, and $1$
simplices (there are no simplices of
dimension $2$ or higher so we can ignore that). We call these
groups $C_0$ and
$C_1$ respectively. There is a boundary map $\partial_1:
C_1\rightarrow C_0$.
This boundary map takes a $1$-simplex and associates to it its
end vertex minus
its starting vertex (considered as an element in the free
abelian group on
vertices of our simplex). In the case of the circle, since there
is only one
$1$-simplex and one $0$-simplex, this map is trivial. We then
get our homology
group by looking at $\ker(\partial_1)$. In the case that there
is a nontrivial
boundary map $\partial_2: C_2\rightarrow C_1$ (which can only
happen when our
simplex is at least $2$-dimensional), we have to take the
quotient
$\ker(\partial_1)/\ker(\partial_2)$. This motivates us to define
homology in a
general setting.
\end{example}

Originally homology was
intended to be a homotopy invariant meaning that space with the
same homotopy type would have isomorphic homology modules. In fact, any
homotopy induces what is now known as a chain homotopy on the simplicial chain
complexes.

\begin{exercise}[Singular homology] Let $X$ be a topological
space and let $S^n$ be the set of all continuous maps
$\Delta^n\rightarrow X$ where $\Delta^n$ is the convex hull of
$n$ distinct points and the origin with orientation given by an
ordering of the $n$ vertices. Define $C_n$ to be the free
abelian group generated by elements of $S^n$. Define
$\Delta^n_{\hat{i}}$ to be the face of $\Delta^n$ obtained by
omitting the $i$-th vertex from the simplex. We can then
construct a boundary map $\partial_n:C_n\rightarrow C_{n-1}$ to
take a map $\sigma^n:\Delta^n\rightarrow X$ to
$\sum_{i=0}^n(-1)^i\sigma^n|_{\Delta^n_{\hat{i}}}$. Verify that
$\partial^2=0$ (hence making $C_*$ into a chain complex known as
the ``singular chain complex of $X$''. Its homology groups are
the ``singular homology groups''. \end{exercise}

\begin{exercise} Compute the singular homology groups of a
point. \end{exercise}

\section{Derived functors}
\subsection{Projective resolutions}

Fix a ring $R$.
Let us recall (\rref{projectives}) that an $R$-module $P$ is called
\emph{projective} if the functor $N \to \hom_R(P,N)$ (which is always
left-exact) is exact.

Projective objects are useful in defining chain exact sequences
known as ``projective resolutions.'' In the theory of derived functors, the
projective resolution of a module $M$ is in some sense a replacement for $M$:
thus, we want it to satisfy some uniqueness and existence properties. The
uniqueness is not quite true, but it is true modulo chain equivalence.

\begin{definition} Let $M$ be an arbitrary module, a projective
resolution of
$M$ is an exact sequence
\begin{equation} \cdots\rightarrow P_i\rightarrow
P_{i-1}\rightarrow
P_{i-2}\cdots\rightarrow P_1\rightarrow P_0\rightarrow M
\end{equation} where
the $P_i$ are projective modules. \end{definition}


\begin{proposition} Any module admits a projective resolution. \end{proposition}
The proof will even show that we can take a \emph{free} resolution.
\begin{proof} 
We construct the resolution inductively. 
First, we take a projective module $P_0$ with $P_0 \twoheadrightarrow N$
surjective by the previous part.  Given a portion of the resolution
\[ P_n \to P_{n-1} \to \dots \to P_0 \twoheadrightarrow N \to 0  \]
for $n \geq 0$, which is exact at each step, we consider $K = \ker(P_n \to
P_{n-1})$. The sequence 
\[ 0 \to K \to P_n \to P_{n-1} \to \dots \to P_0 \twoheadrightarrow N \to 0  \]
is exact. So if $P_{n+1}$ is chosen such that it is projective and there is an
epimorphism
\( P_{n+1} \twoheadrightarrow K,  \)
(which we can construct by \rref{freesurjection}), then
\[ P_{n+1} \to P_n \to \dots  \]
is exact at every new step by construction. We can repeat this inductively and
get a full projective resolution.
\end{proof}

Here is a useful observation:
\begin{proposition}
If $R$ is noetherian, and $M$ is finitely generated, then we can
choose a
projective resolution where each $P_i$ is finitely generated.
\end{proposition}
We can even take a resolution consisting of finitely generated free modules.
\begin{proof}
To say that $M$ is finitely generated is to say that it is a
quotient of a free module on
finitely many generators, so we can take $P_0$ free and finitely generated. The kernel
of $P_0 \to M$
is finitely generated by noetherianness, and we can proceed as
before, at each step
choosing a finitely generated object.
\end{proof}

\begin{example} The abelian group $\mathbb{Z}/2$ has the free
resolution $0\rightarrow\cdots
0\rightarrow\mathbb{Z}\rightarrow\mathbb{Z}\rightarrow\mathbb{Z}/2$.
Similarly, since any finitely generated abelian group can be
decomposed into the direct sum of torsion subgroups and free
subgroups, all finitely generated abelian groups admit 
a free resolution of length two.

Actually, over a principal ideal domain $R$ (e.g. $R=\mathbb{Z}$),
\emph{every} module admits a free resolution of length two. The reason is that
if $F \twoheadrightarrow M$ is a surjection with $F$ free, then the kernel $F'
\subset F$ is free by a general fact (\add{citation needed}) that a submodule
of a free module is free (if one works over a PID). So we get a free
resolution of the type
\[ 0 \to F' \to F \to M \to 0.  \]
\end{example}


In general, projective resolutions are not at all unique. 
Nonetheless, they \emph{are} unique up to chain homotopy. Thus a projective
resolution is a rather good ``replacement'' for the initial module.

\begin{proposition} 
Let $M, N$ be modules and let $P_* \to M, P'_* \to N$ be projective
resolutions. Let $f: M \to N$ be a morphism. Then there is a morphism
\[ P_* \to P'_*  \]
such that the following diagram commutes:
\[ 
\xymatrix{
\dots \ar[r] &  P_1 \ar[r] \ar[d]  &  P_0 \ar[r] \ar[d]  &  M \ar[d]^f  \\
\dots \ar[r] &  P'_1 \ar[r] &  P'_0 \ar[r] &  N
}
\]
This morphism is unique up to chain homotopy.
\end{proposition} 

\begin{proof} 
Let $P_* \to M$ and $P'_* \to N$ be projective resolutions. We will define a
morphism of complexes $P_* \to P'_* $ such that the diagram commutes. 
Let the boundary maps in $P_*, P'_*$ be denoted $d$  (by abuse of notation). 
We have an exact diagram
\[ 
\xymatrix{
\dots \ar[r] &  P_n \ar[r]^d &  P_{n-1} \ar[r]^d &  \dots \ar[r]^d & P_0
\ar[r]&  M \ar[d]^{f} \ar[r] &  0 \\
\dots \ar[r] &  P'_n \ar[r]^d &  P'_{n-1} \ar[r] &  \dots \ar[r]^d & P'_0 \ar[r] &  N \ar[r] &  0 
}
\]
Since $P'_0 \twoheadrightarrow N$ is an epimorphism, the map $P_0 \to M \to N$ lifts
to a map $P_0 \to P'_0$ making the diagram
\[ \xymatrix{
P_0 \ar[d] \ar[r] &  M \ar[d]^{f} \\ 
P'_0 \ar[r] &  N
}\]
commute. 
Suppose we have defined maps $P_i \to P'_i$ for $i \leq n$ such that the
following diagram commutes:
\[ 
\xymatrix{
P_n \ar[r]^d \ar[d]  &  P_{n-1} \ar[r]^d \ar[d] &  \dots \ar[r]^d & P_0
\ar[d]  \ar[r]&  M \ar[d]^{f} \ar[r] &  0 \\
P'_n \ar[r]^d &  P'_{n-1} \ar[r] &  \dots \ar[r]^d & P'_0 \ar[r] &  N \ar[r] &  0 
}
\]
Then we will define $P_{n+1} \to P'_{n+1}$, after which induction will prove
the existence of a map. To do this, note that 
the map
\[ P_{n+1} \to P_n \to P'_n \to P'_{n-1}  \]
is zero, because this is the same as $P_{n+1} \to P_n \to P_{n-1} \to P'_{n-1}$
(by induction, the diagrams before $n$ commute), and this is zero because two
$P$-differentials were composed one after another. In particular, in the diagram
\[ 
\xymatrix{
P_{n+1}   \ar[r] &  P_n \ar[d]  \\
P'_{n+1} \ar[r] & P'_n
},
\]
the image in $P'_n$ of $P_{n+1}$ lies in the kernel of $P'_n \to P'_{n-1}$,
i.e. in the image $I$ of $P'_{n+1}$.  The exact diagram
\[ 
\xymatrix{
& P_{n+1} \ar[d]  \\
P'_{n+1} \ar[r] & I \ar[r] &  0
}
\]
shows that we can lift $P_{n+1} \to I$ to $P_{n+1} \to P'_{n+1}$ (by
projectivity). This implies that we can continue the diagram further and get a
morphism $P_* \to P'_* $ of complexes. 	



Suppose $f, g: P_* \to P'_*$ are two morphisms of the projective resolutions
making $$\xymatrix{
P_0 \ar[r] \ar[d] &  M \ar[d] \\ 
P'_0 \ar[r] &  N
}$$ commute. We will show that $f,g$ are chain homotopic. 

For this,
we start by defining $D_0: P_0 \to P'_1$ such that $dD_0 = f-g: P_0 \to P'_0$.
This we can do because $f-g$ sends $P_0$ into $\ker(P'_0 \to N)$, i.e. into the
image of $P'_1 \to P'_0$, and $P_0$ is projective.
Suppose we have defined chain-homotopies $D_i: P_{i} \to P_{i+1}$ for $i \leq
n$ such that $dD_i + D_{i-1}d = f-g$ for $i \leq n$. We will define $D_{n+1}$.
There is a diagram
\[ 
\xymatrix{
 & P_{n+1} \ar[d]  \ar[r] &  P_n \ar[ld]^{D_n}\ar[d] \ar[r] & P_{n-1}
 \ar[ld]^{D_{n-1}} \ar[d]  \\
P'_{n+2} \ar[r] & P'_{n+1}   \ar[r] &  P'_n  \ar[r] & P'_{n-1}  \\
}\]
where the squares commute regardless of whether you take the vertical maps to
be $f$ or $g$ (provided that the choice is consistent). 	

We would like to define $D_{n+1}: P_n \to P'_{n+1}$. 
The key condition we need satisfied is that
\[ d D_{n+1} = f - g - D_n d.  \]
However, we know that, by the inductive hypothesis on the $D$'s
\[ d( f- g - D_{n}d) = fd  - gd - dD_n d = fd - gd - (f-g)d + D_n dd = 0.  \]
In particular, $f-g - D_n d$ lies in the image of $P'_{n+1} \to P'_n$.
The projectivity of $P_n$ ensures that we can define $D_{n+1}$ satisfying the
necessary condition. 

\end{proof} 


\begin{corollary} 
Let $P_* \to M, P'_* \to M$ be projective resolutions of $M$. Then there are
maps $P_* \to P'_*, P'_* \to P_* $ under $M$ such that the compositions are
chain homotopic to the identity.
\end{corollary} 
\begin{proof} 
Immediate.
\end{proof} 

\subsection{Injective resolutions}

One can dualize all this to injective resolutions. \add{do this}

\subsection{Definition}
Often in homological algebra, we see that ``short exact
sequences induce long exact sequences.'' Using the theory of
derived functors, we can make this formal.

Let us work in the category of modules over a ring $R$. Fix two such categories.
Recall that a right-exact functor $F$ (from the category of modules over a
ring to the category of modules over another ring) is an additive functor
 such that for every short
exact sequence $0\rightarrow A\rightarrow B\rightarrow
C\rightarrow 0$, we get a exact sequence $F(A)\rightarrow
F(B)\rightarrow F(C)\rightarrow 0$.

We want a natural way to continue this exact sequence to the
left; one way of doing this is to define the left derived
functors.
\begin{definition} Let $F$ be a right-exact functor and
$P_*\rightarrow M$ are projective resolution. We can form a
chain complex $F(P_*)$ whose object in degree $i$ is $F(P_i)$
with boundary maps $F(\partial)$. The homology of this chain
complex denoted $L_iF$ are the left derived functors.
\end{definition}

For this definition to be useful, it is important to verify that
deriving a functor yields functors independent on choice of
resolution. This is clear by \rref{}.

\begin{theorem} The following properties characterize derived
functors: \begin{enumerate}
\item{ $L_0F(-)=F(-)$ }
\item{ Suppose $0\rightarrow A\rightarrow B\rightarrow
C\rightarrow 0$ is an exact sequence and $F$ a right-exact
functor; the left derived functors fit into the following exact
sequence:

\begin{equation} \cdots L_iF(A)\rightarrow L_iF(B)\rightarrow
L_iF(C)\rightarrow L_{i-1}F(A)\cdots\rightarrow
L_1(C)\rightarrow L_0F(A)\rightarrow L_0F(B)\rightarrow
L_0F(C)\rightarrow 0 \end{equation}}
\end{enumerate}
\end{theorem}
\begin{proof} The second property is the hardest to prove, but
it is by far the most useful; it is essentially an application
of the snake lemma. \end{proof}
One can define right derived functors analogously; if one has a
left exact functor (an additive functor that takes an exact
sequence $0\rightarrow A\rightarrow B\rightarrow C\rightarrow 0$ to
$0\rightarrow F(A)\rightarrow F(B)\rightarrow F(C)$), we can
pick an injective resolution instead (the injective criterion is simply the
projective criterion with arrows reversed). If
$M\rightarrow I^*$ is a injective resolution then the cohomology of the chain
complex $F(I^*)$ gives the right derived functors.
However, variance must also be taken into consideration so the
choice of whether or not to use a projective or injective
resolution is of importance (in all of the above, functors were
assumed to be covariant). In the following, we see an example of when right
derived functors can be computed using projective
resolutions.

\subsection{$\ext$ functors}

\begin{definition} The right derived functors of $Hom(-,N)$ are
called the $Ext$-modules denoted $Ext^i_R(-,N)$.
\end{definition}
We now look at the specific construction:

Let $M, M'$ be $R$-modules. Choose a projective resolution
\[ \dots \to P_2 \to P_1 \to P_0 \to M \to 0  \]
and consider what happens when you hom this resolution into $N$.
Namely, we can
consider $\hom_R(M,N)$, which is the kernel of $\hom(P_0, M)
\to\hom(P_1, M) $
by exactness of the sequence
\[ 0 \to \hom_R(M,N) \to \hom_R(P_0, N) \to \hom_R(P_1, N) . \]
You might try to continue this with the sequence
\[ 0 \to \hom_R(M,N) \to \hom_R(P_0, N) \to \hom_R(P_1, N) \to
\hom_R(P_2, N)
\to \dots. \]
In general, it won't be exact, because $\hom_R$ is only
left-exact. But it is a
chain complex. You can thus consider the homologies.

\begin{definition}
The homology of the complex $\{\hom_R(P_i, N)\}$ is denoted
$\ext^i_R(M,N)$. By
definition, this is $\ker(\hom(P_i,N) \to \hom(P_{i+1},
N))/\im(\hom(P_{i-1},
N) \to \hom(P_i,N))$. This is an $R$-module, and is called the
$i$th ext group.
\end{definition}



Let us list some properties (some of these properties are just
case-specific examples of general properties of derived
functors)

\begin{proposition}
$\ext_R^0(M,N) = \hom_R(M,N)$.
\end{proposition}
\begin{proof}
This is obvious from the left-exactness of $\hom(-,N)$. (We
discussed this.)
\end{proof}

\begin{proposition}
$\ext^i(M,N)$ is a functor of $N$.
\end{proposition}
\begin{proof}
Obvious from the definition.
\end{proof}

Here is a harder statement.
\begin{proposition}
$\ext^i(M,N)$ is well-defined, independent of the projective
resolution $P_*
\to M$, and is in fact a contravariant additive functor of
$M$.\footnote{I.e. a map $M
\to M'$ induces $\ext^i(M', N) \to \ext^i(M,N)$.}
\end{proposition}
\begin{proof}
Omitted. We won't really need this, though; it requires more
theory about
chain complexes.
\end{proof}


\begin{proposition}
If $M$ is annihilated by some ideal $I \subset R$, then so is
$\ext^i(M,N)$ for
each $i$.
\end{proposition}
\begin{proof}
This is a consequence of the functoriality in $M$. If $x \in
I$,then $x: M \to
M$ is the zero map, so it induces the zero map on
$\ext^i(M,N)$.\end{proof}

\begin{proposition}
$\ext^i(M,N) = 0$ if $M$ projective and $i>0$.
\end{proposition}
\begin{proof}
In that case, one can use the projective resolution
\[ 0 \to M \to M \to 0.  \]
Computing $\ext$ via this gives the result.
\end{proof}




\begin{proposition}
If there is an exact sequence
\[ 0 \to N' \to N \to N'' \to 0,  \]
there is a long exact sequence of $\ext$ groups
\[ 0 \to \hom(M,N') \to \hom(M,N) \to \hom(M,N'') \to
\ext^1(M,N') \to
\ext^1(M,N) \to \dots  \]
\end{proposition}
\begin{proof}
This proof will assume a little homological algebra. Choose a
projective
resolution $P_* \to M$. (The notation $P_*$ means the chain
complex $\dots \to
P_2 \to P_1 \to P_0$.) In general, homming out of $M$ is not
exact, but homming
out of a projective module is exact. For each $i$, we get an
exact sequence
\[ 0 \to \hom_R(P_i, N') \to \hom_R(P_i, N) \to \hom_R(P_i,
N'')\to 0, \]
which leads to an exact sequence of \emph{chain complexes}
\[ 0 \to \hom_R(P_*,N') \to \hom_R(P_*,N) \to \hom_R(P_*,N'')
\to 0 . \]
Taking the long exact sequence in homology gives the result.
\end{proof}


Much less obvious is:

\begin{proposition}
There is a long exact sequence in the $M$ variable. That is, a
short exact
sequence
\[ 0 \to M' \to M \to M'' \to 0  \]
leads a long exact sequence
\[ 0 \to \hom_R(M'', N) \to \hom_R(M,N) \to \hom_R(M', N) \to
\ext^1(M'', N)
\to \ext^1(M, N) \to \dots.  \]
\end{proposition}
\begin{proof}
Omitted.
\end{proof}

We now can characterize projectivity:
\begin{corollary}
TFAE:
\begin{enumerate}
\item $M$ is projective.
\item $\ext^i(M,N) = 0$ for all $R$-modules $N$ and $i>0$.
\item  $\ext^1(M,N)=0$ for all $N$.
\end{enumerate}
\end{corollary}
\begin{proof}
We have seen that 1 implies 2 because projective modules have
simple projective
resolutions. 2 obviously implies 3. Let's show that 3 implies
1.Choose a
projective module $P$ and a surjection $P \twoheadrightarrow M$
with kernel
$K$. There is a short exact sequence $0 \to K \to P \to M \to
0$. The sequence
\[ 0 \to \hom(M,K) \to \hom(P,K) \to \hom(K,K) \to
\ext^1(M,K)=0\]
shows that there is a map $P \to K$ which restricts to the
identity $K \to K$.
The sequence $0 \to K \to P \to M \to 0$ thus splits, so $M$ is
a direct
summand in a projective module, so is projective.
\end{proof}


Finally, we note that there is another way of constructing
$\ext$. We
constructed them by choosing a projective resolution of $M$. But
you can also
do this by resolving $N$ by \emph{injective} modules.
\begin{definition}
An $R$-module $Q$ is \textbf{injective} if $\hom_R(-,Q)$ is an
exact (or,
equivalently, right-exact) functor. That is, if $M_0 \subset M$
is an inclusion
of $R$-modules, then any map $M_0 \to Q$ can be extended to $M
\to Q$.
\end{definition}

If we are given $M,N$, and an injective resolution $N \to Q_*$,
we can look at
the chain complex $\left\{\hom(M,Q_i)\right\}$, i.e. the chain
complex
\[ 0 \to \hom(M, Q^0) \to \hom(M, Q^1) \to \dots  \]
and we can consider the cohomologies.

\begin{definition}
We call these cohomologies
\[ \ext^i_R(M,N)' = \ker(\hom(M, Q^i) \to \hom(M,
Q^{i+1}))/\im(\hom(M,
Q^{i-1}) \to \hom(M, Q^i)).  \]
\end{definition}

This is dual to the previous definitions, and it is easy to
check that the
properties that we couldn't verify for the previous $\ext$s are
true for the
$\ext'$'s.

Nonetheless:

\begin{theorem}
There are canonical isomorphisms:
\[ \ext^i(M,N)' \simeq \ext^i(M,N).  \]
\end{theorem}

In particular, to compute $\ext$ groups, you are free either to
take a
projective resolution of $M$, or an injective resolution of
$N$.\begin{proof}[Idea of proof]
In general, it might be a good idea to construct a third more
complex
construction that resembles both. Given $M,N$ construct a
projective resolution
$P_* \to M$ and an injective resolution $N \to Q^*$. Having made
these choices,
we get a \emph{double complex}
\[ \hom_R(P_i, Q^j)  \]
of a whole lot of $R$-modules. The claim is that in such a
situation, where
you have a double complex $C_{ij}$, you can
form an ordinary chain complex $C'$
by adding along the diagonals. Namely, the $n$th term
is $C'_n = \bigoplus_{i+j=n} C_{ij}$. This \emph{total complex}
will receive a
map from the chain complex used to compute the $\ext$ groups
and a chain
complex used to compute the $\ext'$ groups. There are maps on
cohomology,
\[ \ext^i(M,N) \to H^i(C'_*), \quad \ext^i(M,N)' \to H^i(C'_*).
\]
The claim is that isomorphisms on
cohomology will be induced in each case. That will prove the
result, but we
shall not prove the claim.
\end{proof}

Last time we were talking about $\ext$ groups over commutative
rings. For $R$ a
commutative ring and $M,N$ $R$-modules, we defined an $R$-module
$\ext^i(M,N)$ for
each $i$, and proved various properties. We forgot to mention
one.

\begin{proposition}
If $R$ noetherian, and $M,N$ are finitely generated,
$\ext^i(M,N)$ is also finitely generated.
\end{proposition}
\begin{proof}
We can take a projective resolution $P_*$ of $M$ by finitely
generated free modules, $R$ being
noetherian. Consequently the complex $\hom(P_*, N)$ consists of
finitely
generated modules. Thus the cohomology is finitely generated,
and this cohomology
consists of the $\ext$ groups.
\end{proof}

\subsection{Application: Modules over DVRs}


\begin{definition} Let $M$ be a module over a domain $A$. We say that $M$ is \underline{torsion-free}, if for any nonzero $a \in A$, $a:M \to M$ is injective. We say that $M$ is \underline{torsion} if for any $m \in M$, there is nonzero $a \in A$ such that $am=0$.
\end{definition}

\begin{lemma} For any module finitely generated module $M$ over a Noetherian domain $A$, there is a short exact sequence
\[0 \to M_{tors} \to M \to M_{tors-free} \to 0\]
where $M_{tors}$ is killed by an element of $A$ and $M_{tors-free}$ is torsion-free.
\label{tors tors-free ses}
\end{lemma}
\begin{proof} This is because we may take $M_{tors}$ to be all the elements which are killed by a non-zero element of $A$. Then this is clearly a sub-module. Since $A$ is Noetherian, it is finitely generated, which means that it can be killed by one element of $A$ (take the product of the elements that kill the generators). Then it is easy to check that the quotient $M/M_{tors}$ is torsion-free.
\end{proof}

\begin{lemma} For $R$ a PID, a module $M$ over $R$ is flat if and only if it is torsion-free.
\label{PID means flat=tors free}
\end{lemma}
\begin{proof} This is the content of Problem 2 on the Midterm.
\end{proof}

Using this, we will classify modules over DVRs.

\begin{proposition} let $M$ be a finitely generated module over a DVR $R$. Then
\[M=M_{tors}\oplus R^{\oplus n},\] i.e, where $M_{tors}$ can be annihilated by $\pi^n$ for some $n$.
\end{proposition}
\begin{proof}
Set $M_{tors} \subset M$ be as in Lemma \ref{tors tors-free ses} so that $M/M_{tors}$ is torsion-free. Therefore, by Corollary \ref{DVR is PID} and Lemma \ref{PID means flat=tors free} we see that it is flat. But it is over a local ring, so that means that it is free. So we have $M/M_{tors}=R^{\oplus n}$ for some $n$. Furthermore, since $R^{\oplus n}$ is free, it is additionally projective, so the above sequence splits, so
\[M=M_{tors} \oplus R^{\oplus n}\]
as desired.
\end{proof}

There is nothing more to say about the free part, so let us discuss the torsion part in more detail.

\begin{lemma} Any finitely generated torsion module over a DVR is
\[\bigoplus R/\pi^nR.\]
\label{dvr fin gen tor module struct}
\end{lemma}
Before we prove this, let us give two examples:
\begin{enumerate}
\item Take $R=k[[t]]$, which is a DVR with maximal ideal (t). Thus, by the lemma, for a finitely generated torsion module $M$, $t:M \to M$ is a nilpotent operator. However, $k[[t]]/t^n$ is a Jordan block so we are exactly saying that linear transformations can be written in Jordan block form.
\item Let $R=\mathbb{Z}_p$. Here the lemma implies that finitely generated torsion modules over $\mathbb{Z}_p$ can be written as a direct sum of $p$-groups. 
\end{enumerate}
Now let us proceed with the proof of the lemma.
\begin{proof}[Proof of Lemma \ref{dvr fin gen tor module struct}] Let $n$ be the minimal integer such that $\pi^n$ kills $M$. This means that $M$ is a module over $R_n=R/\pi^nR$, and also there is an element $m \in M$, and an injective map $R_n \hookrightarrow M$, because we may choose $m$ to be an element which is not annihilated by $\pi^{n-1}$, and then take the map to be $1 \mapsto m$.

Proceeding by induction, it suffices to show that the above map $R_n \hookrightarrow M$ splits. But for this it suffices that $R_n$ is an injective module over itself. This property of rings is called the Frobenius property, and it is very rare. We will write this as a lemma.
\begin{lemma} $R_n$ is injective as a module over itself.
\label{Rn Frobenius}
\end{lemma}
\begin{proof}[Proof of Lemma \ref{Rn Frobenius}] Note that a module $M$ over a ring $R$ is injective if and only if for any ideal $I \subset R$, $\Ext^1(R/I,M)=0$. This was shown on  Problem Set 8, Problem 2a.

Thus we wish to show that for any ideal $I$, $\Ext^1_{R_n}(R_n/I,R_n)=0$. Note that since $R$ is a DVR, we know that it is a PID, and also any element has the form $r=\pi^kr_0$ for some $k \geq 0$ and some $r_0$ invertible. Then all ideals in $R$ are of the form $(\pi^k)$ for some $k$, so all ideals in $R_n$ are also of this form. Therefore, $R_n/I=R_m$ for some $m \leq n$, so it suffices to show that for $m \leq n$, $\Ext^1_{R_n}(R_m,R_n)=0$.

But note that we have short exact sequence
\[ 0 \to R_{n-m} \to^{\pi^m \cdot} R_n \to R_m \to 0\]
which gives a corresponding long exact sequence of $\Ext$s
\[0 \to \Hom_{R_n}(R_m,R_n) \to \Hom_{R_n}(R_n,R_n) \to^\hearts \Hom_{R_n}(R_{n-m},R_n)\]
\[\to \Ext^1_{R_n}(R_m,R_n) \to \Ext^1_{R_n}(R_n,R_n) \to \cdots\]
But note that any map of $R_n$ modules, $R_{n-m} \to R_n$, must map $1 \in R_{n-m}$ to an element which is killed by $\pi^{n-m}$, which means it must be a multiple of $\pi^m$, so say is is $\pi^ma$. Then the map is
\[r \mapsto \pi^mar,\]
which is the image of the map
\[[r \mapsto ar] \in \Hom_{R_n}(R_n,R_n).\]
Thus, $\hearts$ is surjective.
Also note that $R_n$ is projective over itself, so $\Ext^1_{R_n}(R_n,R_n)=0$. This, along with the surjectivity of $\hearts$ shows that
\[\Ext^1_{R_n}(R_m,R_n)=0\]
as desired.
\end{proof}
As mentioned earlier, this lemma concludes our proof of Lemma \ref{dvr fin gen tor module struct} as well.
\end{proof}



