§ Categorical definition of products in painful detail

I feel like I have incorrectly understood, then un-understood, and re-understood in a slightly less broken way the definition of the product in category theory around 5 times. I'm documenting the journey here.

§ The definition

Given two objects a,ba, b, in a category CC, any 3-tuple (pC,πaHom(p,a),πbHom(p,b))(p \in C, \pi_a \in Hom(p, a), \pi_b \in Hom(p, b)) is called their product , if for any other 3 tuple (qC,πaHom(q,a),πbHom(q,b))(q \in C, \pi'_a \in Hom(q, a), \pi'_b \in Hom(q, b)), we have a unique factorization map fHom(q,p)f \in Hom(q, p) such that πa=πaf\pi'_a = \pi_a \circ f, πb=πbf\pi'_b = \pi_b \circ f. (Note that I did not say the product. This is on purpose). We claim that the product is unique up to unique isomorphism. Let's choose the category to be the category of sets. Let's try and figure out what a product of the sets a={α,β}a = \{ \alpha, \beta \} and b={γ,δ}b = \{ \gamma, \delta \} is going to be.

§ Non-example 1: product as {1}\{ 1 \}

Let's try to choose the product set as simply {1}\{ 1 \}, with the maps being chosen as πa(1)=α;πb(1)=γ\pi_a(1) = \alpha; \pi_b(1) = \gamma:
     πb
p{1}--->{ γ }
  |     { δ }
  |
πa|
  v
{ α , β }
In this case, it's easy to see the failure. I can build a set q={2}q = \{ 2 \} with the maps πa(2)=α;πb(2)=δ\pi'_a(2) = \alpha; \pi'_b(2) = \delta:
     πb
q{2}-+  { γ }
  |  |  {   }
  |  +->{ δ }
  |
πa|
  v
{ α , β }
There is a single, unique map which takes qq to pp, which is the function f:21f: 2 \mapsto 1. See that πb(2)=δ\pi'_b(2) = \delta, while πb(f(2))=πb(1)=γ\pi_b(f(2)) = \pi_b(1) = \gamma. Hence the universal property can never be satisfied. Thus ({1},1α,1γ)(\{ 1 \}, 1 \mapsto \alpha, 1 \mapsto \gamma) is not a product of {α,β}\{ \alpha, \beta \} and {γ,δ}\{ \gamma, \delta \} as it is unable to represent a pair (α,δ)(\alpha, \delta).

§ Non-example 2: product as {1,2,3,4,5}\{ 1, 2, 3, 4, 5 \}

In this case, we shall see that we will have too much freedom , so this will violate the "unique map" aspect. Let's pick some choice of πa\pi_a and πb\pi_b. For example, we can use:
(p={1,2,3,4},πa=1α,2α,3β,4β,5βπb=1γ,2δ,3γ,4δ,5δ) \begin{aligned} (&p = \{ 1, 2, 3, 4\}, \\ &\pi_a = 1 \mapsto \alpha, 2 \mapsto \alpha, 3 \mapsto \beta, 4 \mapsto \beta, 5 \mapsto \beta\\ &\pi_b = 1 \mapsto \gamma, 2 \mapsto \delta, 3 \mapsto \gamma, 4 \mapsto \delta, 5 \mapsto \delta) \end{aligned}
Now let's say we have a set q={42}q = \{ 42 \} such that πa(42)=β,πb(42)=δ\pi'_a(42) = \beta, \pi'_b(42) = \delta. If we try to construct the map f:qpf: q \rightarrow p, notice that we get \emph{two} possible legal maps. We can set f(42)=4f(42) = 4, or f(42)=5f(42) = 5, because both 44 and 55 map into (β,δ)(\beta, \delta). This violates the uniqueness condition of the product. Thus, the set {1,2,3,4,5}\{1, 2, 3, 4, 5\} is not a product of {α,β}\{\alpha, \beta \} and {γ,δ}\{\gamma, \delta \} because it does not provide a unique map from qq into pp. Alternatively, it does not provide a unique representation for the tuple (β,δ)(\beta, \delta). Thus it can't be a product.

§ Checking an example: {α,β}×{γ,δ}\{ \alpha, \beta \} \times \{ \gamma , \delta \} as {1,2,3,4}\{1, 2, 3, 4\}

I claim that a possible product of aa and bb is:
(p={1,2,3,4},πa=1α,2α,3β,4β,πb=1γ,2δ,3γ,4δ) \begin{aligned} (&p = \{ 1, 2, 3, 4\}, \\ &\pi_a = 1 \mapsto \alpha, 2 \mapsto \alpha, 3 \mapsto \beta, 4 \mapsto \beta,\\ &\pi_b = 1 \mapsto \gamma, 2 \mapsto \delta, 3 \mapsto \gamma, 4 \mapsto \delta) \end{aligned}
p       πa            a
   1------------*--->{α}
   |  2--------─┘    { }
   |  | 3-------*--->{β}
   |  | | 4----─┘
   +----* |
πb |  |   |
   |  *---+
   |      |
   v      v
