Products and Coproducts

Joseph Sullivan

December 2021

Background on Categories

Remark 1. Before reading the formal definition of a category, keep in mind the big picture and some examples.

A category is just a collection of objects and arrows (called morphisms) between them. There’s the category \(\mathsf{Top}\) which has objects being topological spaces, and morphisms being continuous maps (i.e., an arrow for each continuous map). There’s the category \(\mathsf{Group}\) which has objects being groups, and morphisms being group homomorphisms.

At the same time, a category is a very general definition, and some unexpected things can actually fit the axioms. In general we think of morphisms as being functions, but there are examples where morphisms aren’t literally functions, which we’ll get into later.

Definition 1 (Categories Part (1)). A category \(\mathcal{C}\) is a structure consisting of

  • A collection \(\mathop{\mathrm{Ob}}(\mathcal{C})\) called the objects of \(\mathcal{C}\)

  • For any \(A,B\in \mathop{\mathrm{Ob}}(\mathcal{C})\), a collection \(\mathop{\mathrm{Hom}}_\mathcal{C}(A,B)\) called the morphisms from \(A\) to \(B\) or the Hom set of \(A\) and \(B\)

  • For any \(A\in \mathop{\mathrm{Ob}}(\mathcal{C})\), a morphism \(\mathrm{id}_A \in \mathop{\mathrm{Hom}}_\mathcal{C}(A,A)\) called the identity morphism of \(A\).

and for any \(A,B,C\in \mathop{\mathrm{Ob}}(\mathcal{C})\) we have an assignment called composition \[\circ: \mathop{\mathrm{Hom}}_\mathcal{C}(A,B) \times \mathop{\mathrm{Hom}}_\mathcal{C}(B,C) \to \mathop{\mathrm{Hom}}_\mathcal{C}(A,C)\] which sends \(f,g \mapsto g\circ f\), called the composition of \(f\) and \(g\). We define some notation before writing the axioms for a category.

Remark 2. We outline some notation.

  • Instead of writing \(A\in \mathop{\mathrm{Ob}}(\mathcal{C})\), we often just write \(A\in \mathcal{C}\).

  • Instead of writing \(f\in \mathop{\mathrm{Hom}}_\mathcal{C}(A,B)\), we often just write \(f\in \mathop{\mathrm{Hom}}(A,B)\) when \(\mathcal{C}\) is clear, or just \(f: A\to B\).

  • For \(f:A\to B\), we call \(A\) the domain of \(f\) and \(B\) the codomain of \(f\).

  • Instead of writing \(g\circ f\) for \(f:A\to B\), \(g:B\to C\), we often just write \(gf\) (unless this could be confused for a coordinate-wise product in certain categories).

Definition 2 (Categories Part (2)). Here are the axioms for a category.

  • For any morphism \(f: A\to B\), \[\mathrm{id}_B \circ f = f\circ \mathrm{id}_A = f.\]

  • For any morphisms \(f: A\to B\), \(g:B\to C\), \(h:C\to D\), \[(h\circ g)\circ f = h\circ (g\circ f),\] i.e., composition is associative.

Example 1. Let’s go over some examples of some standard categories.

  • \(\mathsf{Group}\) is the category of groups, where \(\mathop{\mathrm{Ob}}(\mathsf{Group})\) is the collection of all groups, and for \(G,H\) being groups, \(\mathop{\mathrm{Hom}}(G,H)\) is the set of all group homomorphisms from \(G\) to \(H\). For any group \(G\), the identity morphism \(\mathrm{id}_G\) is just the identity group homomorphism \(\mathrm{id}_G\).

    To be extra careful, we should check the axioms, but they are pretty clear when morphisms are literally functions—composing with an identity function does nothing, and function composition is associative.

  • \(\mathsf{Top}\) is the category of topological spaces. Objects are topological spaces, morphisms are continuous maps, and the identity morphism of \(X\) is just the identity map of \(X\).

  • We could go on listing more familiar things. \(\mathsf{Ring}\) is the category of rings (please, please take the convention that rings have identity—otherwise call them rngs) with ring homomorphisms, \(\mathsf{Mod}_R\) is the category of modules with module homomorphisms, \(\mathsf{Set}\) is the category of sets with functions, etc.

