# The Unapologetic Mathematician

## Products and Coproducts

Let’s consider the Cartesian product $X\times Y$ of two sets $X$ and $Y$. Classically we think of this as the set of all pairs $(x,y)$ with $x\in X$ and $y\in Y$. But we can also characterize it just in terms of functions.

Specifically, $X\times Y$ comes with two projection functions $\pi_X:X\times Y\rightarrow X$ and $\pi_Y:X\times Y\rightarrow Y$, defined by $\pi_X(x,y)=x$ and $\pi_Y(x,y)=y$. If we take any other set $S$ with functions $f_X:S\rightarrow X$ and $f_Y:S\rightarrow Y$ we can define the function $(f_X,f_Y):S\rightarrow X\times Y$ by $\left[(f_X,f_Y)\right](s)=(f_X(s),f_Y(s))$. Then we see that $\pi_X\circ(f_X,f_Y)=f_X$ and $\pi_Y\circ(f_X,f_Y)=f_Y$. Further, this function from $S$ to $X\times Y$ is the only such function.

Now let’s do away with those nasty elements altogether and draw this diagram:

What does this mean? Well, it’s like the diagram I drew for products of groups. The product of $X$ and $Y$ is a set $X\times Y$ with functions $\pi_X$ and $\pi_Y$ so that for any other set $S$ with functions to $X$ and $Y$ there exists a unique arrow to $X\times Y$ making the diagram commute. Since we’ve written this definition without ever really referring to elements we can just pick it up and drop it into any other category. Many descriptions of categorical products stop here, but let’s push a bit further.

