This post is part of a series on category theory, see Overview of Blog Posts for all blog posts.

## Introduction

Using the notion of natural transformations introduced previously, we are able to state and prove the (in)famous and all-important Yoneda lemma, which is not only applied throughout category theory, but can yield satisfying conceptual proofs in many distinct areas. This result single-handedly justifies the “behavioristic” or “relative” viewpoint internal to category theory that lies in not bothering with concrete qualities of the objects one is interested in and studying them via their relations to other objects, for it implies in a certain technical sense that an object is uniquely determined by how it relates to other objects. This allows us to think of objects in terms of functors.

## Functor Categories

Let and be categories, then we can consider the class of functors . For two such functors, we can consider natural transformations between them, which we can compose in an associative way. For any functor, there’s the identity natural transformation. So this turns the collection of functors into a category, right?

Not quite, at least with our definitions. The subtle problem is that there is no reason to expect that the natural transformations between two functors form a set, there might be “too many”. To remedy this deficiency, we shall amend the definition of a category. Henceforth, what is defined in definition C1.1 shall be called a “locally small category” and a not necessarily locally small or “large” category has the same definition, except that the morphisms between two objects are allowed to be proper classes. With this amendment, we can make the following definition:

**Definition C4.1 **Let and be categories. Then the functor category, denoted by has as its objects all functors and as morphisms natural transformations, with composition of natural transformations defined pointwise.

**Exercise C4.2** If is a small category (the objects form a set and it is locally small) and is a locally small category, then the functor category is locally small.

**Example C4.3** As we have already seen, the functor category for a group considered as a one-object category is the category of -sets with equivariant maps as morphisms. (cf. example C2.4 and example C3.3)

**Example C4.4** Similarly, for a field and a group , the functor category is the category of representations of over . (cf. example C2.5 and example C3.4)

## The Yoneda Lemma

We now come to the promised infamous lemma:

**Theorem C4.5 (Yoneda lemma)** Let be a locally small category, let be an object in and let be a functor, then the map is a bijection that is natural in and in .

**Proof** construct an inverse map as follows: let , then set to be the following natural transformation: for any object and any morphism , let , we need to check that this is indeed a natural transformation from to . Let be a third object and let be a morphism in . Then we need to verify that the following diagram commutes:

To show this, let , then showing that the diagram commutes. Hence is a natural transformation.

We now need to show that is the inverse of . Let be a natural transformation, then we need to show that , which we can check this component-wise. Let be an object and let be a morphism, then we have by naturality of this equals , see the diagram below, applied to the identity on :

This proves one direction, for the other direction, we have for , . This shows that and are mutually inverse bijections. Naturality in and are easy computations.

There is also a contravariant version of the Yoneda lemma:

**Corollary C4.6** Let be a locally small category and let be a functor, i.e. a contravariant functor on , then for any object , the map is a natural bijection.

**Proof **Apply the Yoneda lemma to the opposite category.

The most important case is when is another Hom-functor:

**Corollary C4.7 **Let be a locally small category and let be objects. Then there is a natural isomorphism given by .

**Corollary C4.8** Let be a locally small category. Then the functor , called the Yoneda embedding, given by is fully faithful.

**Corollary C4.9 **Let be a locally small category, then if for two objects and , the functors and are naturally isomorphic, then and are isomorphic up to a unique isomorphism inducing a given natural isomorphism between the functors.

**Proof **By corollary C4.8, the Yoneda embedding is fully faithful, hence it reflects being isomorphic by lemma C3.11. As the Yoneda embedding is faithful, we get uniqueness.

**Corollary C4.10** Let be a locally small category. If for two objects and , the functors and are naturally isomorphic, then and are isomorphic up to a unique isomorphism inducing a given natural isomorphism between the functors.

**Proof **Apply corollary C4.9 to the opposite category and note that two objects are isomorphic if and ony if they are isomorphic in the opposite category.

**Remark** Using the Yoneda lemma, one can identify a locally small category with the subcategory of the functor category , containg as objects all Hom-functors and as morphisms natural transformations between them.

Let us ponder for a moment what a remarkable thing we have shown: The last two corollaries tell us that in order to study an object, it is sufficient to study all morphisms from that object or all morphisms into that object. To put it succinctly, the Yoneda lemma tells us that an object is determined by its relation to other objects. Studying the functor or the functor can be easier than studying an object itself, especially if the objects satisfy so-called universal properties, which are basically convenient descriptions of the functors from or to an object.

**Example C4.11 **Let be the category of commutative rings, then if is a commutative ring and is an ideal, one has an isomorphism natural in : , given by pulling back along the projection . In this sense, the projection is the universal morphism that restricts to on : every other such morphism factorizes over it. This is the content of the homomorphism theorem. From a categorical perspective, the homomorphism theorem is the proper *definition* of a quotient modulo an ideal, whereas the construction with equivalence classes is mere coincidence. In a similar manner, for a multiplicatively closed subset , the localization together with the canonical morphism is the universal solution to the problem of finding a ring and a ring homomorphism such that maps all elements of to units. Explicitly, one has a natural isomorphism .

If we look into the case that we have both an ideal and a multiplicatively closed subset in , then we can ask for a universal morphism that sends both to and maps to units. Here we can see the Yoneda lemma in action, for we have natural isomorphisms

which implies that by the Yoneda lemma. This is a conceptually very satisfying proof, as we didn’t have to fiddle with equivalence classes or fractions, but we only used the abstract defining properties of localizations and quotients.

**Exercise **Use the Yoneda lemma to prove that if is a commutative ring and and are two ideals such that , then .

**Exercise** If and are two multiplicatively closed subsets of a commutative ring and is the multiplicatively closed subset generated by and , then show that using the Yoneda lemma.

This concludes the post on the Yoneda lemma, which we shall see in many applications to come.