# Basics of Category Theory

As we proceed, we should cover some rudimentary category theory or many of the subsequent constructions would seem unmotivated. The essence of category is in studying algebraic objects and the homomorphisms between them. By now we have seen numerous examples of such objects: groups, rings, A-modules, A-algebras etc. Category theory is a framework which unifies many of the common themes among different classes of objects.

Definition.

A category $\mathcal C$ comprises of the following data.

We have a class $\mathrm{ob}(\mathcal C)$ whose elements are called objects. We will write $A\in \mathcal C$ in short for $A \in \mathrm{ob}(\mathcal C)$.

For any two objects $A, B \in \mathcal C$, we have a set $\mathrm{hom} _{\mathcal C}(A,B)$ whose elements are called morphisms from A to B. We will write $f: A\to B$ for an element $f\in \mathrm{hom}_{\mathcal C}(A, B)$.

Finally, for any objects $A, B, C \in \mathcal C$, there is a composition function

$\circ : \mathrm{hom}_{\mathcal C}(B, C) \times \mathrm{hom}_{\mathcal C}(A, B) \longrightarrow \mathrm{hom}_{\mathcal C}(A, C), \quad (g, f)\mapsto g\circ f,$

satisfying the following.

• For any object $A \in \mathcal C$, there is a morphism $1_A : A\to A$ such that for any $B\in \mathcal C$ and $f : A\to B$, $g: B\to A$, we have

$f\circ 1_A = f,\quad 1_A \circ g = g.$

• For any objects $A, B, C, D \in \mathcal C$ we have

\left.\begin{aligned} f:A\to B \\ g:B\to C \\ h:C\to D\end{aligned}\right\} \implies (h\circ g)\circ f = h\circ (g\circ f).

In summary, a category comprises of objects, a set of morphisms between any two objects, and a composition function between morphisms which satisifies: existence of identity and associativity.

Observations

The unit $1_A$ is clearly unique for each object $A\in \mathcal C$. The associative law implies that we can remove brackets in a series of compositions, e.g. if

$f_1 : A_1 \to A_2,\ \ f_2 : A_2 \to A_3,\ \ldots,\ f_{n-1} : A_{n-1} \to A_n$

we can write the composition $f_{n-1} \circ \ldots \circ f_2 \circ f_1$ without fear of ambiguity in the bracketing of composition.

Definition.

A morphism $f:A\to B$ in a category $\mathcal C$ is said to be an isomorphism if there exists $g:B\to A$ such that

$g\circ f = 1_A, \quad f\circ g = 1_B.$

Objects $A, B\in \mathcal C$ are said to be isomorphic if there exists an isomorphism $f:A\to B$. This is clearly an equivalence relation.

## Examples

1. Let $\mathbf{Gp}$ be the class of all groups; for any groups GH, let $\mathrm{hom}_{\mathbf{Gp}}(G, H)$ be the set of all group homomorphisms $f:G\to H$. Composition is just the usual composition of homomorphisms.

2. Similarly, we have the following categories (A = fixed ring).

• $\mathbf{Set}$ for the category of sets and ordinary functions;
• $\mathbf{Ring}$ for the category of rings and ring homomorphisms;
• $A\text{-}\mathbf{Mod}$ for the category of A-modules and A-linear maps;
• $A\text{-}\mathbf{Alg}$ for the category of A-algebras and their homomorphisms;
• $\mathbf{Top}$ for the category of topological spaces and continuous functions.

3. For a category $\mathcal C$, a subcategory $\mathcal D$ (written $\mathcal D\subseteq \mathcal C$), has the following.

• For objects, $\mathrm{ob}(\mathcal D)$ is a subclass of $\mathrm{ob}(\mathcal C)$.
• For morphisms, if $A,B \in \mathcal D$, we have $\mathrm{hom}_{\mathcal D}(A, B) \subseteq \mathrm{hom}_{\mathcal C}(A,B)$.

If, in the second condition, equality holds for all $A,B\in \mathcal D$, we say $\mathcal D$ is a full subcategory. For example, the category of abelian groups is a full subcategory of the category of groups.

4. Let $(S, \le)$ be a poset. Let $\mathcal C(S)$ be the category whose objects are elements of S. For any $x,y\in S$, we define

$\hom_{\mathcal C(S)}(x, y) = \begin{cases} \{*\}, \quad &\text{if } x \le y, \\ \emptyset, \quad &\text{otherwise,}\end{cases}$

where $\{*\}$ is some fixed singleton set. Composition is only possible for $* :x \to y$ and $* : y\to z$ where $x\le y \le z$, in which case the map is the only possible one.

Note that this category is not a collection of algebraic objects (unlike the prior examples).

5. Let $\mathcal C$ be a category and $A \in \mathcal C$. The coslice category $A \downarrow \mathcal C$ comprises of the following.

