## (Co)homology and Exactness


## Exactness

Given some sequence of objects and morphisms

$$\ldots\to A\xrightarrow fB\xrightarrow gC\to\ldots$$

we say that the sequence is a complex at $B$ if $g\circ f=0$. If you come from a differential geometry context, you may be more familiar with the term closed. If a sequence is a complex everywhere, we call it a chain complex. We say that the sequence is exact at $B$ if $\ker g=\im f$ (more precisely, there exists a map $\im f\to B$ which is a kernel map of $g$). An exact sequence is a sequence that is exact everywhere. The following result shouldn't be surprising.

Theorem: If a sequence is exact at $B$, it is a complex at $B$.

Proof: As observed in the previous post, $f$ can be factored into a map $f^*:A\to\im f$ and a kernel map $k:\im f\to B$. So, $g\circ f=g\circ k\circ f^*$. $g\circ k=0$, so that completes the proof.

A short exact sequence is an exact sequence with $5$ terms, with the first and last being $0$ (essentially, replace the $\ldots$ with $0$ in the sequence above).

Basic Examples:

• The sequence

$$0\to A\xrightarrow fB$$

is exact iff $f$ is a monomorphism. In particular, if $B=0$, $A=0$. Likewise, the sequence

$$A\xrightarrow fB\to0$$

is exact iff $f$ is an epimorphism.

• A classic short exact sequence is defined for any non-trivial principal ideal $\langle k\rangle\subset R$, where $R$ is a commutative integral domain:

$$0\to R\xrightarrow{\times k}R\to R/\langle k\rangle\to0$$

We can generalize as follows: given any monomorphism $f:A\to B$ with cokernel $g:B\to C$, observe that $g$ is an epimorphism and $g\circ f=0$. Thus, the following is a short exact sequence:

$$0\to A\xrightarrow fB\xrightarrow gC\to0$$

## (Co)homology

Let's consider the following chain complex.

$$\ldots\to A\xrightarrow fB\xrightarrow gC\to\ldots$$

