Physical Address

304 North Cardinal St.
Dorchester Center, MA 02124

Ordered Pairs and Set Products

Relations and functions are used throughout all of mathematics. Examples of functions abound in subjects such as algebra, trigonometry, calculus, as well as computer science, physics, chemistry, biology, and economics.

Just as we saw how sets can be built out of using propositional logic, we’ll see how relations and functions are built up using sets, a clear example of how multiple seemingly disparate concepts can be accumulated into a cohesive whole. But before we delve into what relations and functions are exactly, there is one more set operation we should get a handle on: that of a set product. Ironically, even though order doesn’t matter when considering elements in a set, constructing a set product does require that we know in what order we are doing things.

Ordered Pairs

When we were discussing sets, we noted that order and repetition did not matter. All that mattered was whether or not an element was included in the set, or not included in the set. But what if we do care about the order in which elements are included. In such a case, we list the elements between parenthesis () instead of curly braces {}.

Ordered Pair

Let 𝒰 be a universe from which elements can be chosen.

An ordered pair is an ordered collection of two items a and b from universe 𝒰, and is normally written using parenthesis as in

(a, b)

where item a is the first item in the pair, and b is the second item.

Note that order is relevant in an ordered pair (hence the name.) Compare this with a set containing two elements. Because order is irrelevant, the two sets

{a, b}{b, a}

represent the same set, and we can write {a, b} = {b, a}.

However, since order does matter in an ordered pair, the two ordered pairs

(a, b)(b, a)

are not the same ordered pair, and so we would write (a, b) ≠ (b, a). In the first ordered pair, we specifically set a to be the first element, whereas in the second ordered pair, we set b to be the first element.

Equal

Two ordered pairs (a, b) and (c, d) are called equal, and we write

(a, b) = (c, d)

if (and only if) a = c and b = d.

In order for the ordered pairs

(a, b)(b, a)

to be equal then, we would need a = b.

Example 4.1.1

Consider a universal set consisting of all the integers

N = {0, 1, -1, 2, -2, 3, -3, …}.

The following are all examples of ordered pairs:

(1, -1)(0, 12)(12, 0)
(5, 12)(3, 4)(-11, -13)
(-10, 100)(0, 12)(0, -9)

Let’s refer to the upper-middle ordered pair (0, 12) as (a, b). We then have

a = 0 and b = 12.

Furthermore, let’s refer to the lower-middle ordered pair (0, 12) as (c, d), then

c = 0 and d = 12.

Based on the above definition of equal, since we have that

a=c=0
b=d=12

We have that (0, 12) = (0, 12). This might be obvious, but we also wanted to demonstrate using the actual definition, by comparing each element in order for equality.

Now let’s compare the ordered pairs (0, 12) and (0, -9). First, let’s use (a, b) and (c, d) to refer to these ordered pairs as

(0, 12)=(a, b)
(0, -9)=(c, d)

We have that

a = c = 0

but

b = 12 and d = -9.

Since 12 ≠ -9, we also have that b ≠ d. And since b ≠ d, we have that

(0, 12) ≠ (0, -9).

For similar reasons, we also have that

(0, 12) ≠ (12, 0).

Naturally, we aren’t limited to two elements. We can collect and order as many elements as we want.

n-Tuple, Equal

Let 𝒰 be a universe from which elements can be chosen.

An n-tuple is an ordered list of n elements taken from 𝒰 and is normally written using parenthesis as

(a1, a2, …, an)

where a1, a2, …, an ∈ 𝒰.

Two n-tuples (a1, a2, …, an) and (b1, b2, …, bm) are called equal when they have the same number of elements (n = m) and their corresponding elements are equal; that is to say, we have that

(a1, a2, …, an) = (b1, b2, …, bm)

if (and only if)

a1 = b1a2 = b2an = bm

It is common to refer to n-tuples with only two elements as tuples (in addition to ordered pairs), n-tuples with three elements as triples (or ordered triples.)

Example 4.1.2

None of the following n-tuples are equal to each other:

(1, 2, 3)(2, 1, 3)(3, 1, 2)
(1, 3, 2)(2, 3, 1)(3, 2, 1)

However, all of the following sets are equal to each other:

{1, 2, 3}{2, 1, 3}{3, 1, 2}
{1, 3, 2}{2, 3, 1}{3, 2, 1}

The following n-tuples are not equal:

(1, 2, 3)(1, 1, 2, 3)

Even though the elements are the same, and the 1s appear before the 2, which appears before the 3, there are a different number of 1s. The first n-tuple has only one 1, whereas the second n-tuple has two 1s. Remember, since order matters, repetition will also matter, and the order in which repeated elements appear also matters.

