Commutative Algebra 20

Yoneda Lemma

For an object A\in \mathcal C, define the covariant functor

F_A := \mathrm{hom}_{\mathcal C}(A, -) : \mathcal C \longrightarrow \mathbf{Set}.

Proposition 1.

Any morphism f:A \to A' in \mathcal C gives us a natural transformation

T_f : F_{A'} \Rightarrow F_A, \quad B \mapsto \begin{cases} \mathrm{hom}_{\mathcal C}(A', B) \to \mathrm{hom}_{\mathcal C}(A, B), \\ g \mapsto g\circ f.\end{cases}

In summary, the natural transformation is obtained by right-composing with f.


Let g:B\to B' be a morphism in \mathcal C. We need to show F_A(g) \circ T_f(B) = T_f(B')\circ F_{A'}(g). Now run h \in F_{A'}(B), i.e. h:A'\to B, through both sides:

\begin{aligned} F_A(g) [ T_f(B) (h) ] = F_A(g)(h\circ f) = g\circ (h\circ f), \\ T_f(B') [ F_{A'}(g) (h)] = T_f(B') (g\circ h) = (g\circ h)\circ f. \end{aligned}

and we are done. ♦

Yoneda lemma says the converse is true.

Theorem (Yoneda Lemma).

Every natural transformation T : F_{A'} \Rightarrow F_A is uniquely of the form T_f for a morphism f:A\to A'.


Consider T_{A'} : F_{A'}(A') \to F_A(A'); this function takes the identity morphism 1_{A'} \in F_{A'}(A') to some f \in F_A(A'), i.e. a morphism f:A\to A'. Take any object B \in \mathcal C; we wish to show T = T_f on B, i.e.

T_B : F_{A'}(B) \to F_A(B), \quad T_B(g : A' \to B) = (g\circ f : A \to B).

To prove this, let g:A' \to B. From commutativity of  the following diagram:


T_B(g) = T_B(F_{A'}(g)(1_{A'})) = F_A(g)[ T_{A'}(1_{A'})] = F_A(g)(f) = g\circ f.


Consider the functors

SL_2(-), F : A\text{-}\mathbf{Alg} \to \mathbf{Set}

where F is the forgetful functor which takes an A-algebra to the underlying set. The act of taking the trace of a matrix then gives a function \mathrm{tr}_B : SL_2(B) \to B. One checks that this is a natural transformation. Furthermore, both SL_2 and F are representable functors, with respective objects:

B_1 = A[W, X, Y, Z]/(WZ - XY - 1), \quad B_2 = A[T].

By Yoneda lemma, this means the natural transformation tr is induced from a homomorphism B_2 \to B_1 of A-algebras. A moment of observation shows this is given by:

A[T] \longrightarrow A[W, X, Y, Z]/(WZ - XY - 1),\quad T \mapsto W+Z.


Products in a Category

Henceforth I denotes a fixed index set. (A_i)_{i\in I}, (B_i)_{i\in I}, (C_i)_{i\in I} are collections of objects in a fixed category \mathcal C indexed by i\in I.

The following generalizes the direct product of A-modules.


The product of (A_i)_{i\in I} comprises of data (A, (\pi_i : A \to A_i)_{i \in I}), where

  • A = \prod_{i\in I} A_i is an object in \mathcal C, and
  • for each i\in I, we have a morphism \pi_i : A \to A_i,

satisfying the following universal property. For any (B, (\phi_i : B\to A_i)_{i\in I}), where

  • B \in \mathcal C is an object, and
  • for each i\in I, we have a morphism \phi_i : B\to A_i,

there is a unique morphism f : B\to A such that \pi_i \circ f= \phi_i for each i\in I.

The morphisms \pi_i : \prod_i A_i \to A_i are called projections.

Here is the diagram we used for A-modules which is equally relevant here.


For example, we saw earlier that for A-modules, the direct product and its projection maps form a product in the category of A-modules. Clearly, the product in the categories \mathbf{Gp}, \mathbf{Ring}, A\text{-}\mathbf{Alg} can be similarly constructed.

