# 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

categorycomprises of the following data.We have a class whose elements are called

objects. We will write in short for .For any two objects , we have a set whose elements are called

morphismsfrom A to B. We will write for an element .Finally, for any objects , there is a composition function

satisfying the following.

- For any object , there is a morphism such that for any and , , we have

- For any objects we have
.

*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 is clearly unique for each object . The associative law implies that we can remove brackets in a series of compositions, e.g. if

we can write the composition without fear of ambiguity in the bracketing of composition.

Definition.A morphism in a category is said to be an

isomorphismif there exists such thatObjects are said to be

isomorphicif there exists an isomorphism . This is clearly an equivalence relation.

## Examples

1. Let be the class of all groups; for any groups *G*, *H*, let be the set of all group homomorphisms . Composition is just the usual composition of homomorphisms.

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

- for the category of sets and ordinary functions;
- for the category of rings and ring homomorphisms;
- for the category of
*A*-modules and*A*-linear maps; - for the category of
*A*-algebras and their homomorphisms; - for the category of topological spaces and continuous functions.

3. For a category , a **subcategory** (written ), has the following.

- For objects, is a subclass of .
- For morphisms, if , we have .

If, in the second condition, equality holds for all , we say is a **full subcategory**. For example, the category of abelian groups is a full subcategory of the category of groups.

4. Let be a poset. Let be the category whose objects are elements of *S*. For any , we define

where is some fixed singleton set. Composition is only possible for and where , 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 be a category and . The **coslice category** comprises of the following.

- Objects: the collection of all morphisms , as
*B*runs through . - Morphisms: given and , morphisms are exactly morphisms in such that .
- Composition of morphisms is just composition in .

*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 corresponds to the category of all *A*-algebras, as we proved in lemma 1 and proposition 1 here.

7. Given a category , the **opposite category** comprises of the following.

- We have a bijective correspondence where object in corresponds to an object in .
- The set of all morphisms in corresponds exactly to the set of all morphisms in .
- For composition, if and in , we have

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

8 Given categories , the **product category** is as follows.

- Objects are pairs where and .
- Morphisms are pairs where and are morphisms in and 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 be categories. A (

covariant)functordoes the following.To each object , it assigns an object .

To each morphism of , it assigns a morphism of , such that the following hold.

- for any .
- For any and in , we have in .

*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**

by “forgetting” some information in the underlying objects. E.g. takes a group *G* and returns the underlying set, forgetting the group structure, and a homomorphism to the same *f* as a function. The functor returns the additive group of a ring *A*.

### Example 2

Take the functor as follows.

- On objects, it takes a pair of groups to their product .
- On morphisms, it takes a pair of morphisms to the morphism , which takes .

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 . We define a functor as follows

Indeed for morphisms and in we have

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

### Exercise B

Let be a morphism in a category . Define a corresponding functor between the coslice category and . Note that we did not say which is the source. 😛

# Contravariant Functors

Definition.A

contravariant functoris a covariant functor .

Thus *F* takes a morphism to a morphism .

### Example 1

For example, if *A* is any object of a category , we have a functor :

Now for morphisms and in we have

### Example 2

Let be the category of finitely generated *k*-algebras, where *k* is an algebraically closed field. The above hom functor for gives

(finitely generated *k*-algebra *B*)

which gives the set of points on an affine *k*-scheme *V* with .

### Example 3

Taking the spectrum of a ring gives a functor:

which takes a ring *A* to the topological space Spec *A*. Recall that a ring homomorphism gives .

Finally we can of course compose functors.

Proposition 1.Let and be functors (either covariant or contravariant). Then

is a functor. This takes to and a morphism to a morphism in .

Note that is covariant if and only if and are both covariant or both contravariant; otherwise it is contravariant.

**Proof**

Easy exercise. ♦

In the definition of opposite category, it was mentioned that the set of morphisms CORRESPOND exactly to the set of morphisms in the category . Does it mean that for each arrow we CREATE a new arrow beginning at and ending at ; 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 may be viewed as a covariant functor . Thank you.

The opposite category is just an abstract category. So, for each arrow , we create a new arrow which belongs to this new opposite category. This new arrow is no longer an arrow in the old category.