Remember, equality of n-tuples depends on having the same number of elements, and having equal corresponding elements.

Set Products

All of the set operations we’ve seen so far simply take some combination of elements from two given sets, and form a conglomerate new set. The same will be true of set products, but here, we iterate over all elements in both sets, and combine them in ordered pairs.

Set Product, Cartesian Product

Let A and B be given sets.

The Set Product, or Cartesian Product of A and B, denoted

A ✕ B

is the set

A ✕ B = { (a, b) | a ∈ A ∧ b ∈ B }.

Note that A and B do not need to be subsets from the same universe.

Basically, for each element in set A, we iterate over the elements in B, and form ordered pairs where the element from A is the first item in the pair, and the element from B is the second item in the pair. The term Cartesian Product is most commonly used to describe this operation, and as such will be the preferred term used throughout this book.

We can organize the construction of the Cartesian Product in a table like so:

A ✕ B
b1 b2bm
a1(a1, b1)(a1, b2)(a1, bm)
a2(a2, b1)(a2, b2)(a2, bm)
an(an, b1)(an, b2)(an, bm)

Remember that since we’re forming ordered pairs, the order in which we list the sets is also important.

Order Matters in Cartesian Products

In general, we have that

A ✕ B ≠ B ✕ A

Notice that the definition of Cartesian Product states that A and B do not need to come from the same universe, so we could have that A ⊆ 𝒰1 and B ⊆ 𝒰2. Even if they come from different universal sets, we can still simply stick anything we want in an ordered pair.

Example 4.1.3

Suppose we have

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

where a, b, and c are not variables, but simply the first, second, and third letters of the English alphabet. Then we have that

A ✕ B = { (1, a), (1, b), (1, c), (2, a), (2, b), (2, c) }.

Furthermore, we have that

B ✕ A = { (a, 1), (a, 2), (b, 1), (b, 2), (c, 1), (c, 2) }.

Often times, we may want to stylize how we write out the sets in order to make them easier to visually parse through. As such, we can rewrite both Cartesian Products like so:

A ✕ B={(1, a),(1, b),(1, c),
(2, a),(2, b),(2, c)}
B ✕ A={(a, 1),(a, 2),
(b, 1),(b, 2),
(c, 1),(c, 2)}

We are not limited to two sets.

Multiple Cartesian Product

Let A1, A2, … An be sets, not all necessarily taken from the same universe, and not all necessarily with same cardinality.

The Multiple Cartesian Product

A1 ✕ A2 ✕ … ✕ An

is the set

A1 ✕ A2 ✕ … ✕ An = { (a1, a2, …, an) | a1 ∈ A1 ∧ a2 ∈ A2 ∧ … an ∈ An }.

Oftentimes, this is simply referred to as a Cartesian Product instead of a Multiple Cartesian Product.

Example 4.1.4

Consider the following sets:

A = {1, 2}B = {a, b}C = {α, β}

Then we have that

A ✕ B ✕ C = { (1, a, α), (1, a, β), (1, b, α), (1, b, β), (2, a, α), (2, a, β), (2, b, α), (2, b, β) }

We can also form a Cartesian Product with only one set.

Example 4.1.5

Consider the set

Z = {1, a, α}.

Then we have that

Z ✕ Z = { (1, 1), (1, a), (1, α), (a, 1), (a, a), (a, α), (α, 1), (α, a), (α, α) }

Suppose A is a set. The notation

An

is shorthand for the Cartesian Product

A ✕ A ✕ … ✕ A

where A is repeated n times.

Figure 4.1.1: Just like an exponent on a number represents repeated multiplication, an exponent on a set represents a repeated Cartesian Product.

We can take a Cartesian Product of a set with itself multiple times as well.

Example 4.1.6

Consider the set

A = {1, a}.

We have that

A3=A ✕ A ✕ A={(1, 1, 1), (1, 1, a), (1, a, 1), (1, a, a), (a, 1, 1), (a, 1, a), (a, a, 1), (a, a, a)}

Associativity in Cartesian Products

We already discussed how order matters in Cartesian Products, and as such sets don’t commute around the Cartesian Product operator ✕. Associativity is another common property we could examine. What exactly is the difference between

(A ✕ B) ✕ CA ✕ B ✕ CA ✕ (B ✕ C)

if any such differences exist?

Remember that parenthesis are used to indicate which operations are to be performed first.

Example 4.1.7

Reconsider the sets

A = {1, 2}B = {a, b}C = {α, β}

From Example 4.1.4, we know that

