Cartesian Product

The Cartesian product pairs up elements from two sets to form a new one—perfect for mapping relationships and creating coordinates. Think of it as math’s version of matchmaking! 💞

Ordered Pair

An ordered pair is a list (x,y) of two elements x and y, enclosed in parentheses and separated by a comma.

(1,2) (2,1)

However:

(1,2) \neq (2,1)

Cartesian Product

Suppose A and B are sets.

A cartesian product is simply the multiplication of sets denoted as A \times B and defined as

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

A = \{a, b, c\}, \ B = \{1, 2, 3\}

A \ \times \ B = \{ (a,1), (a,2), (a,3), (b,1), (b,2), (b,3), (c,1), (c,2), (c,3) \}

Ordered tripples such as (x,y,z) are also possible.

A = \{a, b\}, \ B = \{1, 2\}, \ C = \{I, II\}

A \ \times \ B \ \times \ C = \{ (a,1,I), (a,1,II), (a,2,I), (a,2,II), (b,1,I), (b,1,II), (b,2,I), (b,2,II) \}

Concept Check 1

What is the cardinality of |A \times B \times C|?

A = \{a, b, c\}, \ B = \{1, 2\}, \ C = \{I, II, III\}

The cardinality of the Cartesian product A \times B \times C is the product of the cardinalities of the individual sets:

|A \times B \times C| = |A| \cdot |B| \cdot |C| = 3 \times 2 \times 3 = 18

Cartesian Power

A cartesian power is also possible for any integer n as

A^n = A \ \times \ A \ \times \ \ldots \ \times \ A = \{ (x_1, x_2, \ldots, x_n):x_1,x_2,\ldots,x_n \in A\}

One famous cartesian power is \mathbb{R}^2, also known as the cartesian plane or a two-dimensional plane.

\mathbb{R} \ \times \ \mathbb{R} = \mathbb{R}^2

\mathbb{R}^3 three-dimensional planes are also possible.

\mathbb{R} \ \times \ \mathbb{R} \ \times \ \mathbb{R} = \mathbb{R}^3

And we can generalize up to n dimensions.

\mathbb{R} \ \times \ \mathbb{R} \ \times \ \ldots \ \times \ \mathbb{R} = \mathbb{R}^n

In Data Science, we often work in high-dimensional spaces—sometimes with thousands or even millions of dimensions. GPT-4, for example, is rumored to have over a trillion \mathbb{R}^{1,000,000,000,000,000}.

Concept Check 2

What are the elements of A \times B?

A = \{1,2,3\}

B = \{1, (2,3) \}

The correct answer is \{ (1,1), (1,(2,3)), (2,1), (2, (2,3)), (3,1), (3,(2,3)) \}. The Cartesian product A \times B consists of all ordered pairs where the first element is from set A and the second element is from set B.