Example 2. Let’s now mention some weird categories to emphasize that morphisms need not be functions.

  • Let’s just construct a finite category with our hands. I’ll draw a picture. In general we normally picture categories as directed graphs of sorts, just like when we draw commutative diagrams in algebra.

    We then define our category \(\mathcal{C}\) based to match our picture. We say \[\mathop{\mathrm{Ob}}(\mathcal{C}) = \{A,B\},\] and (adding in the not drawn identity morphisms that are required by the axioms) \[\mathop{\mathrm{Hom}}(A,A) = \{\mathrm{id}_A\}, \qquad \mathop{\mathrm{Hom}}(B,B) = \{\mathrm{id}_B\}, \qquad \mathop{\mathrm{Hom}}(A,B) = \{f\}.\] Now, we need to define composition. There aren’t very many possible compositions (because domain and codomain need to match), so it won’t take long to just write them all down: \[\mathrm{id}_A\circ \mathrm{id}_A = \mathrm{id}_A, \quad f\circ \mathrm{id}_A = f, \quad \mathrm{id}_B \circ f = f, \quad \mathrm{id}_B \circ \mathrm{id}_B = \mathrm{id}_B.\] You can check that this satisfies identity morphisms being identities for composition, and composition being associative (i.e., the category axioms). Thus, we’ve just defined a category without our objects being sets or our morphisms being functions.

  • Generalizing our previous example, we can define a category given any directed graph. We take our objects to be the vertices, and our morphisms to be the arrows closed under adding identity morphisms and compositions of arrows (i.e., given

    we would need to say \(\mathop{\mathrm{Hom}}(A,C)\) includes \(g\circ f\)).

Here’s one more definition that we’ll need.

Definition 3. Let \(\mathcal{C}\) be a category. A morphism \(f:A\to B\) is called an isomorphism if there exists a morphism \(g:B\to A\) such that \(g\circ f = \mathrm{id}_A\), \(f\circ g = \mathrm{id}_B\) (i.e., there exists an inverse morphism).

Products and Coproducts

Remark 3. Our goal is to understand what it means for something to be a product/coproduct in the category theory sense, and then see how this perspective can help us prove some things in topology.

Products

Remark 4 (Intuition). You’ve definitely seen some products before. The cartesian product of two sets \(A,B\) is a new set \[A\times B = \{(a,b) \mid a\in A, b\in B\}.\]

The product of topological spaces \(X,Y\) is the cartersian of the underlying sets \(X\times Y\), with the topology generated (i.e., having subbasis) sets \(U\times Y\), \(X\times V\) for \(U\subseteq X\) open, \(V\subseteq Y\) open. This is kind of a weird way to phrase it, but it turns out to be useful later. This is exactly the same as the topology generated by \(U\times V\) for \(U,V\) open, since we can get \(U\times V\) by doing \[U\times Y \cap X\times V.\]

We can also talk about products of groups, rings, etc. All of these constructions feel kinda natural in some sense. For starters, these constructions make it so the projection maps are morphisms in the appropriate category (i.e., functions, continuous maps, group/ring homomorphisms). However, this is clearly not a sufficient requirement. For example, \(\mathbb{Z}\times \mathbb{Z}\times \mathbb{Z}/2\mathbb{Z}\) has two projection maps to \(\mathbb{Z}\), but this thing is definitely not the product of \(\mathbb{Z}\times \mathbb{Z}\).

In category theory we like to zoom out and talk about objects and morphisms, usually trying to somewhat avoid talking about elements of objects. Can we come up with a category theoretic definition of product that somehow encapsulates all of these examples? It probably should say something about these projection maps, but what should it say?

Definition 4 (Universal Property of Products). Let \(\mathcal{C}\) be a category, and \(A,B\in \mathcal{C}\). We say that \(P\) is a product of \(A,B\) if there exist morphisms \(\pi_A: P\to A\), \(\pi_B: P\to B\) called projection morphisms such that for any \(C\in \mathcal{C}\) with morphisms \(f_A: C\to A\), \(f_B: C\to B\), there exists a unique morphism \(f: C\to P\) that makes the following diagram commutes.

We often denote the product \(P\) by \(A\times B\).

Remark 5. So that’s a lot of text, and we should make some comments.

First, this universal property holds for the product constructions that we’re familiar with. For example, if \(A,B,C\) are sets, and we have a functions \(f_A: C\to A\) and \(f_B: C\to B\), we can assemble these two coordinate functions into a single function \(f:C\to A\times B\) defined by \(f(c) = (f_A(c),f_A(c))\).

Second, we said “a” product, not “the” product. For starters, there are some categories where certain objects do not have products. Still, we’ll eventually see that the product (if it exists) is unique up to unique isomorphism that makes the projections commute. So this makes it so products are pretty much unique, but not quite. We’ll usually say “the” anyways.

For example, if \(\varphi: C\to A\times B\) is an isomorphism between an object \(C\) and the product \(A\times B\), then we could also \(C\) is a product with projections \(\pi_A\circ \varphi, \pi_B \circ \varphi\).

Exercise 1. Prove that the product of topological spaces is the categorical product.

Remark 6. I’m going to be a little bit intentionally vague in this remark. It’ll be more clear in the actual proof of uniqueness. I just wanted to get some motivation down first.