Let’s consider a category $\mathcal{C}$ containing (among others) objects $X$ and $Y$. From this we’re going to build a new category. An object of our category will be a diagram that looks like $X\leftarrow^{f_X}S\rightarrow^{f_Y}Y$ in $\mathcal{C}$. A morphism from $X\leftarrow^{f_X}S\rightarrow^{f_Y}Y$ to $X\leftarrow^{f'_X}S'\rightarrow^{f'_Y}Y$ will be a morphism $S\rightarrow^{g}S'$ in $\mathcal{C}$ so that $f_X=f'_X\circ g$ and $f_Y=f'_Y\circ g$.

Now what’s a product in $\mathcal{C}$? It’s a terminal object of this category we’ve constructed! That is, it’s one of these diagrams so that every other diagram has a unique morphism (as defined above) to it. This definition makes sense in any category $\mathcal{C}$, though the category we build from a given pair of objects may not have a terminal object, so a given pair of objects of $\mathcal{C}$ may not have a product in $\mathcal{C}$. If every pair of objects of $\mathcal{C}$ has a product in $\mathcal{C}$, we say that $\mathcal{C}$ “has products”.

So, the existence of Cartesian products of sets shows that $\mathbf{Set}$ has products. Similarly, $\mathbf{Grp}$ has products, as do $\mathbf{Ring}$, $\mathbf{Gpd}$ (groupoids), $\mathbf{Cat}$ (small categories), and pretty much all our familiar categories from algebra.

What about something like a preordered set $(P,\preceq)$, considered as a category? What would “product” mean, when written in this language? Well, given elements $a$ and $b$ the product $a\times b$ will have arrows to $a$ and $b$, so $a\times b\preceq a$ and $a\times b\preceq b$. Also, for any other element $c$ with $c\preceq a$ and $c\preceq b$ we have $c\preceq a\times b$ — $c$ has an arrow to both $a$ and $b$, so it has an arrow to $a\times b$. That is, $a\times b$ is a greatest lower bound of $a$ and $b$, and the category has products if and only if every pair of elements has such a greatest lower bound.

And it gets better. If we consider a category $\mathcal{C}$ that has products, the product defines a functor $\times:\mathcal{C}\times\mathcal{C}\rightarrow\mathcal{C}$! If we have arrows $f_1:X_1\rightarrow Y_1$ and $f_2:X_2\rightarrow Y_2$ then I say we’ll have an arrow $f_1\times f_2:X_1\times X_2\rightarrow Y_1\times Y_2$. Indeed, if we consider $f_1\circ\pi_{X_1}:X_1\times X_2\rightarrow Y_1$ and $f_2\circ\pi_{X_2}:X_1\times X_2\rightarrow Y_2$ then we’ll get an arrow from $X_1\times X_2$ to $Y_1\times Y_2$. And this construction preserves compositions and identities. For compositions, start with this diagram:

and draw in the induced arrows $f_1\times f_2$, $g_1\times g_2$, and $(g_1\circ f_1)\times(g_2\circ f_2)$. Then use the uniqueness part of the universal property to show that the composite of the first two must be the same as the third. Do a similar thing to verify that identities are also preserved.

Finally, we can flip all the arrows in what we’ve said to get the dual notion: coproducts. Use this diagram:

and define the coproduct to be an initial object in a certain category of diagrams. Check that in $\mathbf{Set}$ this property is satisfied by disjoint unions. In $\mathbf{Grp}$ coproducts are free products. In a preorder, coproducts are least upper bounds. And, of course, the coproduct defines a functor from $\mathcal{C}\times\mathcal{C}$ to $\mathcal{C}$.

There’s a fair bit to digest here, but it’s worth it. The next few ideas are really very similar. Alternatively, you could take this to mean that if you don’t completely get it now there are a few more examples in the pipe that may help.

### Like this:

Posted by John Armstrong | Category theory

## 9 Comments	»

1. [...] off is that and are both subsets of . That is, there are arrows and . So maybe the union is the coproduct of the two sets. Well, it’s a good guess, but there’s a problem. There may be some [...]

Pingback by | June 14, 2007 | Reply

2. [...] products, coproducts, equalizers, coequalizers, pullbacks, pushouts… We’ve got products and coproducts of two objects at a time, equalizers and coequalizers of two morphisms at a time, and pushouts and [...]

Pingback by | June 15, 2007 | Reply

3. [...] know that any functor that has a right adjoint preserves colimits! The disjoint union of sets is a coproduct, and the direct sum of vector spaces is a biproduct, which means it’s also a coproduct. Thus [...]

Pingback by | July 21, 2008 | Reply

4. Am I right in thinking that the category of diagrams you create in paragraph 5 only makes sense if the category C with which you start contains pull-backs? The reason I ask is that when trying to prove that you get a category, I got stuck on composing the morphisms. If you have pull-backs, I know what to do. Otherwise…

Comment by | September 19, 2008 | Reply

5. No, a morphism is just an arrow between the two middle terms that makes the triangles on the sides commute. Compose morphisms just by composing those arrows, and the larger triangles will automatically commute.

Comment by | September 19, 2008 | Reply

6. Ah…I see where I was confused now. The X and Y you chose are fixed and you are only letting the middle term change. I was letting the X and Y vary.

Comment by | September 19, 2008 | Reply

7. [...] We should also note that the category of root systems has binary (and thus finite) coproducts. They both start the same way: given root systems and in inner-product spaces and , we take the [...]

Pingback by | January 25, 2010 | Reply

8. [...] measurable spaces, but we have a broader perspective here. Indeed, we should be asking if this is a product object in the category of measurable spaces! That is, the underlying space comes equipped with projection [...]

Pingback by | July 15, 2010 | Reply

9. [...] we want to show that we have (finite) products in the category of manifolds. Specifically, if and are – and -dimensional smooth manifolds, [...]

Pingback by | March 7, 2011 | Reply

« Previous | Next »

## About this weblog

This is mainly an expository blath, with occasional high-level excursions, humorous observations, rants, and musings. The main-line exposition should be accessible to the “Generally Interested Lay Audience”, as long as you trace the links back towards the basics. Check the sidebar for specific topics (under “Categories”).

I’m in the process of tweaking some aspects of the site to make it easier to refer back to older topics, so try to make the best of it for now.
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 87, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "github"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "english_confidence": 0.9460359215736389, "perplexity_flag": "head"}