For the case of \mathbf{Top}, we obtain the product topology for \prod_{i\in I} X_i, where as a basis, we take products of the form \prod_{i\in I} U_i where each U_i \subseteq X_i is open and U_i = X_i for all but finitely many i\in I. This also explains why the product topology is preferred over the box topology, where we remove the restriction that U_i = X_i for all but finitely many i\in I.

Proposition 2.

The product in \mathcal C is unique up to unique isomorphism, i.e. suppose

(A, (\pi_i : A\to A_i)_{i\in I}), \quad (A', (\pi_i' : A'\to A_i)_{i\in I})

are both products in the above sense. Then there is a unique isomorphism f:A\to A' such that \pi_i' \circ f = \pi_i for each i\in I.


Same as the case for A-modules. Left as an exercise. ♦

warningThe product is not guaranteed to exist in \mathcal C; the above only guarantees uniqueness.

Diagonal Map

Let A\in \mathcal C. Consider the case of \prod_{i\in I} A, the product of I copies of A. If we take the collection \phi_i : A \to A to be all identities, then:

  • we get a unique \Delta : A\to \prod_{i\in I} A satisfying \pi_i \circ \Delta = 1_A for each i\in I.

This \Delta is called the diagonal map. For the cases of groups, rings, A-modules and topological spaces, we obtain exactly what we expect, e.g. \Delta : G \to G^I takes g \mapsto (g, g, g,\ldots).

Exercise A

1. Prove that the product \prod_{i\in I} A_i exists in the category \mathcal C if and only if the following (contravariant) functor is representable

F: \mathcal C \longrightarrow \mathbf{Set}, \quad B \mapsto \prod_{i\in I} \mathrm{hom}_{\mathcal C}(B, A_i)

where (f : B\to C) \mapsto (\prod_i \mathrm{hom}_ {\mathcal C}(C, A_i) \to \prod_i \mathrm{hom}_{\mathcal C}(B, A_i)), takes (\phi_i) \mapsto (\phi_i\circ f).

The upshot is that product in a category can be expressed in the language of representable functors.

2. Suppose the product of A, B\in \mathcal C exists. Define, for any morphism f: A \to B, a graph morphism \Gamma_f : A \to A\times B such that in the category of sets, \Gamma_f (x) = (x, f(x)).


Functoriality of Products

Suppose \prod_i A_i, \prod_i B_i and \prod_i C_i all exist whenever they are mentioned. For the corresponding projections, we denote

\pi_{j, A} : \prod_i A_i \longrightarrow A_j, \quad \pi_{j, B} : \prod_i B_i \longrightarrow B_j, \quad \pi_{j, C} : \prod_i C_i \longrightarrow C_j.


Given a morphism f_i : A_i \to B_i for each i\in I, we have an induced f : \prod_i A_i \to \prod_i B_i.

For each j\in I we let \alpha_j be the composition

\prod_{i\in I} A_i \stackrel{\pi_{j, A}}\longrightarrow A_j \stackrel{f_j}\longrightarrow B_j,

By the definition of the product \prod_i B_i, there is a unique morphism f:\prod_i A_i \to \prod_i B_i such that for each j\in I,

\pi_{j, B}\circ f = \alpha_j = f_j \circ \pi_{j, A}.

Here is the construction in diagram:


Proposition 3.

Suppose we have morphisms f_i : A_i \to B_i, g_i : B_i \to C_i for each i\in I. Let h_i = g_i \circ f_i. By the above

  • the morphisms (f_i) induce f : \prod_i A_i \to \prod_i B_i;
  • the morphisms (g_i) induce g: \prod_i B_i \to \prod_i C_i;
  • the morphisms (h_i) induce h: \prod_i A_i \to \prod_i C_i.

Then h = g\circ f.


By construction h is the unique morphism \prod_i A_i \to \prod_i C_i satisfying:

\pi_{j,C} \circ h = h_j \circ \pi_{j, A} =g_j \circ f_j \circ \pi_{j, A}, \ \text{ for each } j\in I.

On the other hand g\circ f also satisfies the same condition

\pi_{j,C} \circ g\circ f = g_j\circ \pi_{j, B}\circ f = g_j \circ f_j \circ \pi_{j, A},\ \text{ for each } j\in I.

Thus h = g\circ f. ♦

Corollary 1.

Suppose products A\times B always exist in \mathcal C. We obtain a functor of categories

\times : \mathcal C \times \mathcal C \longrightarrow \mathcal C

which takes (A,B) \in \mathcal C\times \mathcal C to A\times B\in \mathcal C.


Coproducts in a Category

Next, we generalize the case of direct sum of A-modules to objects in a general category.


The coproduct of (A_i)_{i\in I} comprises of data (A, (\epsilon_i : A_i \to A)_{i \in I}), where

  • A = \coprod_{i\in I} A_i is an object in \mathcal C, and
  • for each i\in I, we have a morphism \epsilon_i : A_i \to A,

satisfying the following universal property. For any (B, (\alpha_i : A_i\to B)_{i\in I}), where

  • B \in \mathcal C is an object, and
  • for each i\in I, we have a morphism \alpha_i : A_i\to B,

there is a unique morphisim f : A \to B such that f\circ \epsilon_i = \alpha_i.

The reader should note that it is obtained from the product by reversing all the arrows. More formally, coproduct in \mathcal C corresponds to product in the opposite category \mathcal C^{op}. Hence we can effortlessly apply all we proved about products to coproducts just by “flipping arrows around”. For example, we know immediately that the coproduct is unique up to unique isomorphism.


In category theory, if a certain notion is useful, its dual is likely to be useful too (usually in rather unexpected places). For example, projective modules vs injective modules, fibration vs cofibration, etc.

Coproduct of Groups

We end this article with a short discussion on coproduct in the category of groups.

Let \mathbf{AbGp} be the category of abelian groups; for G, H \in \mathbf{AbGp}, their coproduct has the same underlying group as the product G\times H. To see this, note that \mathbf{AbGp} = \mathbb{Z}\text{-} \mathbf{Mod}, and we already know that the direct sum of finitely many A-modules is the same as their direct product.

What about coproduct in \mathbf{Gp}? For two groups G and H, the answer is their free product G*H. To describe this concretely, we take the set of all formal products (i.e. strings) of the form:

g_1 h_1 \ldots g_n h_n, \ g_1, \ldots, g_n \in G, \ h_1, \ldots, h_n \in H

and product between two such elements is given by concatenation with reduction. For unique representation, we want g_2, \ldots, g_n \ne 1_G and h_1, \ldots, h_{n-1} \ne 1_H. Identity element is simply the empty string. E.g. we have

(g_1 h_1 g_2 h_2 g_3 1_H) * (g_3^{-1} h_4 g_4 h_5) = (g_1 h_1 g_2 (h_2 h_4) g_4 h_5)

if h_2 h_4 \ne 1 (otherwise we need to simplify further). E.g. when G = H = \mathbb Z, the result is the free group generated by 2 elements. Note that even though G, H \in \mathbf{AbGp}, their coproduct in \mathbf{AbGp} is different from that in \mathbf{Gp}. Thus:

warningIf \mathcal D is a subcategory (even full subcategory) of \mathcal C, the product / coproduct of objects in \mathcal D may differ from that in \mathcal C.


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

4 Responses to Commutative Algebra 20

  1. Vanya says:

    In the first proposition, is it not the case that the statement “In summary, the functor is obtained by right-composing with f” should be “In summary, the natural transformation….”?

  2. Vanya says:

    In the statement of Yondeda’s Lemma should “Every natural transformation T : F_{A'} \to F_A ” be
    Every natural transformation T : F_{A'} \implies F_A “?

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s