Relations and Functions • Topic 1 of 3

Cartesian Product of Sets

An ordered pair $(a, b)$ is a pair of objects in which the order matters: $a$ is the first component and $b$ is the second component. This is the crucial difference from a set — $\{a, b\} = \{b, a\}$, but $(a, b) \ne (b, a)$ unless $a = b$. An ordered pair records not just which two objects appear, but which comes first.

Equality of ordered pairs. Two ordered pairs are equal only when both components match in their respective positions:

$$(a, b) = (c, d) \iff a = c \text{ and } b = d$$

This single rule solves every "find $x$ and $y$" problem in this exercise: equate first component to first, second to second, and solve the two resulting equations.

The Cartesian product. Given two non-empty sets $A$ and $B$, the Cartesian product $A \times B$ (read "$A$ cross $B$") is the set of all ordered pairs whose first component comes from $A$ and second from $B$:

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

You build it by pairing every element of $A$ with every element of $B$ in turn — like filling in a grid with rows labelled by $A$ and columns by $B$. The name honours René Descartes, whose coordinate plane $\mathbb{R} \times \mathbb{R} = \mathbb{R}^2$ is exactly this construction with $A = B = \mathbb{R}$.

The counting rule. Because each of the $n(A)$ first components can be paired with each of the $n(B)$ second components, the total number of ordered pairs is the product:

$$n(A \times B) = n(A) \cdot n(B)$$

This is the fundamental counting principle in disguise, and it extends to any number of sets. In particular $n(A \times A) = \big(n(A)\big)^2$ and $n(A \times A \times A) = \big(n(A)\big)^3$.

Products of a set with itself. Two short-hands appear constantly. $A \times A$ (also written $A^2$) is the set of all ordered pairs from $A$; and $A \times A \times A$ (or $A^3$) is the set of all ordered triples $(a, b, c)$ with each component in $A$. An ordered triple obeys the same position-matters rule: $(a, b, c) = (d, e, f)$ only when $a=d$, $b=e$ and $c=f$.

Product with the empty set. By convention, if either set is empty there are no pairs to form, so:

$$A \times \varnothing = \varnothing \times A = \varnothing$$

Non-commutativity. Unlike union and intersection, the Cartesian product is not commutative: in general $A \times B \ne B \times A$. The pair $(1, a)$ from $A \times B$ is a different object from $(a, 1)$ in $B \times A$. The two products are equal only in the special cases $A = B$, or when one of the sets is empty. Note the counts always agree — $n(A \times B) = n(B \times A)$ — but equal cardinality does not mean equal sets.

PropertyStatement
Definition$A \times B = \{(a,b) : a \in A,\ b \in B\}$
Count$n(A \times B) = n(A)\,n(B)$
Self-product$n(A \times A) = n(A)^2$,   $n(A^3) = n(A)^3$
Empty set$A \times \varnothing = \varnothing$
Commutativity$A \times B \ne B \times A$ in general

Deeper Insight — the ordered pair is what makes coordinates, relations and functions possible: Everything in this whole chapter — and a great deal of the rest of mathematics — is built on the humble ordered pair. The reason "order matters" is not a technicality: it is precisely what lets $(3, 5)$ name a single point on the plane distinct from $(5, 3)$, what lets a relation record "$x$ is related to $y$" as a directed link rather than a symmetric one, and what lets a function send each input to exactly one output. The Cartesian product is simply the universe of all possible pairings; a relation, which you meet next, is just a chosen sub-collection of that universe. Once you see $A \times B$ as the full grid of possibilities, a relation becomes "the cells you tick" and a function becomes "exactly one ticked cell per row" — and the entire chapter clicks into place.

Cartesian product A times B as a grid of ordered pairs A × B with A = {1, 2}, B = {x, y, z} BA 12zyx (1,z)(1,y)(1,x)(2,z)(2,y)(2,x) 6 pairs2 × 3
1
Worked Example
If $A = \{1, 2\}$ and $B = \{a, b, c\}$, write $A \times B$ and state $n(A \times B)$.
Solution
  1. Pair each element of $A$ with every element of $B$.
  2. From $1$: $(1,a), (1,b), (1,c)$. From $2$: $(2,a), (2,b), (2,c)$.
  3. Count: $n(A) \cdot n(B) = 2 \times 3 = 6$.

Answer: $A \times B = \{(1,a),(1,b),(1,c),(2,a),(2,b),(2,c)\}$ with $n(A \times B) = 6$.

2
Worked Example
If $(x + 1, y - 2) = (3, 1)$, find $x$ and $y$.
Solution
  1. Equal ordered pairs match component by component.
  2. First: $x + 1 = 3 \Rightarrow x = 2$.
  3. Second: $y - 2 = 1 \Rightarrow y = 3$.

Answer: $x = 2$ and $y = 3$.

3
Worked Example
If $n(A) = 3$ and $n(B) = 4$, how many elements are in $A \times B$, and how many in $A \times A$?
Solution
  1. $n(A \times B) = n(A) \cdot n(B) = 3 \times 4 = 12$.
  2. $n(A \times A) = n(A)^2 = 3^2 = 9$.

Answer: $n(A \times B) = 12$ and $n(A \times A) = 9$.