b {γ      δ}
Now given a 3-tuple (q,πaHom(q,a),πbHom(q,b))(q, \pi'_a \in Hom(q, a), \pi'_b \in Hom(q, b)), we construct the factorization map f:qpf: q \rightarrow p, where:
f:qp;f(x){1πa(x)=απb(x)=γ2πa(x)=απb(x)=δ3πa(x)=βπb(x)=γ4πa(x)=βπb(x)=δ f: q \rightarrow p; \quad f(x) \equiv \begin{cases} 1 & \pi'_a(x) = \alpha \land \pi'_b(x) = \gamma \\ 2 & \pi'_a(x) = \alpha \land \pi'_b(x) = \delta \\ 3 & \pi'_a(x) = \beta \land \pi'_b(x) = \gamma \\ 4 & \pi'_a(x) = \beta \land \pi'_b(x) = \delta \\ \end{cases}
That is, we build f(x)f(x) such that on composing with πa\pi_a and πb\pi_b, we will get the right answer. For example, if πa(x)=α\pi'_a(x) = \alpha, then we know that we should map xx to an element ypy \in p such that π(y)=α\pi(y) = \alpha. So we need y=1y=2y = 1 \lor y = 2. Then looking at πb(x)\pi'_b(x) allows us to pick a unique y. There is zero choice in the construction of ff. We need exactly 4 elements to cover all possible ways in which qq could map into aa and bb through πa,πb\pi'_a, \pi'_b such that we cover all possibilities with no redundancy. This choice of product is goldilocks : it does not have too few elements such that some elements are not representable; it also does not have too many elements such that some elements are redundant.

§ Non uniqueness: product as {10,20,30,40}\{10, 20, 30, 40\}

Note that instead of using p={1,2,34}p = \{1, 2, 3 4\}, I could have used p={10,20,30,40}p = \{10, 20, 30, 40 \} and nothing would have changed. I have never depended on using the values 1,2,3,41, 2, 3, 4. Rather, I've only used them as \emph{labels}.

§ Non uniqueness: product as {(α,γ),(α,δ),(β,γ),(β,δ)}\{ (\alpha, \gamma), (\alpha, \delta), (\beta, \gamma), (\beta, \delta) \}

Indeed, our usual idea of product also satisfies the product, since it is in unique isomorphism to the set {1,2,3,4}\{1, 2, 3, 4\} we had considered previously. But this might be strange: Why is it that the categorical definition of product allows for so many other "spurious" products? Clearly this product of tuples is the best one, is it not? Of course not! Inside the category of sets, anything with the same cardinality is isomorphic. So nothing inside the category can distinguish between the sets {1,2,3,4}\{1, 2, 3, 4\} and {(α,γ),(α,δ),(β,γ),(β,δ)}\{ (\alpha, \gamma), (\alpha, \delta), (\beta, \gamma), (\beta, \delta) \}. Hence, the usual product we are so used to dealing with is not privileged. This should make us happy, not sad. We have removed the (un-necessary) privilege we were handing to this one set because it "felt" like it was canonical, and have instead identified what actually makes the product of sets tick: the fact that their cardinality is the product of the cardinalities of the individual sets!

§ How to think about the product

Since we are specifying the data of (p,πa,πb)(p, \pi_a, \pi_b), we can simply think of elements of pp as being "pre-evaluated", as (xp,πa(x),πb(x))(x \in p, \pi_a(x), \pi_b(x)). So in our case, we can simplify the previous situation with (p={10,20,30,40},πa,πb)(p = \{ 10, 20, 30, 40 \}, \pi_a, \pi_b) by writing the set as p={(10,α,γ),(20,α,δ),(30,β,γ),(40,β,δ)}p = \{ (10, \alpha, \gamma), (20, \alpha, \delta), (30, \beta, \gamma), (40, \beta, \delta) \}. This tells us "at a glance" that every element of a×ba \times b is represented, as well as what element it is represented by.

§ Proof of uniqueness upto unique isomorphism

  • Assume we have two products (p,πa,πb)(p, \pi_a, \pi_b) and (q,πa,πb)(q, \pi_a, \pi_b), which are products of aa and bb
  • By the universality of pp wrt qq, we get a unique! map q2pq2p such that the diagaram commutes.
  • By the universality of qq wrt pp, we get a unique! map p2qp2q
  • We get a map q2pp2q:ppq2p \cdot p2q : p \rightarrow p. by the universality of pp with respect to pp, we get a unique! map that makes the diagram commute.But we have two such maps: idpid_p as well as q2p.p2qq2p . p2q. Hence we must have idp=q2pp2qid_p = q2p \cdot p2q. In pictures:
          ∃!id(p)
          +---+
          |   |
          |   v
+---------ppppp--------+
| πa      |   ^     πb |
v      ∃!p2q  |        v
a         |   |        b
^         |  ∃!q2p     ^
| π'b     v   |    π'b |
+---------qqqqq--------+
  • The full diagram commutes.
  • By definition of identity/commutativity of the diagram, πaidp=πa\pi_a \circ id_p = \pi_a.
  • By definition of identity/commutativity of the diagram, πbidp=πb\pi_b \circ id_p = \pi_b.
  • By the commutativity of the diagram, we have πa(q2pp2q)=πa\pi_a \circ (q2p \circ p2q) = \pi_a.
  • By the commutativity of the diagram, we have πb(q2pp2q)=πb\pi_b \circ (q2p \circ p2q) = \pi_b.
  • We can consider the universal property of the product, where we have (p,πa,πb)(p, \pi_a, \pi_b) as one product, and (p,πa,πb)(p, \pi_a , \pi_b) as another product.
  • This gives us a unique map hh such that πah=πa\pi_a \circ h = \pi_a, and πbh=πb\pi_b \circ h = \pi_b.
  • We have two candidates for hh: h=idph = id_p and h=p2qq2ph = p2q \circ q2p. Hence, by the uniqueness of hh, we have that idp=p2qq2pid_p = p2q \circ q2p.

§ Wrapping up