The homology of the sequence at $B$ is $\ker g/\im f$. There are several equivalent ways to characterize this (convince yourself of the equivalence of these notions via the lemmas of the Abelian Categories post.

1. $\cok(\im f\to\ker g)$
2. $\ker(\cok f\to\coim g)$
3. $\im(\ker g\to \cok f)$

Thus, exactness is equivalent to the homology being trivial. We call the elements of $\ker g$ (assuming that category is concrete) cycles and the elements of $\im f$ boundaries, as the standard pedagogical example of homology is that of homology groups of simplicial complexes.

Generally, for sequences in which we are interested in homology, we index the objects decreasingly (i.e., $A_i\to A_{i-1}\to\ldots$), and define $H_i$ as the homology at $A_i$.

If the indexes are increasing, we call the homology the cohomology, and the cohomology at $A_i$ is denoted by $H^i$.

## Factoring long sequences

An infinite exact sequence is sometimes called a long exact sequence if it is infinite. Likewise, a chain complex is sometimes called long if it is infinite. Long sequences can be tough to deal with, so we try to factor long sequences into short ones.

Consider the following chain complex:

$$A^*:\qquad\ldots\xrightarrow{}A^{i-1}\xrightarrow{f^{i-1}}A^i\xrightarrow{f^i}A^{i+1}\xrightarrow{f^{i+1}}\ldots$$

We will construct short exact sequences which represent the data of the complex.

Let $k$ be the kernel of $f^i$, $f^*:A^i\to\im f^i$ the unique morphism satisfying $f^i=\im f\circ f^*$, and $g:X\to A^i$ some morphism such that $f^*\circ g=0$. Thus, $0=\im f\circ f^*\circ g=f^i\circ g$, so by kernel properties of $k$, there exists a unique $k^*$ such that $g=k\circ k^*$. Since this works for any $g$, this shows that $k$ is a kernel for $f^*$, so $\ker f^*=\ker f^i$. But, $k$ is a monomorphism, so $\im f^i=\ker f^i$. Thus, we have $\ker f^*=\im k$. These results are summarized in the diagram below:

As $k$ is monic and $f^*$ is epic, we have the following short exact sequence:

$$0\to\ker f^i\xrightarrow{k}A^i\xrightarrow{f^*}\im f^i\to0$$

This is an interesting short exact sequence, but it doesn't contain any information regarding the cocycle condition, as it only involves one morphism from the original chain complex. Let's construct another short exact sequence to encode that information.

Since $f^i\circ f^{i-1}=0$, if $k:\ker f^i\to A^i$ is the kernel of $f^i$ and $c:A^i\to\cok f^{i-1}$ is the cokernel of $f^{i-1}$, then there exists a unique $f^{i-1}_*:A^{i-1}\to\ker f^i$ and a unique $f^i_*:\cok f^{i-1}\to A^i$ such that $f^{i-1}=k\circ f^{i-1}_*$ and $f^i=f^i_*\circ c$. If $i:\im f^{i-1}\to A^i$ is the kernel of $c$ (and thus the image of $f^{i-1}$), then $f^i\circ i=f^i_*\circ c\circ i=f^i_*\circ0=0$. Thus, by the kernel properties of $k$, there exists a unique morphism $j:\im f^{i-1}\to\ker f^i$ such that $k\circ j=i$. Since $k,i$ are monic as they are kernels, so is $j$. These observations are summarized in the diagram below:

By the second basic example of a short exact sequence, the following sequence is a short exact sequence.

$$0\to\im f^{i-1}\xrightarrow j\ker f^i\to H^i(A^*)\to0$$

By duality, we also have the following short exact sequences:

$$0\to\im f^i\to A^{i+1}\to\cok f^i\to0$$$$0\to H^i(A^*)\to\cok f^{i-1}\to\im f^i\to0$$

If $A^*$ is exact at $A^i$, i.e., $H^i(A^*)=0$, then our exact sequences become$$0\to\ker f^i\to A^i\to\ker f^{i+1}\to0$$$$0\to\im f^{i-1}\xrightarrow{\text{id}}\ker f^i\to0$$The latter sequence has no content, so we are left with one short exact sequence.

## Abelian Categories


In this post, we'll be defining abelian categories, which have a technical definition, but can be thought intuitively as categories that behave similarly to $Mod_A$.

Definition: An additive category is a category $\mathfrak C$, such that for any $A,B,C\in\mathfrak C$:

1. $\Mor(A,B)$ has a binary operation $+$ such that $\Mor(A,B)$ is an abelian group. We call the identity element $0_{AB}$.
2. $\circ:\Mor(B,C)\times\Mor(A,B)\to\Mor(A,C)$ is a bilinear mapping (linear on each input).
3. There exists a zero-object $0\in\mathfrak C$.
4. There exists $A\times B\in\mathfrak C$ (not necessarily unique, but unique up to isomorphism, as seen in a previous post).

For additive categories, we rename $\Mor$ to $\Hom$, representing sets of homomorphisms. An additive functor is a functor between additive categories respecting their structure.

• If $Z$ is the zero-object, then $|\Hom(Z,Z)|=1$, so the sole element must be the identity map, which also is $0_{ZZ}$. And, if $\id_Z=0_{ZZ}$, then by property $2$, $f=\id\circ f=(\id+\id)\circ f=\id\circ f+\id\circ f=f+f$, so $f=0$ for all $f$. This implies that the homomorphism group $\Hom(Z,A)$ for any $A$ is trivial (and by a symmetric argument, $\Hom(A,Z)$ is trivial), so $Z$ is the zero-object. Thus, $Z$ is a zero object iff $\id_Z=0_{ZZ}$.
• For any objects $A,B\in\mathfrak A$, and additive functor $F:\mathfrak A\to\mathfrak B$, $F$ induces a group homomorphism $\Hom(A,B)\to\Hom(F(A),F(B))$ via $f\mapsto F(f)$. Thus, $F(0_{ZZ})=0_{F(Z)F(Z)}$, and $F(\id_Z)=\id_{F(Z)}$. Thus, zero objects are mapped to other zero objects.
• $F(A\times B)=F(A)\times F(B)$. This can be shown by mapping each of the maps in the universal property diagram of the product.
• The first bullet unintentionally proves that $0\circ f=f\circ 0=0$ for any morphism $f$ and for any $0$ morphism. This necessarily implies that $0_{AB}=A\to0\to B$, where $0$ is a zero-object, and $A\to0$ and $0\to B$ are the unique morphisms in $\Hom(A,0)$ and $\Hom(0,B)$. In fact, it's convenient to define $0_{AB}$ this way for categories with zero objects.
• Additive categories also have coproducts. In fact, products and coproducts (as long as they are finite) are isomorphic! This will be proven below. This is why the finite product of abelian groups and finite direct sum of abelian groups are isomorphic.
• $Mod_A$ is additive. All the properties are pretty easy to verify so it is left to the reader.

Theorem: In an additive category $\mathfrak A$ with objects $A,B\in\mathfrak A$, the coproduct $A\sqcup B$ exists, as $A\times B$ satisfies its diagram.

Proof: Let $p:A\times B\to A$ and $q:A\times B\to B$ be the projection maps that define $A\times B$ as the product. Let $i:A\to A\times B$ be defined by the product diagram below:

And likewise, let $j:B\to A\times B$ be defined by the product diagram below:

Then, we can draw the following commutative diagram:

This diagram is essentially the two previous diagrams glued together. Now, consider some $W\in\mathfrak A$ with morphisms $\alpha:A\to W$ and $\beta: B\to W$. Let $\phi=\beta\circ q+\alpha\circ p:A\times B\to W$. Note that $\phi\circ i=\beta\circ q\circ i+\alpha\circ p\circ i=\beta\circ0+\alpha\circ\id=\alpha$. And $\phi\circ j=\beta$.

Next, observe that the following diagram commuting implies that $i\circ p+j\circ q=\id_{A\times B}$.

Thus, for any map $f:A\times B\to W$, $f=f\circ\id_{A\times B}=f\circ i\circ p+f\circ j\circ q$. If $f$ satisfies the coproduct diagram (i.e., $f\circ i=\alpha$, $f\circ j=\beta$), then $f=\alpha\circ p+\beta\circ q=\phi$. This tells us that $\phi$ satisfies the diagram and is the unique map to do so, and thus $A\sqcup B$ exists since $A\times B$ satisfies the diagram.

As hinted upon earlier in our remarks, we can actually define the direct sum as the product endowed with the morphisms $i,j$ as defined above. It's not hard to see that $i,j$, and the product fully determine $p,q$, so some definitions endow the product with all $4$ maps.

## (Co)kernels

The categorical notion of a kernel generalizes the algebraic notion of kernels, by defining them as the largest object that gets mapped to $0$ by a morphism.

Let $\mathfrak C$ be a category with a zero-object called $0$. For some morphism $f:B\to C$, the kernel is an object $A$ paired with an inclusion $i:A\hookrightarrow B$ such that $f\circ i=0$, and for any other object $A^*$ with map $i^*$ with the aforementioned properties, there exists a unique map $k:A^*\to A$ such that $i^*=i\circ k$ (you should recognize this as the standard universal property trick to ensure uniqueness of the kernel). In diagram form, we have

A cokernel is a dual of the kernel: simply reverse the arrows in the diagram above. We can define kernels more simply as the limit of the diagram below:

and similarly, we can define the cokernel as the colimit of the reversed diagram. I chose not to define quotient spaces earlier on (which probably lead to some rather tedious work-arounds) since quotient objects can be defined strictly as cokernels of additive categories.

Kernel maps are often indicated by $\hookrightarrow$ or $\rightarrowtail$. Cokernel maps are often indicated by $\twoheadrightarrow$.

• Kernels in categories with zero objects (and thus $0$-morphisms) are monomorphisms. For any kernel $k:K\to A$ of $f:A\to B$, and for any $g:C\to K$, observe that $f\circ k\circ g=0$, so by the universal property of the kernel, $g$ is unique. By an identical argument, cokernels are epimorphisms.
• The kernel map (if it exists) is the $0$ map iff $f$ is a monomorphism (this should make sense: what is the kernel of an injection?). For one direction, note that $f\circ\ker f=0=f\circ 0$, and since $f$ is a monomorphism, $\ker f=0$. For the other, observe that for any $g,h$ with $f\circ g=f\circ h$, $f\circ(g-h)=0$. So, if $f\circ i\neq0$ for all $i\neq0:C\to A$, then $f$ is a monomorphism. Now for any map $i:C\to A$, if $f\circ i=0$, by the kernel property, there exists a map $k:C\to0$ such that $i=k\circ l$, where $l$ is the kernel morphism. $k=0$, so $i=0$. This shows $f$ is a monomorphism.

This argument in the dual proves that the cokernel map is the $0$ map iff $f$ is an epimorphism. When $f$ is a monomorphism, we say that $A$ is a subobject of $B$. When $f$ is an epimorphism, we say $B$ is a quotient object of $A$.

Remark: (co)kernels are morphisms. But, we'll often refer to them as objects. In particular, kernels are maps $k:A\to B$, so if we refer to the kernel as an object, we mean $A$. If we refer to the kernel as a map, we mean $k$. Likewise, for cokernel $j:A\to B$, if we refer to an object, we mean $B$. If we refer to a map, we mean $j$.

## Abelian Categories

As our tangent on kernels and cokernels showed us, kernels (cokernels) are monomorphisms (epimorphisms) if they exist. But we might ask the reverse question: are all monomorphisms (epimorphisms) kernels (cokernels) of some map? In the study of abelian groups, this is the case, and is known as the first isomorphism theorem of group theory. Abelian categories are defined to generalize this concept.

Definition: An abelian category is an additive category $\mathfrak A$ such that

1. Every morphism has a kernel and cokernel
2. Every monomorphism is the kernel of some morphism (i.e., monomorphisms are normal).
3. Every epimorphism is the cokernel of some morphism (i.e., epimorphisms are normal).

Some terminology/facts used in abelian categories for a morphism $f:A\to B$:

• The image of $f$ is defined by $\im(f)=\ker(\cok(f))$. Likewise, the coimage of $f$ is defined as $\operatorname{coim}(f)=\cok(\ker(f))$.
• As mentioned earlier, if $f$ is a monomorphism, the cokernel is called the quotient. We notate $\cok(f)$ as $B/A$.
• Freyd-Mitchell Embedding Theorem: For any abelian category $\mathfrak C$, there exists an exact, fully faithful functor $F:\mathfrak C\to Mod_A$ for some ring $A$ such that it embeds $\mathfrak C$ as a full subcategory. We'll talk about exactness in a future post, so ignore that for now. The main conclusion of this theorem is that all of the results about cokernels, kernels, and images in $Mod_A$ directly translate to abelian categories.

Some important results to show the power of these conditions:

Lemma 1: For any epimorphism $g:B\to C$, $g=\operatorname{coim}(g)$.

Let $f$ be a map such that $g=\cok(f)$. Let $k=\ker(g)$. By kernel properties, there exists a map $f^*$ satisfying the diagram above. Let $y$ be a morphism such that $y\circ k=0_{IY}$ as in the diagram. Thus, $y\circ f=y\circ k\circ f^*=0_{AY}$, so by the cokernel properties of $g$, there exists a unique $y^*$ such that $y^*\circ g=y$. Thus, $g$ is also the cokernel of $k$, and thus the coimage of itself. The dual argument shows that for any monomorphism $f:A\to B$, $f=\im(f)$.

Lemma 2: If $f:A\to B$ is a monomorphism and epimorphism, it is an isomorphism.

From lemma $1$, $\cok(\ker(f))=f$. And, from a result above, $\ker f=0$. The cokernel of the $0$ map is clearly an isomorphism by universal properties of the cokernel.

Lemma 3: For any $f:A\to B$, the induced map $i:\operatorname{coim} f\to B$ is monic.

Let $k=\ker f$, $p=\cok(k)=\operatorname{coim} f$. Thus, since $p$ is the cokernel of $k$, and $f\circ k=0$, there exists a unique $i:\operatorname{coim} f\to B$ such that $i\circ p=f$. We've seen earlier that if for any $x: X\to \operatorname{coim} f$, $i\circ x=0$ implies $x=0$, then $i$ is monic. Let $x$ be such a map. Let $q:\operatorname{coim} f\to\cok x$ be the cokernel of $x$. By the same argument as above, there exists a unique $j: \cok x\to B$ such that $i=j\circ q$. We can summarize these results in the diagram below:

Since epimorphisms are preserved under composition, $q\circ p$ is epimorphic, and thus, there exists a morphism $h:C\to A$ such that $q\circ p=\cok h$. So, $f\circ h=j\circ q\circ p\circ h=0$. By the kernel properties of $k$, there exists a unique $h^*$ such that $h=k\circ h^*$. Thus, $p\circ h=p\circ k\circ h^*=0\circ h^*=0$. By the cokernel properties of $q\circ p$, there exists a unique $p^*$ such that $p=p^*\circ q\circ p$. Since $p$ is epimorphic, we have $p^*\circ q=\id$. Thus, $q$ is monic, and since we have $q\circ x=0$, that implies $x=0$, so $i$ must be monic.

Dually, the induced map $j:A\to\im f$ is epic.

Lemma 4: For any $f:A\to B$, there exists a unique morphism $f^*:\operatorname{coim} f\to\im f$ that satisfies the diagram below. It is also an isomorphism.

Let $j:A\to\im f$ be defined as in Lemma $3$. Thus, $f\circ\ker f=\im f\circ j\circ \ker f=0$. Since we showed in Lemma $4$ that $\im f$ is monomorphic, $j\circ\ker f=0$. Thus, since $\operatorname{coim} f$ is the cokernel of $\ker f$, there exists a unique $f^*$ such that $f^*\circ\operatorname{coim} f=j$.

But, $A\to\im f$ being epic and $\operatorname{coim} f\to B$ being monic implies $f^*$ is epic and monic, which by Lemma $2$ implies that $f^*$ is an isomorphism. Because of this, we often call the coimage object of $f$ the image object of $f$ as well.

## Examples

All but the first example are non-abelian, as we'll encounter important examples of abelian categories later.

• $Mod_A$ for any commutative ring $A$ is abelian. This construction would be pointless otherwise.
• Consider the subcategory of $Mod_\mathbb R$ consisting of just the spaces of even dimension. The map $f:\mathbb R^2\to\mathbb R^2$ given by $(a,b)\mapsto(a,0)$ is a morphism on this category, but it has no kernel. This category is additive but not abelian.
• Ring is not additive, since it doesn't have a zero-object.
• The category of torsion free abelian groups is additive but not abelian. Consider the map $\phi:\mathbb Z\to\mathbb Z$, $\phi(n)=2n$. Suppose $\phi$ has a cokernel $f:\mathbb Z\to X$ in the category. Thus, $f\circ\phi=0$. In particular, $f(2)=0$. So, $f(1)+f(1)=0$, and since $X$ is torsion-free, $f(1)=0$, which implies that $X=\{0\}$. Thus, if the cokernel of $\phi$ exists, it is $\mathbb Z\to0$. But that's an issue, since the kernel of the map $\mathbb Z\to\mathbb Z$ is $\id_{\mathbb Z}$, which would imply that $\phi$ is not monic, a contradiction.

## Yoneda Lemma


Let $h_A$ be the functor of points for object $A$. Thus, for any $f:C\to D\in\mathfrak C$, $h_A(f):\Mor(D,A)\to\Mor(C,A)$.

Lemma: Suppose that for two objects $A,B\in\mathfrak C$, there are morphisms $i_C:\Mor(C,A)\to\Mor(C,B)$ for every $C\in\mathfrak C$ that commute with the morphisms $h_A(f)$ as defined earlier in the natural way (see diagram below). Thus, there exists $g:A\to B$ such that $i_C:u\mapsto g\circ u$ for all $C\in\mathfrak C$. If $i_C$ is a bijection for all $C$, then $g$ is an isomorphism.

Proof: Let $g=i_A(\id)$. Thus, letting $D=A$, we transform the diagram to

If we consider the morphism $\id\in\Mor(A,A)$, the diagram tells us that $i_C(f)=g\circ f$. If $i_B$ is a bijection, there exists some $f:B\to A$ such that $i_B(f)=\id$. Thus, $g\circ f=\id$, and this shows that $g$ is an isomorphism.

This lemma also holds with the arrows in the diagrams above flipped, and with the functor of points replaced with $\Mor(C,-)$. We'll call this covariant functor $h^C$.

Lemma: There exists a natural bijection between the collection of natural transformations $h^A\to h^B$ and $\Mor(B,A)$.

Proof: A natural transformation $h^A\to h^B$ needs to assign to each $C\in\mathfrak C$ a morphism $m_C:h^A(C)\to h^B(C) = \Mor(A,C)\to\Mor(B,C)$. Clearly, for any $f\in\Mor(B,A)$, we can let $m_C=h_C(f)$, as the commutative diagram for natural transformations is satisfied below for any $r:C\to D\in\mathfrak C$.

This gives us an injection from $\Mor(B,A)$ to the collection of natural transformations. The first lemma gives us an injection in the reverse direction.

We can write a similar lemma about natural transformations between $h_A\to h_B$ and $\Mor(A,B)$.

We call any contravariant functor $F:\mathfrak C\to\textbf{Set}$, representable iff there exists a natural isomorphism $\epsilon:F\to h_A$ for some $A\in\mathfrak C$. We call $A$ the representing object, and it's not hard to see that it is determined up to unique isomorphism by $(F,\epsilon)$.

We call $\epsilon^{-1}(\id_A)$ the universal object of $\mathfrak C$.

Yoneda's Lemma: For a functor $F:\mathfrak C\to\textbf{Set}$, there exists a bijection between the collection of natural transformations $h^A\to F$ and $F(A)$. (This lemma can also be defined for contravariant functors, but the proof is a dual to this proof). This induces a natural isomorphism between the functors $\Mor(h^{(-)},F)$ and $F(-)$.

Proof: Let $\phi:h^A\to F$ be a natural transformation. For every $B\in\mathfrak C$, we have a mapping $\phi_B:\Mor(A,B)\to F(B)$ such that for any $f:X\to Y\in\mathfrak C$, the following diagram commutes:

Letting $X=A$, we know that $\id\in\Mor(A,A)$. Letting $g=\phi_A(\id)$ (the universal object), the diagram tells us that for any $f:A\to Y\in\mathfrak C$, $\phi_Y(f)=F(f)(g)$.

Thus, $\phi_Y$ is fully determined by $g$, meaning that the map $\phi\mapsto g$ is an injection. Thus, we have an injection from the set of natural transformations of $h^A\to F$, and the set $F(A)$.

For the opposite direction, note that for any $x\in F(A)$, $B\in\mathfrak C$, $\phi_B:f\mapsto F(f)(x)$ is an injection. But this is the implication of the first lemma, and thus we are done.

Thus, Yoneda's lemma tells us that given a category, we can produce a category of contravariant functors from the category to Set, with morphisms as natural transformations. And, we have a functor from the original category to the new one which sends any object to its functor of points. And, this mapping is fully faithful.

## Universal Properties


In this post, we'll go over some valuable universal properties. All of them are unique, but the proofs of these won't be provided since they are essentially identical to that of the product's uniqueness.

For a lot of universal properties, the intuition behind the definitions is unclear from the setup, but examples can often help show the purpose of the properties. I've provided a few examples for each property.

Here are my rough impressions of what the following properties resemble

• Initial/Final/Zero objects: the trivial objects in a category
• Tensor Product: Product with module structure
• Limits: Products under some equivalence relation
• Colimits: Disjoint unions under some equivalence relation
• Adjoints: Pair of functors that are inverses of each other in a natural way.
• Monomorphism: Has a left inverse
• Epimorphism: Has a right inverse

Remark: Monomorphisms and Epimorphisms need not be injective/surjective respectively, but they are equivalent to injectivity/surjectivity on the category of sets. More on that later.

## Initial/Final/Zero Objects

An object $C\in\mathfrak C$ is initial if for all $A\in\mathfrak C$, $|\Mor(C,A)|=1$. Likewise, an object $C\in\mathfrak C$ is final if for all $A\in\mathfrak C$, $|\Mor(A,C)|=1$. An object $C\in\mathfrak C$ is called the zero object if it is both initial and final.

• $\varnothing$ is an initial object for Set and Top. Any singleton is a final object for Set and Top.
• $\{0\}$ unsurprisingly is a final object for Ring, the category of rings. The initial object of Ring is $\mathbb Z$, with $\mathbb Z\to A$ given by $n\mapsto n\cdot 1_A$ ($1_A$ is the multiplicative identity of $A$).
• In the category of Field, there is no initial nor final object, as there are no field homomorphisms between fields of different characteristics (since $1\mapsto1$). But, if we limit to the category of fields of a particular characteristic $n$, $\mathbb Z/n\mathbb Z$ (with $\mathbb Z/0\mathbb Z$ defined to be $\mathbb Q$.) is an initial object.
• For any commutative ring $A$ and $S\subset A$, we can define $S^{-1}A$ as the initial element of the category of $A$-algebras that send every element of $S$ to a unit. Observe that the initial element exists if $S$ is a multiplicative subset of $A$. We call $S^{-1}A$, if it exists, the localization of $A$ at $S$.

## Tensor Products

Given two elements $M,N\in Mod_A$, we define $M\otimes_A N$, the tensor product of $M,N$, as the $A$-module, paired with an $A$-bilinear map $\phi:M\times N\to M\otimes N$, that satisfies the diagram below for any $A$-bilinear map $f:M\times N\to Z$, where $Z\in Mod_A$.

• The tensor product always exists: the classical construction is as follows: let $M\hat\times N$ be the $A$-module generated by symbols of the form $m\otimes n$, where $m\in M$, $n\in N$, i.e., $M\hat\times N$ consists of finite $A$-linear combinations of these symbols. Then, quotient $M\hat\times N$ via the following equivalences: $a(m\otimes n)=(am)\otimes n=m\otimes(an)$, $(a+b)\otimes c=a\otimes c+b\otimes c$, $a\otimes(c+d)=a\otimes c+a\otimes d$. The result is an $A$-module that satisfies the universal property, and thus, is the constructive definition of the tensor product.
• $\mathbb Z/n\mathbb Z\otimes_\mathbb Z\mathbb Z/m\mathbb Z\cong\mathbb Z/\operatorname{gcd}(n,m)\mathbb Z$. I'm not aware of a proof that solely uses the universal property definition of the tensor product rather than the constructive one for this result.
• If $M\in Mod_A$, and $A\to B$ is a ring morphism, we can view $B\otimes_A M$ as a $B$-module, since it's an abelian group under addition, and we can define $b\cdot(x\otimes y)=(bx)\otimes y$.
• If $A\to B$ and $A\to C$ are ring morphisms, $B\otimes_A C$ can be seen as a ring, with $(b_1\otimes c_1)\cdot(b_2\otimes c_2)=(b_1b_2)\otimes(c_1c_2)$. This can be seen as a fibered coproduct (fibered products are defined later in this post, fibered coproducts are just the dual (reverse all the arrows in the diagram)) by letting $B\to B\otimes_AC$ be defined as $b\mapsto b\otimes1$, and $C\to B\otimes_AC$ defined as $c\mapsto 1\otimes c$, as the following diagram is satisfied.

## Limits

Given a small category $\mathfrak F$, category $\mathfrak C$, and functor $F:\mathfrak F\to\mathfrak C$, the limit of $\mathfrak C$ with respect to $F$, written as $\varprojlim\limits_F\; \mathfrak C$, is an object of $\mathfrak C$, paired with morphisms $m_A:\varprojlim\limits_F\; \mathfrak C\to F(A)$ for each $A\in\mathfrak F$, such that for each morphism $h:X\to Y$ in $\mathfrak F$, the following diagram holds:

And such that for any other object $W\in\mathfrak C$ with the above properties (with morphisms $m'_A$), there exists a map $\phi:W\to\varprojlim\limits_F\:\mathfrak C$ such that for all $A\in\mathfrak F$, $m'_A=m_A\circ\phi$. In other words, $W$'s properties factor through the limit. (If it isn't obvious yet, this part is for uniqueness).

• If $\mathfrak F$ is the category with two objects $A,B$ and no morphisms between them, then $\varprojlim\limits_F\:\mathfrak C=F(A)\times F(B)$. More generally, if $\mathfrak F$ is some small subcategory of Id (The category of sets, with the only morphisms being the identity morphisms), we call the limit the cartesian product of the image of $F$, i.e., $$\varprojlim\limits_F\:\mathfrak C=\prod\limits_{A\in\mathfrak F}F(A)$$
• If $\mathfrak F$ is the following partially ordered set:

Then $\varprojlim\limits_F\:\mathfrak C$ is called the fibered product of $A,B$ with respect to $C$, notated as $A\times_C B$. The fibered product (over sets) takes the cross product of fibers of $\phi_A:A\to C$, $\phi_B:B\to C$, and unions them, i.e., $$A\times_CB=\bigcup\limits_{c\in C}\phi_A^{-1}(c)\times\phi_B^{-1}(c)$$

• The $p$-adic integers $\mathbb Z_p$ (sometimes written as $\mathbb Z/p^\infty$), for a prime $p$, is informally expressed as the ring of sums $a_0+a_1p+a_2p^2+\ldots$, with $0\leq p< a_i$. Observe that an arbitrary element of $\mathbb Z/p^n$ can be expressed uniquely as $a_0+a_1p+\ldots+a_{n-1}p^{n-1}$. Thus, there's an obvious ring morphism from $\mathbb Z/p^m\to\mathbb Z/p^n$ ($n\leq m\in[1,\infty]$) given by dropping all but the first $n$ terms. Thus, the following diagram shows how the $p$-adic integers can be viewed as a limit:

## Colimits

Colimits, denoted by $\varinjlim\limits_F\;\mathfrak C$, are the dual notion to limits (i.e., they satisfy the diagram with arrows reversed). More precisely, $m_A:F(A)\to\varinjlim\limits_F\;\mathfrak C$ is defined for each $A\in\mathfrak F$, the diagram below holds for all $h:X\to Y\in\mathfrak F$, and for any $W\in\mathfrak C$ that satisfies the above properties (with $m^*_A:F(A)\to W$ as the maps, there exists a map $\psi:\varinjlim\limits_F\;\mathfrak C\to W$ such that $m^*_A=\psi\circ m_A$ for each $A\in\mathfrak F$.

• For any small category $\mathfrak F\subset\textbf{Id}$, we notate the colimit $\varinjlim\limits_F\;\mathfrak C$ as $\bigsqcup\limits_{x\in\mathfrak F}F(x)$, and call it the disjoint union. If $\mathfrak C\subset\textbf{Set}$, we can see that the disjoint union can be defined as $$\bigsqcup\limits_{x\in\mathfrak F}F(x)=\bigcup\limits_{x\in F}F(x)\times\{F(x)\}$$
• There is a nice class of small categories $\mathfrak F$ such that for any functor $F:\mathfrak F\to\mathfrak C$, $\varinjlim\limits_F\;\mathfrak C$ exists. We say $\mathfrak F$ is a filtered partially ordered set iff for any $x,y\in\mathfrak F$, there exists $z\in\mathfrak F$ with $z\leq x,z\leq y$.

If $\mathfrak C\subset\textbf{Set}$, the following construction satisfies the colimit diagram.

$$\bigsqcup\limits_{x\in\mathfrak F}F(x)/((a,F(\alpha))\sim(b,F(\beta))\text{ iff }\exists\gamma\in\mathfrak F,\;\phi:\alpha\to\gamma,\;\psi:\beta\to\gamma\text{ such that }F(\phi)(a)=F(\psi)(b))$$

This relation is only an equivalence relation with the filtered condition on $\mathfrak F$.

• As an example of the filtered colimit in the previous bullet, letting $\mathfrak F$ be some filtered poset, and given some functor $F:\mathfrak F\to Mod_A$, the colimit can be seen as an $A$-module as follows: given $x\in F(A),y\in F(B)$, there exists $\gamma$ such that $\phi:\alpha\to\gamma,\;\psi:\beta\to\gamma$ are morphisms in $\mathfrak F$. Thus, let $x+y=F(\phi)(x)+F(\psi)(y)$. It's not hard to see that this construction is independent of the choice of $\gamma$, and gives an $A$-module structure to the colimit.

• Given a multiplicative subset $S$ of a commutative ring $A$ (i.e., $S$ is a commutative semigroup), let $\mathfrak S$ be the category generated by $S$. Let $F:\mathfrak S\to Mod_A$ send $s\to s^{-1}A=\{s^{-1}a\mid a\in A\}$ and send $\phi:s\to x\cdot s$ to $F(\phi):s^{-1}a\to (x\cdot s)^{-1}(x\cdot a)$. Under this construction, one can show that $\varinjlim\limits_F\;Mod_A=S^{-1}A$ via the initial object characterization of the localization.

We often write this as $\varinjlim s^{-1}A=S^{-1}A$. Letting $S=\mathbb N$, $A=\mathbb Z$, we have $\varinjlim\frac1n\mathbb Z=\mathbb Q$.

Let $F:\mathfrak A\to\mathfrak B$ and $G:\mathfrak B\to\mathfrak A$ be functors. We say $F$ and $G$ are adjoint iff for each $A\in\mathfrak A$, $B\in\mathfrak B$, there exists a morphism $\tau_{A,B}:\Mor_\mathfrak B(F(A),B)\to\Mor_\mathfrak A(A,G(B))$ such that for any $f:A\to A^*\in\mathfrak A$, the following diagram holds:

And likewise, for any $g:B\to B^*\in\mathfrak B$, the following diagram holds:

We call $F$ the left-adjoint and $G$ the right-adjoint, and $F,G$ an adjoint pair.

To see the power of this property, let's replace every $B^*$ in the diagram above with $B$, and every $B$ with $F(A)$.

Thus, for any function $g:F(A)\to B$, the above diagram holds. In particular, since $\id\in\Mor_\mathfrak B(F(A),F(A))$, we have $\tau_{A,B}(g)=G(g)\circ\eta_A$, where $\eta_A$ is a function chosen independently of $B$. In other words, $\tau_{A,B}$ factors into a component solely dependent on $A$, and a component solely dependent on $g$. Likewise for any $f:A\to G(B)$, we can decompose $\tau_{A,B}^{-1}(f)$ into a component solely dependent on $B$, and a component solely dependent on $f$. We call $\tau_{A,B}$ natural for this reason.

• Let $M,N,P\in Mod_A$. Consider the function $\tau_{M,P}:\Mor_A(M\otimes_AN,P)\to\Mor_A(M,\Mor_A(N,P))$ defined by $\tau_{M,P}(\psi)(m)(n)=\psi(m\otimes n)$. We call $\tau_{M,P}$ an uncurry function. It's a trivial application of tensor properties to show that this map is well defined, bijective, and an $A$-linear map.

In fact, defining $F=(-)\otimes N, G=\Mor(N,-)$ as functors $Mod_A\to Mod_A$, $\tau_{M,P}$ happens to be the natural bijection necessary for adjointness of the functors. Given $A$-linear morphisms $f:M_1\to M_2$, $g:P_1\to P_2$, we have the diagrams

It's a cute exercise to see that both of these diagrams hold, which implies that $(-)\otimes N$ and $\Mor(N,-)$ are adjoint in the category of $A$-modules.

• Given any ring morphism $\phi:B\to A$, there's a canonical contravariant functor $(-)_B:Mod_A\to Mod_B$ which sends the $A$-module $M$ to a $B$ module $M_B$ by defining the multiplicative action as $b\cdot x:=\phi(b)\cdot x$ for $b\in B$, $x\in M$. This functor is right adjoint to $(-)\otimes_BA$, since we can define $\tau_{N,M}:\Mor_A(N\otimes_BA,M)\to\Mor_B(N,M_B)$ as $\tau_{N,M}(f)(n)=f(n\otimes_B1)$, where $f(n\otimes_B1)$ is viewed as an element of $M_B$.

Given two distinct morphisms $f,g\in\Mor_A(N\otimes_BA,M)$, there exists some $n\otimes_Ba$ such that $f(n\otimes_Ba)\neq g(n\otimes_Ba)$. But, $f(n\otimes a)=af(n\otimes1)$, and likewise for $g$. Thus, $af(n\otimes1)\neq ag(n\otimes1)$, so $f(n\otimes1)\neq g(n\otimes1)$. This shows that $\tau_{N,M}$ is injective since $\tau_{N,M}(f)(n)\neq\tau_{N,M}(g)(n)$.

Given any morphism $h\in\Mor_B(N,M_B)$, let $f\in\Mor_A(N\otimes_BA,M)$ be the map that sends $n\otimes1\mapsto h(n)$. This definition is well-defined, and has the property that $\tau_{N,M}(f)=h$. Thus, $\tau_{N,M}$ is a bijection. In fact, it serves as an adjoint map between the functors $(-)_B$ and $\Mor_A(N,-)$.

• A classic example of adjoints is groupification. Loosely speaking, it's the process of finding the smallest abelian group containing a semigroup. To formalize this idea, we define the groupification of an abelian semigroup $S$ to be a map of abelian semigroups $\phi:S\to G$, with $G$ an abelian group, such that for any abelian group $G^\prime$ with abelian semigroup map $\psi:S\to G^\prime$, the following diagram holds:

This diagram is the dual of the quotient space universal property diagram (not presented on this blog, but it's one of the first ones you'll encounter). This is expected behavior, since quotient spaces are "shrinking" the space, while groupification is "expanding" it. And, since the identity morphism satisfies the universal property for $\phi$ when $S$ is an abelian group, the groupification of an abelian group is itself. As such, groupification can be viewed as a closure operator on the category of abelian semigroups. Groupification can also be viewed as a functor from $\mathfrak S$, the category of non-empty abelian semigroups, to $Ab$, the category of abelian groups. The inverse of this functor intuitively is the functor that forgets the fact that a given group has inverses and an identity. We call this functor, from $Ab\to\mathfrak S$, the forgetful functor. Showing that these functors are adjoint (with the forgetful functor as the right adjoint) is a straightforward application of definitions. In general, we expect the forgetful functor to be a right adjoint for any natural functors from a category to a sub-category.

## Monomorphism/Epimorphism

A map $f:X\to Y$ is a monomorphism if for any $\phi:Z\to Y$, there is at most one map $\psi$ satisfying the diagram below.

In other words, if $f\circ m_1=f\circ m_2$, for $m_1,m_2:Z\to X$, then $m_1=m_2$. A map $f:X\to Y$ is an epimorphism if for any $\phi:X\to Z$, there is at most one map $\psi$ satisfying the diagram below.

This is the dual notion to the monomorphism, and can be summarized as $m_1\circ f=m_2\circ f$ implies $m_1=m_2$.

• The composition of monomorphisms is monomorphic, and similarly, the composition of epimorphisms is epimorphic.
• By the equivalence of injectivity and left invertibility, and surjectivity and right invertibility for sets, monomorphisms in Set are just injections, and epimorphisms just surjections.
• As we saw before, the commutative diagram representing the universal property for the fibered product $X\times_ZY$ is below.

Letting $W=X=Y$, we have

Thus, $f:Y\to Y\times_ZY$ is defined if $Y\times_ZY$ is defined. And, $\beta\circ\id=\beta\circ\pi_Y\circ f$. Thus, $\id=\pi_Y\circ f$ if $\beta$ is a monomorphism, which implies that $f$ is an isomorphism. Thus, the induced map $f:Y\to Y\times_ZY$ is an isomorphism iff $\beta$ is a monomorphism.

• Monomorphisms aren't necessarily injective! In fact, they aren't necessarily even functions in any meaningful sense. However, even if monomorphisms are functions, they don't have to behave like an injection.

For a rather silly example, consider some non-injective function $f:A\to B$, consider the category $\{A,B\}$, with $\Mor(A,A)=\Mor(B,B)=\{\id\}$, $\Mor(A,B)=\{f\}$, $\Mor(B,A)=\varnothing$. Clearly, $f$ is a monomorphism.

Similarly, epimorphisms need not be surjections. For example, in the category of rings, the inclusion $\mathbb Z\to\mathbb Q$ is obviously not a surjection, but since for any $q\in\mathbb Q$, there exists $n\in\mathbb N\subset\mathbb Z$ such that $qn\in\mathbb Z$, there is at most one choice of morphism $\mathbb Q\to W$ for any $W$ and morphism $\mathbb Z\to W$ that satisfies the diagram.

However, in most settings we care about, this doesn't happen, since the existence of free objects (to be defined in a future post) guarantees that monomorphisms and epimorphisms, if they are functions, are injections and surjections, respectively.


• The collection of all sets, with $\Mor(A,B)$ being the set of all functions $A\to B$, and $\id_A(x)=x$ for all $x\in A$ is referred to as Set. Bijections are the isomorphisms of this category.
• The collection of topological spaces, with $\Mor(A,B)$ the set of continuous maps from $A\to B$, and the identity map defined as in Set is referred to as Top. Homeomorphisms are the isomorphisms of this category.
• A category in which all maps are isomorphisms is called a groupoid. We can define (although probably shouldn't) a group as a groupoid with a single object.
• For any ring $A$, we can consider the category of all $A$-modules, with $\Mor(B,C)$ the set of $A$-linear maps $B\to C$. We call this category $Mod_A$. If $A=\mathbb Z$, this category is called Ab, the category of Abelian groups, and if $A$ is a field, this is the category of all vector spaces over $A$.
• A category with $|\Mor(A,B)|\leq1$ for all $A,B$, and with no non-identity isomorphisms is called a partially ordered set. We say $A\geq B$ iff $|\Mor(A,B)|=1$. A poset is totally ordered if for any two objects $A,B$, $\Mor(A,B)\cup\Mor(B,A)\neq\varnothing$.
• Given a semigroup $(S,\cdot)$, the left category of $S$ is defined by setting the elements of $S$ to be the objects, and for all $x\in S$, add a morphism to $\Mor(s,x\cdot s)$ for all $s\in S$. Likewise, we can define a right category. If $S$ is commutative, we treat it as a category via either of the above constructions.

## Basic category tools

A covariant functor from $\mathfrak A\to\mathfrak B$ is a map $F:\operatorname{obj}(\mathfrak A)\to\operatorname{obj}(\mathfrak B)$ such that for any $m\in\Mor(X,Y)$ ($X,Y\in\mathfrak A$), $F(m)\in\Mor(F(X),F(Y))$ is defined. Moreover, $F(\id_A)=\id_{F(A)}$ for all $A\in\mathfrak A$, and for any $h=f\circ g$, $F(h)=F(f)\circ F(g)$.

A contravariant functor is identical to a covariant functor, but $F(m)\in\Mor(F(Y),F(X))$, and $F(h)=F(g)\circ F(f)$.

Vakil's book includes plenty of intuitive examples. From this point on, I'll refer to covariant functors when I say "functor", unless otherwise specified.

In some sense, functors are the "morphisms" of categories. So it's reasonable to ask, are there functors of functors?

Let $f,g:\mathfrak A\to\mathfrak B$ be covariant functors. $H:f\to g$ is a natural transformation if it maps each $A\in\mathfrak A$ to a morphism $m_A:f(A)\to g(A)$, and for each $r\in\Mor(A,B)\in\mathfrak A$, the diagram below holds.

Natural transformations can also be defined for contravariant functors, with some of the arrows flipped.

Similar to morphisms, we say that two categories $\mathfrak A,\mathfrak B$ are isomorphic (although to distinguish this from other isomorphisms, we call these equivalent) if there exists a functor $F:\mathfrak A\to\mathfrak B$ which is an isomorphism. More simply put, there exists $G:\mathfrak B\to\mathfrak A$ with $F\circ G$ and $G\circ F$ isomorphic to the identity functors $\id_{\mathfrak A},\id_{\mathfrak B}$.

A beautiful result is that a functor $F:\mathfrak A\to\mathfrak B$ is an isomorphism if it is fully faithful, i.e., for all $A,B\in\mathfrak A$, $F:\Mor(A,B)\to\Mor(F(A),F(B))$ is a bijection, and if it is essentially surjective, i.e., for all $C\in\mathfrak B$, there exists $A\in\mathfrak A$ and an isomorphism $g\in\Mor(F(A),C)$.

For an example of a contravariant functor, let $A\in\mathfrak A$ be an object of a category. Thus, there is a contravariant functor $h_A:\mathfrak A\to\textbf{Set}$ given by $h_A(B)=\Mor(B,A)$, and for any $f\in\Mor(B,C)$, $h_A(f):\Mor(C,A)\to\Mor(B,A)$ is defined as $h_A(f)(g)=g\circ f$. This functor is called the functor of points. We often write the functor of points as $\Mor(-,A)$ to represent the fact that we map an object $B\to\Mor(B,A)$. Likewise, we can talk about the covariant functor $\Mor(A,-)$ which sends $B$ to $\Mor(A,B)$.