• Objects: the collection of all morphisms $f:A \to B$, as B runs through $\mathrm{ob}(\mathcal C)$.
• Morphisms: given $f:A \to B$ and $g:A\to C$, morphisms $f\to g$ are exactly morphisms $\phi : B\to C$ in $\mathcal C$ such that $\phi\circ f = g$.
• Composition of morphisms is just composition in $\mathcal C$.

In summary, the coslice category has, as objects, the class of all arrows from A. Morphisms are just morphisms in the original category which “make the diagram commute”.

6. Let A be a ring. The coslice category $A \downarrow \mathbf{Ring}$ corresponds to the category of all A-algebras, as we proved in lemma 1 and proposition 1 here.

7. Given a category $\mathcal C$, the opposite category $\mathcal C^{\text{op}}$ comprises of the following.

• We have a bijective correspondence $\mathrm{ob}(\mathcal C) \leftrightarrow \mathrm{ob}( \mathcal C^{\text{op}})$ where object $A$ in $\mathcal C$ corresponds to an object $A^{\text{op}}$ in $\mathcal C^{\text{op}}$.
• The set of all morphisms $f^{\text{op}} : A^{\text{op}}\to B^{\text{op}}$ in $\mathcal C^{\text{op}}$ corresponds exactly to the set of all morphisms $f: B\to A$ in $\mathcal C$.
• For composition, if $f:A\to B$ and $g:B\to C$ in $\mathcal C$, we have

$f^{op} \circ g^{\text{op}} = (g\circ f)^{\text{op}} : C^{\text{op}} \longrightarrow A^{\text{op}}.$

In summary, the opposite category is obtained by flipping the arrows around in the original category.

8 Given categories $\mathcal C, \mathcal D$, the product category $\mathcal C \times \mathcal D$ is as follows.

• Objects are pairs $(A, B)$ where $A\in\mathrm{ob}(\mathcal C)$ and $B\in \mathrm{ob}(\mathcal D)$.
• Morphisms $(A, B) \to (A', B')$ are pairs $(f:A\to A', g:B\to B')$ where $f:A\to B$ and $g:B\to B'$ are morphisms in $\mathcal C$ and $\mathcal D$ respectively.

There are literally dozens of constructions for categories, but listing all of them here would only confuse the reader. We focus on a few relevant ones for now and will define more constructions later if necessary.

Exercise A

In each example, check that isomorphism corresponds with our intuitive notion.

# Functors

The functors are the “homomorphisms” between categories.

Definition.

Let $\mathcal C, \mathcal D$ be categories. A (covariant) functor $F : \mathcal C \to \mathcal D$ does the following.

To each object $A\in\mathcal C$, it assigns an object $F(A)\in \mathcal D$.

To each morphism $f:A\to B$ of $\mathcal C$, it assigns a morphism $F(f) : F(A) \to F(B)$ of $\mathcal D$, such that the following hold.

• $F(1_A) = 1_{F(A)}$ for any $A\in \mathcal C$.
• For any $f:A\to B$ and $g:B\to C$ in $\mathcal C$, we have $F(g\circ f) = F(g) \circ F(f)$ in $\mathcal D$.

In summary, a functor between categories maps object to object, morphism to morphism, such that the identity morphism and composition of morphisms are preserved.

### Example 1

There are forgetful functors

$\mathbf{Gp} \to \mathbf{Set}, \quad \mathbf{Ring} \to \mathbf{Gp}, \quad A\text{-}\mathbf{Alg} \to \mathbf{Ring},$

by “forgetting” some information in the underlying objects. E.g. $\mathbf{Gp} \to \mathbf{Set}$ takes a group G and returns the underlying set, forgetting the group structure, and a homomorphism $f:G\to H$ to the same f as a function. The functor $\mathbf{Ring} \to \mathbf{Gp}$ returns the additive group of a ring A.

### Example 2

Take the functor $\prod : \mathbf{Gp} \times \mathbf{Gp} \to \mathbf{Gp}$ as follows.

• On objects, it takes a pair of groups $(G, H)$ to their product $G\times H$.
• On morphisms, it takes a pair of morphisms $(f_1 : G\to G', f_2 : H\to H')$ to the morphism $f_1 \times f_2 : G \times H\to G'\times H'$, which takes $(x,y) \mapsto (f_1(x), f_2(y))$.

Clearly, we can have similar constructions for the categories of sets, rings, topological spaces, A-modules, A-algebras etc. In fact, this construction can be generalized at a categorical level via universal properties, as we will see later.

### Example 3

Let A be any object of a category $\mathcal C$. We define a functor $\mathrm{hom}_{\mathcal C}(A, -) : \mathcal C \to \mathbf{Set}$ as follows

