Mathwords logoMathwords

Cartesian Product — Definition, Formula & Example

The Cartesian product of two sets is the set of every ordered pair you can form by taking the first entry from the first set and the second entry from the second set. It is also called the product set. If one set has 3 elements and the other has 2, you get 6 pairs.

For sets AA and BB, the Cartesian product is A×B={(a,b)∣a∈A and b∈B}A \times B = \{(a, b) \mid a \in A \text{ and } b \in B\}. Here (a,b)=(c,d)(a, b) = (c, d) if and only if a=ca = c and b=db = d. The definition extends to nn sets: A1×⋯×AnA_1 \times \cdots \times A_n is the set of ordered nn-tuples (a1,…,an)(a_1, \ldots, a_n) with each ai∈Aia_i \in A_i. If either factor is empty, then A×∅=∅×A=∅A \times \varnothing = \varnothing \times A = \varnothing.

Key Formula

∣A×B∣=∣A∣⋅∣B∣|A \times B| = |A| \cdot |B|
Where:
  • ∣A∣|A| = Number of elements in the finite set A
  • ∣B∣|B| = Number of elements in the finite set B
  • ∣A×B∣|A \times B| = Number of ordered pairs in the Cartesian product

Worked Example

Problem: Let A={1,2,3}A = \{1, 2, 3\} and B={a,b}B = \{a, b\}. List the elements of A×BA \times B, count them, and decide whether A×B=B×AA \times B = B \times A.
Step 1: Pair each element of A with each element of B. The element from A always goes first.
A×B={(1,a),(1,b),(2,a),(2,b),(3,a),(3,b)}A \times B = \{(1,a),(1,b),(2,a),(2,b),(3,a),(3,b)\}
Step 2: Count the pairs with the size rule. A has 3 elements and B has 2.
∣A×B∣=∣A∣⋅∣B∣=3⋅2=6|A \times B| = |A| \cdot |B| = 3 \cdot 2 = 6
Step 3: Build B × A by putting the element of B first. It also has 6 pairs, but the pairs are different. For example, (1,a)(1, a) is in A×BA \times B, while (a,1)(a, 1) is in B×AB \times A.
B×A={(a,1),(a,2),(a,3),(b,1),(b,2),(b,3)}B \times A = \{(a,1),(a,2),(a,3),(b,1),(b,2),(b,3)\}
Answer: A×BA \times B has 6 ordered pairs. A×B≠B×AA \times B \neq B \times A, even though both sets have 6 elements.

Why It Matters

The coordinate plane is the Cartesian product R×R=R2\mathbb{R} \times \mathbb{R} = \mathbb{R}^2, so every point (x,y)(x, y) is one of its elements. In a discrete math or intro proofs course, a relation from AA to BB is usually defined as a subset of A×BA \times B, and a function as a relation that pairs each element of AA with exactly one element of BB. In probability, the sample space for rolling two dice is {1,…,6}×{1,…,6}\{1,\ldots,6\} \times \{1,\ldots,6\}, which has 36 outcomes.

Common Mistakes

Mistake: Assuming A×B=B×AA \times B = B \times A because both sets always have the same number of elements.
Correction: The entries are ordered pairs, so (1,a)≠(a,1)(1, a) \neq (a, 1). The two products are equal only when A=BA = B or when at least one of the sets is empty. Equal size does not mean the sets are equal.

Related Terms

  • Cartesian Coordinates — Number tuples locating points, built as product of axes
  • Cardinality — Measures size; the size of A × B is |A|·|B|
  • Element of a Set — Each pair takes one element from each factor
  • Empty Set — Any product with an empty factor is empty
  • Intersection — (A×B)∩(C×D) equals (A∩C)×(B∩D)
  • Countably Infinite — ℕ × ℕ is a classic countably infinite set
  • Finite — A product of finite sets is always finite
  • Ordered Pair — The (a, b) pairs that make up the product
  • Relation — A relation from A to B is a subset of A × B
  • Function — A function is a relation giving each input one output