4
Worked Example
If $A \times B = \{(p, q), (p, r), (m, q), (m, r)\}$, find $A$ and $B$.
Solution
  1. First components form $A$: $\{p, m\}$.
  2. Second components form $B$: $\{q, r\}$.
  3. Check: $n(A) \cdot n(B) = 2 \times 2 = 4$, matching the four pairs.

Answer: $A = \{p, m\}$ and $B = \{q, r\}$.

5
Worked Example
Let $A = \{1, 2\}$. Is $(1, 2) \in A \times A$? Is $(1, 3) \in A \times A$?
Solution
  1. $A \times A = \{(1,1),(1,2),(2,1),(2,2)\}$.
  2. $(1,2)$ has both components in $A$ → it belongs.
  3. $(1,3)$ has $3 \notin A$ → it does not belong.

Answer: $(1,2) \in A \times A$ is true; $(1,3) \in A \times A$ is false.

6
Worked Example
If $A = \{-1, 1\}$, find $A \times A \times A$ and state how many ordered triples it contains.
Solution
  1. $n(A^3) = n(A)^3 = 2^3 = 8$ triples.
  2. List every $(\pm 1, \pm 1, \pm 1)$ combination.

Answer: $A \times A \times A = \{(-1,-1,-1),(-1,-1,1),(-1,1,-1),(-1,1,1),(1,-1,-1),(1,-1,1),(1,1,-1),(1,1,1)\}$, which has $8$ ordered triples.

7
Worked Example
If $A = \{1, 2\}$ and $B = \{3, 4\}$, write both $A \times B$ and $B \times A$, and show they are not equal.
Solution
  1. $A \times B = \{(1,3),(1,4),(2,3),(2,4)\}$.
  2. $B \times A = \{(3,1),(3,2),(4,1),(4,2)\}$.
  3. Both have $4$ pairs, but $(1,3) \in A \times B$ while $(1,3) \notin B \times A$.

Answer: $A \times B \ne B \times A$ — the products have the same size but no common element, showing the Cartesian product is not commutative.

8
Worked Example
If $A = \{x : x \in \mathbb{N},\ x < 4\}$ and $B = \varnothing$, find $A \times B$ and $n(A \times B)$.
Solution
  1. $A = \{1, 2, 3\}$ but $B$ has no elements.
  2. An ordered pair needs a second component from $B$; there is none.
  3. By convention $A \times \varnothing = \varnothing$.

Answer: $A \times B = \varnothing$ and $n(A \times B) = 0$.

9
Worked Example
If $A = \{1, 2, 3\}$ and $B = \{3, 4\}$, find $(A \cap B) \times A$.
Solution
  1. First compute the intersection: $A \cap B = \{3\}$.
  2. Cross it with $A = \{1,2,3\}$: pair $3$ with each element of $A$.
  3. $\{3\} \times A = \{(3,1),(3,2),(3,3)\}$.

Answer: $(A \cap B) \times A = \{(3,1),(3,2),(3,3)\}$.

10
Worked Example
If $n(A \times B) = 15$ and $A = \{a, b, c\}$, find $n(B)$ and the number of elements in $A \times A$.
Solution
  1. $n(A) = 3$ and $n(A \times B) = n(A)\,n(B)$.
  2. $15 = 3 \cdot n(B) \Rightarrow n(B) = 5$.
  3. $n(A \times A) = n(A)^2 = 3^2 = 9$.

Answer: $n(B) = 5$ and $n(A \times A) = 9$.

11
Worked Example
If $(2a - 3, b + 1) = (5, 4)$, find the values of $a$ and $b$.
Solution
  1. Match first components: $2a - 3 = 5 \Rightarrow 2a = 8 \Rightarrow a = 4$.
  2. Match second components: $b + 1 = 4 \Rightarrow b = 3$.

Answer: $a = 4$ and $b = 3$.

Key Points

  • An ordered pair $(a, b)$ has a fixed first and second component; $(a, b) \ne (b, a)$ unless $a = b$.
  • Ordered pairs are equal iff both components match: $(a,b) = (c,d) \iff a = c \text{ and } b = d$.
  • The Cartesian product $A \times B = \{(a,b) : a \in A,\ b \in B\}$ pairs every element of $A$ with every element of $B$.
  • Counting rule: $n(A \times B) = n(A) \cdot n(B)$; hence $n(A \times A) = n(A)^2$ and $n(A^3) = n(A)^3$.
  • $A \times A$ holds all ordered pairs and $A \times A \times A$ all ordered triples from $A$.
  • Product with the empty set is empty: $A \times \varnothing = \varnothing \times A = \varnothing$.
  • The product is not commutative: $A \times B \ne B \times A$ in general (though their sizes are equal).
  • A relation and a function are both built as special subsets of a Cartesian product.
Tap an option to check your answer0 / 4
Q1.If $A=\{1,2\}$ and $B=\{3\}$, then $A\times B=$
Explanation: $A\times B$ pairs each element of $A$ with each of $B$.
Q2.If $n(A)=3$ and $n(B)=4$, then $n(A\times B)=$
Explanation: $n(A\times B)=n(A)\cdot n(B)=12$.
Q3.$(a,b)=(c,d)$ if and only if:
Explanation: Ordered pairs are equal iff matching components are equal.
Q4.$A\times B=B\times A$ holds when:
Explanation: Cartesian product is not commutative unless $A=B$ (or one is empty).