\begin{aligned}(B \in \mathcal C) &\mapsto \mathrm{hom}_{\mathcal C}(A, B),\\ (f \in \mathrm{hom}_{\mathcal C}(B, B')) &\mapsto (f_* : \mathrm{hom}_{\mathcal C}(A, B) \to \mathrm{hom}_{\mathcal C}(A, B'), \ h \mapsto f\circ h). \end{aligned}

Indeed for morphisms $f:B\to C$ and $g : C\to D$ in $\mathcal C$ we have

$(g_* \circ f_*) (h) = g_*(f_*(h)) = g_*(f\circ h) = g\circ (f\circ h) = (g\circ f)\circ h = (g\circ f)_*(h).$

Note that this generalizes the Hom construction for A-modules and A-algebras earlier.

### Exercise B

Let $f:A \to A'$ be a morphism in a category $\mathcal C$. Define a corresponding functor between the coslice category $A \downarrow \mathcal C$ and $A' \downarrow \mathcal C$. Note that we did not say which is the source. 😛

# Contravariant Functors

Definition.

contravariant functor $F: \mathcal C\to \mathcal D$ is a covariant functor $\mathcal C^{\text{op}} \to \mathcal D$.

Thus F takes a morphism $f:A\to B$ to a morphism $F(f) : F(B) \to F(A)$.

### Example 1

For example, if A is any object of a category $\mathcal C$, we have a functor $\mathrm{hom}_{\mathcal C}(-, A) : \mathcal C \to \mathbf{Set}$:

\begin{aligned} (B \in \mathrm{ob}(\mathcal C)) &\mapsto \mathrm{hom}_{\mathcal C}(B, A), \\ (f\in \mathrm{hom}_{\mathcal C}(B, C)) &\mapsto (f^* : \mathrm{hom}_{\mathcal C}(C, A) \to \mathrm{hom}_{\mathcal C}(B, A), \ h\mapsto h\circ f). \end{aligned}

Now for morphisms $f:B\to C$ and $g:C\to D$ in $\mathcal C$ we have

$(f^* \circ g^*)(h) = f^*(g^*(h)) = f^*(h\circ g) = (h\circ g)\circ f = h\circ (g\circ f) = (g\circ f)^*(h).$

### Example 2

Let $\mathcal C$ be the category of finitely generated k-algebras, where k is an algebraically closed field. The above hom functor for $A = k$ gives

(finitely generated k-algebra B) $\mapsto \mathrm{Hom}_{k\text{-alg}}(B, k),$

which gives the set of points on an affine k-scheme V with $k[V] = B$.

### Example 3

Taking the spectrum of a ring gives a functor:

$\mathrm{Spec} : \mathbf{Ring} \longrightarrow \mathbf{Top}$

which takes a ring A to the topological space Spec A. Recall that a ring homomorphism $f:A\to B$ gives $f^* : \mathrm{Spec} B \to \mathrm{Spec} A$.

Finally we can of course compose functors.

Proposition 1.

Let $F : \mathcal C\to \mathcal D$ and $G:\mathcal D\to \mathcal E$ be functors (either covariant or contravariant). Then

$G\circ F : \mathcal C \to \mathcal E$

is a functor. This takes $A \in \mathrm{ob}(\mathcal C)$ to $G(F(A)) \in \mathrm{ob}(\mathcal E)$ and a morphism $f:A\to B$ to a morphism $G(F(f))$ in $\mathcal E$.

Note that $G\circ F$ is covariant if and only if $F$ and $G$ are both covariant or both contravariant; otherwise it is contravariant.

Proof

Easy exercise. ♦

This entry was posted in Advanced Algebra and tagged , , , , , , , . Bookmark the permalink.

### 2 Responses to Commutative Algebra 18

1. Vanya says:

In the definition of opposite category, it was mentioned that the set of morphisms $f^{op} : A^{op} \to B^{op}$ CORRESPOND exactly to the set of morphisms $f : A \to B$ in the category $\mathcal{C}$. Does it mean that for each arrow $f: A \to B$ we CREATE a new arrow $f^{op} : B^{op} \to A^{op}$ beginning at $B^{op}$ and ending at $A^{op}$ ; if that is so, how do we know that it is actually a morphism (for example, a group homomorphism). Secondly, could you please clarify the purpose of defining opposite category? For instance, could you explain in detail how a contravariant functor $F: \mathcal{C} \to \mathcal{D}$ may be viewed as a covariant functor $F: \mathcal{C}^{op} \to \mathcal{D}$. Thank you.

• limsup says:

The opposite category is just an abstract category. So, for each arrow $f:A\to B$, we create a new arrow $f^{op} : B^{op} \to A^{op}$ which belongs to this new opposite category. This new arrow is no longer an arrow in the old category.