When order mat­ters

A point on a graph, a seat marked "row, col­umn" in a cin­ema hall: in both, the order of the two entries mat­ters, and (2,5)(2, 5) is not the same as (5,2)(5, 2). Pairs like these build the Carte­sian prod­uct of two sets, and a rela­tion turns out to be noth­ing more than a col­lec­tion of such pairs. We will define ordered pairs and Carte­sian prod­ucts, count them, and then describe rela­tions in ros­ter form, set-builder form and arrow dia­grams, along with their domain, codomain and range. All of this is the ground­work for func­tions in the next les­son.

Ordered pairs and Carte­sian prod­ucts

Two ordered pairs are equal only when they match entry by entry: (a,b)=(c,d)(a, b) = (c, d) exactly when a=ca = c and b=db = d. So (x−2,y+3)=(4,−1)(x - 2, y + 3) = (4, -1) gives x=6x = 6 and y=−4y = -4.

The Carte­sian prod­uct col­lects every pos­si­ble pair: A×B={(a,b):a∈A,b∈B}A \times B = \{(a, b) : a \in A, b \in B\}. For A={1,2}A = \{1, 2\} and B={x,y,z}B = \{x, y, z\}:

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

Every ele­ment of the first set pairs with every ele­ment of the sec­ond, so n(A×B)=n(A)⋅n(B)n(A \times B) = n(A) \cdot n(B). Watch the order, though: A×B≠B×AA \times B \ne B \times A unless A=BA = B (or one of them is empty). You have been using a Carte­sian prod­uct for years with­out the name: R×R\mathbf{R} \times \mathbf{R} is the coor­di­nate plane, and R×R×R\mathbf{R} \times \mathbf{R} \times \mathbf{R} is space.

Grid of six points with A = {1, 2} along the horizontal axis and B = {x, y, z} up the vertical axis, each point labelled with its ordered pair from (1, x) to (2, z).
The six ordered pairs of A x B drawn as a grid

Exam­ple 1. A={1,2}A = \{1, 2\}: A×A×AA \times A \times A has 88 triples, (1,1,1),(1,1,2),…,(2,2,2)(1, 1, 1), (1, 1, 2), \ldots, (2, 2, 2).

Exam­ple 2. If A×B={(p,1),(p,2),(q,1),(q,2)}A \times B = \{(p, 1), (p, 2), (q, 1), (q, 2)\} then A={p,q}A = \{p, q\}, B={1,2}B = \{1, 2\}.

Exam­ple 3. A×(B∩C)=(A×B)∩(A×C)A \times (B \cap C) = (A \times B) \cap (A \times C): with A={1}A = \{1\}, B={2,3}B = \{2, 3\}, C={3,4}C = \{3, 4\}, both sides are {(1,3)}\{(1, 3)\}.

Rela­tions

Out of all the pos­si­ble pairs, a rule usu­ally picks out only some. That selec­tion is a rela­tion: a rela­tion from AA to BB is any sub­set RR of A×BA \times B. We write (a,b)∈R(a, b) \in R or a R ba \, R \, b, and call bb the image of aa.

  • Domain: the set of first ele­ments of pairs in RR.
  • Codomain: the whole of BB.
  • Range: the set of sec­ond ele­ments actu­ally used, which is a sub­set of the codomain.

Exam­ple 4. Take A={1,2,3,4,5,6}A = \{1, 2, 3, 4, 5, 6\} and the rela­tion R={(a,b):b=a+2}R = \{(a, b) : b = a + 2\} on AA. Then R={(1,3),(2,4),(3,5),(4,6)}R = \{(1, 3), (2, 4), (3, 5), (4, 6)\}, with domain {1,2,3,4}\{1, 2, 3, 4\}, range {3,4,5,6}\{3, 4, 5, 6\} and codomain AA. Notice that the two largest ele­ments have no image, since adding two takes them out­side the set.

An arrow dia­gram shows a rela­tion at a glance: draw AA and BB as ovals and join each aa to its images.

Arrow diagram with two ovals each holding 1 to 6; arrows join 1 to 3, 2 to 4, 3 to 5 and 4 to 6, showing the relation b = a + 2 on A.
Arrow dia­gram of the rela­tion b = a + 2 in Exam­ple 4

