## Coproduct vs. product

In a comment on one of my earlier posts on tensors, an alarming question was raised: just what exactly is the difference between the direct sum and direct product of a collection of $\mathbb{F}$-vector spaces? It turns out that the “direct sum” and “direct product” are captured by two much more general notions from category theory, known as the “coproduct” and “product”, respectively, of a family of objects. If we take the direct sum of countably many copies of $\mathbb{R}$, we obtain the vector space of real sequences, only finitely many of whose terms are nonzero (which is countable-dimensional). I will use the abbreviation “FMNZT” for “finitely many nonzero terms”. If we take the direct product over that same family, we obtain the vector space of real sequences, period (which is uncountable-dimensional). On the other hand, the direct sum and direct product coincide if the family of objects we perform them over happens to be finite. What’s going on?

The purpose of this post, therefore, is to discuss the categorical definitions of the coproduct and product, and interpret them in the familiar setting of linear algebra. First, let’s have the definitions themselves (more or less copied from Wikipedia). Let $\mathcal{C}$ be a category and $\{ X_j \}_{j \in J}$ be a family of objects in $\mathcal{C}$.

Coproduct (corresponds to the “direct sum”), written $\coprod$
An object $X$ in $\mathcal{C}$, together with a collection of morphisms $i_j : X_j \to X$ such that for any object $Y$ in $\mathcal{C}$ and any collection of morphisms $f_j : X_j \to Y$, there exists a unique morphism $f : X \to Y$ such that the diagram

commutes, or in other words, $f_j = f \circ i_j$ for all $j$.

Product (corresponds to the “direct product”), written $\prod$
An object $X$ in $\mathcal{C}$, together with a collection of morphisms $\pi_j : X \to X_j$ such that for any object $Y$ in $\mathcal{C}$ and any collection of morphisms $f_j : Y \to X_j$, there exists a unique morphism $f : Y \to X$ such that the diagram

commutes (those subscripts should be “j”, not “i”), or in other words, $f_j = \pi_j \circ f$ for all $j$.

After reading the above definitions, I was still failing to see why the direct sum (“coproduct”) of countably many vector spaces should give a vector space of FMNZT sequences. So I decided to play devil’s advocate, and attempt to prove that the vector space of sequences period was the coproduct of a countable family. Of course, I failed, and perhaps the following will shed some light on why this does not work. Note that we are now working in the category of $\mathbb{F}$-vector spaces where the morphisms are linear maps.

Attempted proof. Suppose $\{ V_j \}$ is a collection of vector spaces indexed by $\mathbb{N}$. Let $X$ be the vector space consisting of sequences $(a_1, a_2, \ldots)$ where $a_j \in V_j$ for all $j$. We wish to prove that $X = \coprod V_j$ with the linear maps $i_j : V_j \to X$ given by $i_j(v) = (0,0, \ldots, v, \ldots)$ (where $v$ appears in position $j$, of course). Let $Y$ be some other $\mathbb{F}$-vector space and suppose we have a collection of linear maps $f_j : V_j \to Y$. I want to construct a linear map $f : X \to Y$ so that $f_j = f \circ i_j$ for all $j$.

OK, well, let’s just let $f(a_1, a_2, \ldots) = \sum_{i=1}^\infty f_j(a_j)$. Wait a second, that could end up being an infinite sum, which makes no sense in this context. This is the showstopper here. End of attempted proof.

“But I’m still cynical”, you say, “why is it not true, in general, that such a linear map $f$ exists and is unique”? Well, let’s look at the following example.

Claim. Let’s take the above situation, in the special case where $V_j = \mathbb{R}$ for all $j$, $Y = \mathbb{R}$, and the maps $f_j : V_j \to Y$ are given by $f_j = i$, the inclusion map. Then there exists uncountably many linear maps $f : X \to Y$ such that for all $j$, we get $f_j = f \circ i_j$.

Proof idea. I’m trying to disprove the fact that $X$ is the coproduct of $\{ V_j \}$. In order to do this, I’m remarking that there are many linear maps $f : X \to Y$ satisfying the conditions, and therefore the map is not unique, thereby disqualifying $X$ from being the coproduct.

To see that the maps aren’t unique, simply note that the vector space $\mathbb{R}^\infty$ of FMNZT sequences is a subspace of $X$, and there is a unique linear map $f : \mathbb{R}^\infty \to Y$ satisfying $f \circ i_j = f_j$ for all $j$ (this is obvious since $\{ e_1, \ldots \}$ is a basis for $\mathbb{R}^\infty$). Therefore, we know that when we try to extend this map to the larger space $X$, we can extend $\{ e_1, \ldots \}$ to a basis for $X$, but there is going to be a lot of arbitrary choices we can make in terms of how the map behaves on basis elements which have infinitely many nonzero terms.

Note that the above does not prove that $\mathbb{R}^\infty$ is the coproduct we’re after (this is, however, the case), but it does prove that $X$ certainly cannot be, due to the problem with uniqueness. If you want, try to prove the former statement from the definition of a coproduct (I already pretty much gave it away in the “attempted proof” above). Also, try showing that $X$ is the product of the family I mentioned, and showing that if the index set $J$ is finite, then

$\displaystyle \prod_{j \in J} X_j = \coprod_{j \in J} X_j.$