Skip to content

Cartesian Products: All Ordered Pairs

Textbook

The Cartesian product $C\times D$ is the set of ordered pairs $(c,d)$ with $c\in C$ and $d\in D$. Ordered means that $(c,d)=(c',d')$ exactly when $c=c'$ and $d=d'$. The two positions play different roles.

For $C=\{1,2\}$ and $D=\{3\}$, the product is $\{(1,3),(2,3)\}$. For finite sets, $|C\times D|=|C||D|$: each first element can be paired with every second element. If either factor is empty, there are no pairs. The notation $\mathbb R^d$ generalizes this construction to ordered tuples of $d$ real coordinates.

Membership of a pair requires two conditions simultaneously: the first coordinate belongs to $C$ and the second to $D$. One qualifying coordinate is insufficient. Reversing the factors changes the roles of the positions; the pair counts can agree while the resulting sets differ. The cardinality formula requires both factors to be finite and counts pairs, rather than the separate objects used to build them.

Definitions and further reading: Mathematics for Computer Science.

In plain language

A Cartesian product resembles every combination of T-shirt sizes and colors. Each pair records size first and color second; exchanging the fields changes its meaning. The full product includes every combination, although a real warehouse may stock only some of them. An order form can be more optimistic than a shelf, but the mathematical construction promises no inventory.

Example

The original illustrative sets are $C=\{1,2\}$ and $D=\{3\}$. Each element of the first set is paired with every element of the second.

Cartesian Products: All Ordered Pairs

Input sets

The first position comes from C and the second from D.

Step 1 of 3: Input sets

Read all steps
  1. Input sets

    The first position comes from C and the second from D.

    State
    C: 1, 2currentD: 3current
  2. First pair

    The first element of C pairs with the only element of D.

    State
    (1,3)current
  3. Complete result

    The second element of C creates one more pair.

    State
    (1,3)current(2,3)current

In the first step, 3 is allowed only in the second position. Pair (3,1) therefore does not belong to this product even though both numbers occur in the original sets. The resulting pairs (1,3) and (2,3) differ in their first coordinate and count separately. Their number, $2\cdot1=2$, agrees with enumeration. Counting helps detect omissions but does not replace checking each pair’s coordinate roles.

Related concepts: Coordinate vectors.

The original text of this free article is published under CC BY-NC-ND 4.0.

Previous / next

Previous
Decomposing a union into disjoint parts
Next
Real Intervals: Are the Endpoints Included?
  • Set membership

    What membership states, why order and repetition do not change a set, and how an empty set differs from a set containing it.

    Read article
    Set Theory
  • Set equality

    How to prove set equality element by element or through two inclusions, and why equal size is not enough.

    Read article
    Set Theory
  • Set inclusion

    How to check that every element of one set is in another, and why inclusion differs from membership.

    Read article
    Set Theory