Union and intersection combine sets by keeping or discarding elements. The Cartesian product does something different: it pairs up every element of the first set with every element of the second. The result is not a reshuffling of old elements; it is a brand-new set whose elements are ordered pairs. Once you see the grid, the formula |A \times B| = |A| \cdot |B| is no longer a rule to memorise — it is the obvious count of cells in a rectangle.

The definition

A \times B = \{ (a, b) \mid a \in A, \ b \in B \}

Every element of A \times B is an ordered pair (a, b). The first coordinate comes from A, the second from B. Two pairs (a_1, b_1) and (a_2, b_2) are equal only when a_1 = a_2 and b_1 = b_2. Order matters: (1, 2) and (2, 1) are different pairs, so in general A \times B \ne B \times A.

The grid

Let A = \{1, 2, 3\} and B = \{x, y\}. Write A down the rows and B across the columns. Each of the 3 \times 2 = 6 cells is one ordered pair of A \times B.

Cartesian product grid with A down rows and B across columnsA rectangular grid of six cells with three rows and two columns. The rows are labelled 1, 2, 3 for the elements of A on the left edge. The columns are labelled x and y for the elements of B along the top edge. Each of the six cells shows an ordered pair: the first row has (1, x) and (1, y), the second row has (2, x) and (2, y), and the third row has (3, x) and (3, y). A × B (A = {1, 2, 3}, B = {x, y}) x y columns: B 1 2 3 rows: A (1, x) (1, y) (2, x) (2, y) (3, x) (3, y) |A × B| = 3 × 2 = 6
Every cell is one ordered pair. Rows are $A$, columns are $B$, and the cell at row $a$, column $b$ holds the pair $(a, b)$. Six rows-times-columns is six cells, which is $|A \times B| = 3 \cdot 2 = 6$.

So

A \times B = \{ (1,x), (1,y), (2,x), (2,y), (3,x), (3,y) \}.

Why the cell-count formula: every element of A pairs with every element of B, which means for each of the |A| rows you get |B| pairs — one per column. Multiplying gives |A \times B| = |A| \cdot |B|.

Order really matters

Swap the roles and you get a different set.

B \times A = \{ (x,1), (x,2), (x,3), (y,1), (y,2), (y,3) \}

Six pairs again, but none of them equals any pair in A \times B. (1, x) and (x, 1) are different ordered pairs, even though the components are the same two objects. This is why mathematicians say "Cartesian product is not commutative" — the operation depends on which set you put first.

In the rare case where A = B, the product A \times A (also written A^2) is the set of all ordered pairs of elements of A. For example, if A = \{1, 2\}, then

A^2 = \{ (1,1), (1,2), (2,1), (2,2) \}

with cardinality |A|^2 = 4.

The cardinality formula

For finite sets:

|A \times B| = |A| \cdot |B|

This generalises to more factors:

|A_1 \times A_2 \times \cdots \times A_n| = |A_1| \cdot |A_2| \cdots |A_n|

The proof is the grid picture in n dimensions: an |A_1| \times |A_2| \times \cdots \times |A_n| array has \prod |A_i| cells.

This formula is the bread-and-butter of combinatorics. "How many three-letter passwords from a 26-letter alphabet?" is |L| \cdot |L| \cdot |L| = 26^3. "How many outcomes when you roll two dice?" is |D| \cdot |D| = 6 \cdot 6 = 36. Every time you hear "multiply the counts," the underlying object is a Cartesian product.

Where you have met Cartesian products already

You met one in primary school without anyone calling it a Cartesian product — the coordinate plane:

\mathbb{R} \times \mathbb{R} = \mathbb{R}^2 = \{ (x, y) \mid x, y \in \mathbb{R} \}

Every point on the plane is an ordered pair of real numbers. The plane is literally the Cartesian product of the real line with itself. (The name is not a coincidence — Descartes introduced coordinates, and the Cartesian product is the abstract structure that makes coordinates work.)

Going one dimension higher, \mathbb{R}^3 = \mathbb{R} \times \mathbb{R} \times \mathbb{R} is three-space. A triple (x, y, z) is an ordered tuple in the triple Cartesian product.

Relations live inside A \times B

A relation from A to B is simply a subset of A \times B. For example, with A = \{1, 2, 3\} and B = \{2, 3, 4, 5\}, the "less than" relation

R = \{ (a, b) \in A \times B \mid a < b \}

is the subset of A \times B consisting of pairs where the first coordinate is smaller. Rolling through the grid: (1,2), (1,3), (1,4), (1,5), (2,3), (2,4), (2,5), (3,4), (3,5). Nine pairs out of the twelve cells of A \times B. Every relation you meet in Relations is specified by which cells of the A \times B grid it claims.

Count $|A \times B|$ when $A = \{a, b, c, d\}$ and $B$ is the set of even digits

Step 1. Roster B. The even digits are B = \{0, 2, 4, 6, 8\}.

Step 2. Compute sizes.

|A| = 4, \quad |B| = 5

Step 3. Apply the formula.

|A \times B| = 4 \cdot 5 = 20

Why: the grid has |A| = 4 rows and |B| = 5 columns, so it has 4 \times 5 = 20 cells, each one holding a unique ordered pair.

Result. |A \times B| = 20. Sample pairs: (a, 0), (a, 2), (b, 4), (d, 8) — all of the form (letter, even digit).

Subtleties to remember

Related: Set Operations · Relations · Sets — Introduction · Inclusion-Exclusion Calculator · Cardinality Meter