A ✕ B ✕ C = { (1, a, α), (1, a, β), (1, b, α), (1, b, β), (2, a, α), (2, a, β), (2, b, α), (2, b, β) }.

To evaluate (A ✕ B) ✕ C, let’s compute A ✕ B first, since it is the part in parenthesis:

A ✕ B = { (1, a), (1, b), (2, a), (2, b) }.

Now, to compute (A ✕ B) ✕ C, recognize that it is the same as computing { (1, a), (1, b), (2, a), (2, b) } ✕ {α, β}:

(A ✕ B) ✕ C={ (1, a), (1, b), (2, a), (2, b) } ✕ {α, β}
={ ( (1, a), α), ( (1, a), β), ( (1, b), α), ( (1, b), β), ( (2, a), α), ( (2, a), β), ( (2, b), α), ( (2, b), β) }

Notice that each ordered pair in the set (A ✕ B) ✕ C contains an ordered pair as an element. Just as sets can contain other sets as elements, ordered pairs can contain other ordered pairs as elements as well. Let’s rewrite the set (A ✕ B) ✕ C to make the elements even more obvious:

{((1, a),α)
((1, a),β)
((1, b),α)
((1, b),β)
((2, a),α)
((2, a),β)
((2, b),α)
((2, b),β)}

Going further, we can even construct sets that contain ordered pairs as elements, and we can construct ordered pairs that contain sets as elements.

Of course, the same idea applies when computing A ✕ (B ✕ C):

A ✕ (B ✕ C)={1, 2} ✕ { (a, α), (a, β), (b, α), (b, β) }
={ (1, (a, α)), (1, (a, β)), (1, (b, α)), (1, (b, β)), (2, (a, α)), (2, (a, β)), (2, (b, α)), (2, (b, β)) }

There are some clear similarities between A ✕ B ✕ C, (A ✕ B) ✕ C, and A ✕ (B ✕ C). One similarity is that if removed the inner parenthesis, all of these sets would be equal to each other. Of course when parenthesized, the inner ordered pair may be the first or second element within the outer ordered pairs.

Another difference worth pointing out is that A ✕ B ✕ C is a set of ordered triples. The sets (A ✕ B) ✕ C and A ✕ (B ✕ C) are sets of ordered pairs.

Association Matters in Cartesian Products

The Cartesian Products

(A ✕ B) ✕ CA ✕ B ✕ CA ✕ (B ✕ C)

are not equal to one another.

It should then come as no surprise that

Am ✕ An ≠ Am+n.

Instead, Am ✕ An is simply shorthand for

(A ✕ A ✕ … ✕ A) ✕ (A ✕ A ✕ … ✕ A)

where there are m copies of A in the left parenthesis and n copies of A in the right parenthesis.

Let’s finish this section with one more example.

Example 4.1.8

Suppose we had the sets

Ψ = { {1, 2}, (3, 4) }Ω = { {a, b}, (c, d) }

One way we could compute this Cartesian Product is to tabulate everything:

Ψ ✕ Ω
{a, b}(c, d)
{1, 2}( {1, 2}, {a, b} )( {1, 2}, (c, d) )
(3, 4)( (3, 4), {a, b} )( (3, 4), (c, d) )

So then we have that

Ψ ✕ Ω = { ( {1, 2}, {a, b} ), ( {1, 2}, (c, d) ), ( (3, 4), {a, b} ), ( (3, 4), (c, d) ) }.

It can be a little confusing to deal with all of the parenthesis () and braces {}. Another way to compute the above Cartesian Product is to replace each of {1, 2}, (3, 4), {a, b}, (c, d) with some symbol of our choosing. We can create any arbitrary symbol using our imagination, or use existing symbols, but we must remain consistent. Let’s use the following symbols simply for the sake of variety:

={1, 2}
=(3, 4)
={a, b}
=(c, d)

Now we can simply use those simpler symbols in place of the sets and ordered pairs originally used:

Ψ ✕ Ω={ ★, ✦ } ✕ { ♫, ♥ }
={ (★, ♫), (★, ♥), (✦, ♫), (✦, ♥) }

Even though it would be technically correct to leave the above answer as is (because it is known what ★, ✦, ♫, ♥ represent), it’s good etiquette to replace all of those symbols with their original counterparts:

{(,)
(,)
(,)
(,)}

=

{({1, 2},{a, b})
({1, 2},)
((3, 4),{a, b})
((3, 4),(c, d))}

Either way, we get the set

Ψ ✕ Ω = { ( {1, 2}, {a, b} ), ( {1, 2}, (c, d) ), ( (3, 4), {a, b} ), ( (3, 4), (c, d) ) }.