Count­ing rela­tions. The same in-or-out argu­ment you used for sub­sets works here. A×BA \times B has n(A) n(B)n(A) \, n(B) pairs, and each one is either in the rela­tion or out, so there are 2n(A)n(B)2^{n(A) n(B)} rela­tions from AA to BB. With n(A)=2n(A) = 2 and n(B)=3n(B) = 3, that is already 26=642^6 = 64.

Prac­tice ques­tions

  1. Find xx and yy: (2x+1,y−3)=(7,5)(2x + 1, y - 3) = (7, 5); (x3+1,y−23)=(53,13)\displaystyle (\tfrac{x}{3} + 1, y - \tfrac{2}{3}) = (\tfrac{5}{3}, \tfrac{1}{3}).
  2. A={−1,1}A = \{-1, 1\}, B={0,2,4}B = \{0, 2, 4\}. Write A×BA \times B and B×AB \times A. Are they equal?
  3. AA has 44 ele­ments and BB has 33. How many ele­ments in A×BA \times B? How many rela­tions from AA to BB?
  4. A×AA \times A has 99 ele­ments, two of which are (2,5)(2, 5) and (5,7)(5, 7). Find AA and the remain­ing ele­ments.
  5. A={1,2}A = \{1, 2\}, B={1,2,3,4}B = \{1, 2, 3, 4\}, C={5,6}C = \{5, 6\}, D={5,6,7,8}D = \{5, 6, 7, 8\}. Ver­ify A×C⊂B×DA \times C \subset B \times D.
  6. On A={1,2,3,…,12}A = \{1, 2, 3, \ldots, 12\} define R={(a,b):b=2a−1}R = \{(a, b) : b = 2a - 1\}. Write RR in ros­ter form; find its domain and range.
  7. R={(x,x3):x a prime less than 8}R = \{(x, x^3) : x \text{ a prime less than } 8\}. Write RR and its range.
  8. From an arrow dia­gram with 1→41 \to 4, 2→52 \to 5, 3→43 \to 4, 3→63 \to 6: write RR, domain and range.
  9. On Z\mathbf{Z}, R={(a,b):a−b is a multiple of 3}R = \{(a, b) : a - b \text{ is a multiple of } 3\}. Is (7,1)∈R(7, 1) \in R? (5,−1)(5, -1)? (2,6)(2, 6)?
  10. True or false: if (a,b)∈A×B(a, b) \in A \times B and (b,c)∈B×C(b, c) \in B \times C then (a,c)∈A×C(a, c) \in A \times C.

Answers

Show answers
  1. x=3x = 3, y=8y = 8; x=2x = 2, y=1y = 1.
  2. {(−1,0),(−1,2),(−1,4),(1,0),(1,2),(1,4)}\{(-1, 0), (-1, 2), (-1, 4), (1, 0), (1, 2), (1, 4)\}; {(0,−1),(0,1),(2,−1),…}\{(0, -1), (0, 1), (2, -1), \ldots\}; no.
  3. 1212; 212=40962^{12} = 4096.
  4. A={2,5,7}A = \{2, 5, 7\}; remain­ing: (2,2),(2,7),(5,2),(5,5),(7,2),(7,5),(7,7)(2, 2), (2, 7), (5, 2), (5, 5), (7, 2), (7, 5), (7, 7).
  5. Every pair of A×CA \times C has its first ele­ment in A⊂BA \subset B and its sec­ond in C⊂DC \subset D.
  6. {(1,1),(2,3),(3,5),(4,7),(5,9),(6,11)}\{(1, 1), (2, 3), (3, 5), (4, 7), (5, 9), (6, 11)\}; domain {1,…,6}\{1, \ldots, 6\}; range {1,3,5,7,9,11}\{1, 3, 5, 7, 9, 11\}.
  7. {(2,8),(3,27),(5,125),(7,343)}\{(2, 8), (3, 27), (5, 125), (7, 343)\}; range {8,27,125,343}\{8, 27, 125, 343\}.
  8. {(1,4),(2,5),(3,4),(3,6)}\{(1, 4), (2, 5), (3, 4), (3, 6)\}; {1,2,3}\{1, 2, 3\}; {4,5,6}\{4, 5, 6\}.
  9. Yes (66); yes (66); no (−4-4).
  10. True.