Let’s turn our attention to uniqueness of the product. Our definition of a categorical product is an example of a universal property. There’s a precise definition of universal property somewhere out there, but it’s not worth getting at for now (I’m not even sure what it is either). Essentially, something has a universal property when we have a condition that says “whenever \(-\) morphisms exist, then there exists a unique morphism \(-\) such that \(-\) commutes”.

Then, there’s a common strategy to prove that an object with a universal property is unique up to unique isomorphism (that makes some diagram commute). Given two objects \(C,D\) with the universal property, we use the universal property to come up with a morphism \(C\to D\) and a morphism \(D\to C\), and then we use uniqueness to argue that the composition \(C\to D\to C\) is just the identity morphism.

Theorem 1. Let \(\mathcal{C}\) be a category, and let \(A,B\in \mathcal{C}\). Let \(P\) (with projections \(\pi_A,\pi_B\)) and \(P'\) (with projections \(\pi_A', \pi_B'\)) be products of \(A,B\). Then, there exists a unique isomorphism \(f: P\to P'\) such that the following commutes

(i.e., we can do projections before or after the isomorphism).

Proof. We want to find morphisms \(f: P\to P'\), \(g: P'\to P\) such that \(g\circ f = \mathrm{id}_P\), \(f\circ g = \mathrm{id}_{P'}\), i.e., we’re trying to find an isomorphism.

To find these morphisms, our strategy is to project \(P\) down to \(A,B\), and then put the projections together (using the universal property of \(P'\)) to get a morphism \(P\to P'\).

More precisely, since \(P\) has morphisms \(\pi_A,\pi_B\) to \(A,B\), and since \(P'\) is a categorical product, we get a morphism \(f:P\to P'\) such that the following commutes.

Similarly, \(P'\) has morphisms \(\pi_A', \pi_B'\) to \(A,B\), and \(P\) is a categorical product, so we get a morphism \(g: P'\to P\) such that the following commutes.

Now, we want to show \(g\circ f = \mathrm{id}_P\), and by symmetry we also get \(f\circ g = \mathrm{id}_{P'}\). The key is to use the uniqueness part of the universal property of products. The fact that our two diagrams commute tells us that the following larger diagram commutes.

Just looking at the outside and middle arrows, we have the following commutative diagram.

We also observe that the identity morphism \(\mathrm{id}_P\) instead of \(g\circ f\) also makes the diagram, so by the (uniqueness part) universal property of products applied to \(P\), this tells us \(\mathrm{id}_P = g\circ f\). ◻

Coproducts

Remark 7 (Intuition). We saw before that products generalize cartesian products. In the same way, coproducts generalize disjoint unions. Roughly speaking, a coproduct is the free-est way to put together two objects in a category. In particular, we’ll see later that direct sums are an example of coproducts.

First things first, we should clarify what we mean by a disjoint union. There’s a slightly annoying abuse of notation that goes on here. You might have heard of internal/external direct sum—we’re going to have the same problem.

Definition 5. We define what I’m referring to as internal/external disjoint union.

  • Let \(X\) be a set, \(A,B\subseteq X\) such that \(A\cap B=\emptyset\) and \(A\cup B = X\). Then, we say \(X\) is the (internal) disjoint union of \(A\) and \(B\), and we write \[X = A\sqcup B\]

  • Let \(A,B\) be sets. We define the (external) disjoint union of \(A\) and \(B\) to be the set \[\begin{aligned} A\sqcup B &\overset{\text{def}}{=}(A\times\{0\}) \cup (B\times \{1\})\\ &= \{(a,0) \mid a\in A\} \cup \{(b,1) \mid b\in B\}. \end{aligned}\]

Remark 8. In case of external disjoint unions, we put together two sets \(A,B\) that might overlap, but we assert that their elements be different in the disjoint union by “tagging” them with either a \(0\) or a \(1\). These tagged versions of \(A,B\) are still in bijection with \(A,B\).

Definition 6 (Universal Property of Coproducts). Let \(\mathcal{C}\) be a category, and let \(A,B\in \mathcal{C}\). We say that \(U\) is a coproduct of \(A,B\) of there exist morphisms \(i_A: A\to U, i_B: B\to U\) called inclusion morphisms such that for any \(C\in \mathcal{C}\) with morphisms \(g_A: A\to C\), \(g_B: B\to C\) there exists a unique morphism \(g: U\to C\) that makes the following diagram commute.

We often denote the coproduct \(U\) by \(A\sqcup B\).

Remark 9. As before, coproducts need not exist in every category, and they will only be unique up to unique isomorphism. We will see a proof of this later.

Exercise 2 (Easy). Show that for sets \(A,B\), the disjoint union \(A\sqcup B\) is a coproduct \(A,B\).

Exercise 3. Let \(A,B\) be \(R\)-modules. Show that \(A\oplus B\) is a coproduct of \(A,B\).

Hint. The inclusion maps should be \(i_A: A\to A\oplus B\) which sends \(i_A(a)=(a,0)\), and likewise for \(B\).

Remark 10. We recall that the direct product and direct sum of finitely many \(R\)-modules are isomorphic, i.e., \(A\times B \cong A\oplus B\). In some category, for objects \(A,B\), when the product and coproduct are isomorphic, we call it the biproduct. The category of \(R\)-modules is a particularly nice category because it has all finite biproducts. It has lots of other nice properties too—it’s what’s called an abelian category.

Remark 11. Before proving the uniqueness of coproducts, we’re going to go on a tangent about duality in category theory, which in the process will give us a nice proof of uniqueness of coproducts for free.

Duality

Remark 12. Observe that the diagram giving the universal property of a coproduct has the same shape as that of products, except all of the arrows are reversed. We can actually take advantage of this symmetry to translate proofs about products into proofs of dual propositions about coproducts.

For starters, we could just say, “take the proof of uniqueness of products, except flip all arrows, and then we have a proof of uniqueness of coproducts” (using the fact that “reversed” isomorphisms are still isomorphisms). So you could try to write down a proof of uniqueness of coproducts already.

Instead, we’re going to do essentially the same thing with more formalism. If we have a category \(\mathcal{C}\) and we want to prove uniqueness of coproducts in \(\mathcal{C}\), we’re going to cook up another category called \({\mathcal{C}}^{\mathrm{op}}\). Then, in \({\mathcal{C}}^{\mathrm{op}}\), coproducts of \(\mathcal{C}\) are literally translated into products.

Definition 7. Let \(\mathcal{C}\) be a category. We define the opposite category \({\mathcal{C}}^{\mathrm{op}}\) to be the category with objects \(\mathop{\mathrm{Ob}}(\mathcal{C})\), with morphisms \[\mathop{\mathrm{Hom}}_{{\mathcal{C}}^{\mathrm{op}}}(A,B) = \mathop{\mathrm{Hom}}_\mathcal{C}(B,A).\] Then, define composition \[\circ: \mathop{\mathrm{Hom}}_{{\mathcal{C}}^{\mathrm{op}}}(A,B) \times \mathop{\mathrm{Hom}}_{{\mathcal{C}}^{\mathrm{op}}}(B,C) \longrightarrow \mathop{\mathrm{Hom}}_{{\mathcal{C}}^{\mathrm{op}}}(A,C)\] by \(f,g \mapsto f\circ g\) (this is composition given in \(\mathcal{C}\), and we can compose in this “backwards” way because the Hom sets are backwards).

Remark 13. We make a few remarks.

  • The opposite category is really is just taking a category, and flipping all of the arrows around. The thing to note is that reversing all the arrows still gives you a category—you should check the axioms and see that identities and associativity still works out.

  • For \(f\in \mathop{\mathrm{Hom}}_\mathcal{C}(B,A)\), sometimes (for clarification) we write the corresponding morphism in \(\mathop{\mathrm{Hom}}_{{\mathcal{C}}^{\mathrm{op}}}(A,B)\) by \({f}^{\mathrm{op}}\).

  • The opposite category is an example of a category where the morphisms aren’t literally functions—they are just arrows that are “labeled” by functions, but the arrows are pointing opposite of the functions.

Example 3. Let’s run through \({\mathsf{Set}}^{\mathrm{op}}\) for practice. The objects are still just sets. For example, we have objects \(\{0,1,2,3\}\) and \(\{0\}\). In good ol’ \(\mathsf{Set}\), we have a morphism (function) \(f:\{0,1,2,3\} \to \{0\}\) which sends everything to \(0\). Then, in \({\mathsf{Set}}^{\mathrm{op}}\), we have a morphism (not function) \({f}^{\mathrm{op}}: \{0\}\to \{0,1,2,3\}\) which refers to the same function \(f\), but we just reversed the direction.

Exercise 4. Let \(\mathcal{C}\) be a category, \(A,B\in \mathcal{C}\), and let \(P\) be a product of \(A,B\). Show that \(P\) is a coproduct of \(A,B\) in \({\mathcal{C}}^{\mathrm{op}}\).

Exercise 5. Let \(\mathcal{C}\) be a category, \(f: A\to B\) a morphism in \(\mathcal{C}\). Prove that \(f:A\to B\) is an isomorphism in \(\mathcal{C}\) if and only if \({f}^{\mathrm{op}}: B\to A\) is an isomorphism in \({\mathcal{C}}^{\mathrm{op}}\).

Exercise 6. Use exercises 4,5 to prove that coproducts are unique up to a unique isomorphism that commutes with inclusions.