Skip to main content

Products

In the last post we encountered the notion of spaces, which are a way of thinking about situations numerically and geometrically. We saw a few examples of spaces:

  • Rn\R^n is the set of all nn-tuples of real numbers, which we think of as nn-dimensional space

  • [a,b]\ClsdIntvl ab is the interval of numbers between aa and bb (inclusive on both sides).

  • in particular, I:=[0,1]\I\Defeq\ClsdIntvl01 consists of all xx with 0≤x≤10\le x\le 1

  • S1S^1 is the unit circle in R2\VecR 2

In this post, we'll discuss a way to combine two (or more) spaces XX and YY into a new space X×YX\times Y, called the product of XX and YY. There are two reasons to do this:

  • it gives us more interesting examples of spaces;

  • conversely, we understand complicated spaces by expressing them in terms of simpler "building block" spaces. Most questions about X×YX\times Y can be answered by answering the same question for the spaces XX and YY, and combining the answers somehow.

The space X×YX\times Y is analogous to the tuple type [X, Y].

Examples​

Multiplication​

Let's explain why this operation is called multiplication. If XX is a finite set, we write ∣X∣|X| for the number of elements of XX, also called the cardinality or size of X.X. For example, ∣{a,b,c}∣=3.|\{a,b,c\}|=3.

When XX and YY are finite sets, the size of X×YX\times Y is the product of the sizes of XX and Y:Y:

∣X×Y∣=∣X∣∣Y∣. |X\times Y| = |X||Y|.

For instance, say we have three possible colors and four shapes. The number of possible colored shapes is 3×4=12:3\times4=12:

{red, green, blue}×{▲, ■, ★, ∙}={▲■★∙▲■★∙▲■★∙}\Large \{\red{\mathrm{red}},\, \green{\mathrm{green}},\, \blue{\mathrm{blue}}\} \times \{\blacktriangle,\, \blacksquare,\, \bigstar,\, \bullet\} = \left\{\begin{matrix} \red\blacktriangle&\red\blacksquare&\red\bigstar&\red\bullet\\ \green\blacktriangle&\green\blacksquare&\green\bigstar&\green\bullet\\ \blue\blacktriangle&\blue\blacksquare&\blue\bigstar&\blue\bullet \end{matrix}\right\}

Associativity​

One of the most important properties of ordinary multiplication (of numbers) is associativity: this is the property

(ab)c=a(bc). (ab)c = a(bc).

which means that the expression abcabc is unambiguous. For example, we could evaluate 2⋅3⋅42\cdot3\cdot4 as

(2⋅3)⋅4=6⋅4=242⋅(3⋅4)=2⋅12=24\begin{align*} (2\cdot3)\cdot4 &= 6\cdot4 = 24\\ 2\cdot(3\cdot4) &= 2\cdot12 = 24 \end{align*}

and both give the same result.

Something similar is true for the product of spaces, but we have to be more careful. We can give a direct definition of X×Y×ZX\times Y\times Z a space of 3-tuples

X×Y×Z:={(x,y,z)∣x∈X, y∈Y, z∈Z}, X\times Y\times Z \Defeq \{(x,y,z) \mid x\in X,\, y\in Y,\, z\in Z\},

or we can build it out of products of two spaces at a time:

(X×Y)×Z={((x,y),z)∣x∈X, y∈Y, z∈Z}X×(Y×Z)={(x,(y,z))∣x∈X, y∈Y, z∈Z}\begin{align*} (X\times Y)\times Z &= \{((x, y), z) \mid x\in X,\, y\in Y,\, z\in Z\}\\[.5em] X\times (Y\times Z) &= \{(x, (y, z)) \mid x\in X,\, y\in Y,\, z\in Z\} \end{align*}

These three options aren't "literally" equal. As an analogy, in TypeScript, [X, Y, Z], [[X, Y], Z], and [X, [Y, Z]] are all different types. But there is an obvious way to go between them:

(x,y,z)⟷((x,y),z)⟷(x,(y,z)). (x,y,z) \longleftrightarrow ((x,y),z) \longleftrightarrow (x,(y,z)).

In math, we generally leave these conversions implicit, so we will write

(X×Y)×Z=X×Y×Z=X×(Y×Z). (X\times Y)\times Z = X\times Y\times Z = X\times(Y\times Z).

I'll say a bit more about this expanded view of equality a few posts from now.

In my area of math (homotopy theory), there's often a lot of work that needs to be done to keep track of all these implicit conversions. One of the difficulties is that when converting between (X×X)×X(X\times X)\times X and X×(X×X)X\times(X\times X), you don't want to accidentally use the "wrong" conversion

((x,y),z)⟷(z,(y,x)) ((x,y),z) \longleftrightarrow (z,(y,x))

(which wouldn't typecheck for (X×Y)×Z(X\times Y)\times Z versus X×(Y×Z)X\times(Y\times Z))