# Basic Definitions

In document Applied Discrete Structures (Page 119-122)

In Chapter 1 we introduced the concept of the Cartesian product of sets. Let’s assume that a person owns three shirts and two pairs of slacks. More precisely, letA={blue shirt,tan shirt,mint green shirt}andB={grey slacks,tan slacks}. ThenA×Bis the set of all six possible combinations of shirts and slacks that the individual could wear. However, an individual may wish to restrict himself or herself to combinations which are color coordinated, or “related.” This may not be all possible pairs inA×Bbut will certainly be a subset ofA×B. For ex-

ample, one such subset may be{(blue shirt,grey slacks),(blue shirt,tan slacks),(mint green shirt,tan slacks)}.

### 6.1.1 Relations between two sets

Definition 6.1.1 Relation. LetAandB be sets. A relation fromAintoB

is any subset ofA×B.

Example 6.1.2 A simple example. Let A = {1,2,3} and B = {4,5}. Then {(1,4),(2,4),(3,5)} is a relation from A into B. Of course, there are many others we could describe; 64, to be exact. □ Example 6.1.3 Divisibility Example. LetA={2,3,5,6}and define a rela- tionrfromAintoAby(a, b)∈rif and only ifadivides evenly intob. The set of pairs that qualify for membership isr={(2,2),(3,3),(5,5),(6,6),(2,6),(3,6)}. □

### 6.1.2 Relations on a Set

Definition 6.1.4 Relation on a Set. A relation from a setA into itself is

called a relation onA.

The relation “divides” in Example 6.1.3will appear throughout the book. Here is a general definition on the whole set of integers.

CHAPTER 6. RELATIONS 106 Definition 6.1.5 Divides. Let a, b Z, a ̸= 0. We say that a divides b, denoteda|b, if and only if there exists an integerksuch thatak=b. ♢ Be very careful in writing about the relation “divides.” The vertical line symbol use for this relation, if written carelessly, can look like division. While a|b is either true or false,a/b is a number.

Based on the equation ak=b, we can say thata|b is equivalent tok= ba, or a divides evenly into b. In fact the “divides” is short for “divides evenly into.” You might find the equationk= b

a initially easier to understand, but in

the long run we will find the equationak=b more convenient.

Sometimes it is helpful to illustrate a relation with a graph. Consider Example 6.1.2. A graph of r can be drawn as in Figure 6.1.6. The arrows indicate that 1 is related to 4 underr. Also, 2 is related to 4 underr, and 3 is related to 5, while the upper arrow denotes thatris a relation from the whole setAinto the set B.

Figure 6.1.6: The graph of a relation

A typical element in a relationris an ordered pair(x, y). In some cases,r can be described by actually listing the pairs which are inr, as in the previous examples. This may not be convenient ifris relatively large. Other notations are used with certain well-known relations. Consider the “less than or equal” relation on the real numbers. We could define it as a set of ordered pairs this way:

={(x, y)|x≤y}

However, the notationx≤yis clear and self-explanatory; it is a more natural, and hence preferred, notation to use than(x, y)∈≤.

Many of the relations we will work with “resemble” the relation, soxsy is a common way to express the fact thatxis related toythrough the relation s.

Relation Notation Letsbe a relation from a setA into a setB. Then the fact that(x, y)∈sis frequently writtenxsy.

### 6.1.3 Composition of Relations

WithA={2,3,5,8},B={4,6,16}, andC={1,4,5,7}, letrbe the relation “divides,” from A into B, and let s be the relation from B into C. So r={(2,4),(2,6),(2,16),(3,6),(8,16)} ands={(4,4),(4,5),(4,7),(6,7)}.

Notice that inFigure 6.1.8that we can, for certain elements ofA, go through elements inB to results inC. That is:

CHAPTER 6. RELATIONS 107 2|4and44 2|4and45 2|4and47 2|6and67 3|6and67 Table 6.1.7

Figure 6.1.8: Relation Composition - a graphical view

Based on this observation, we can define a new relation, call it rs, from A into C. In order for (a, c) to be inrs, it must be possible to travel along a path in Figure 6.1.8 from a to c. In other words, (a, c)∈rs if and only if (∃b)B(arb andbsc). The namerswas chosen because it reminds us that this

new relation was formed by the two previous relationsrands. The complete listing of all elements in rsis {(2,4),(2,5),(2,7),(3,7)}. We summarize in a definition.

Definition 6.1.9 Composition of Relations. Let r be a relation from a setAinto a setB, and letsbe a relation fromBinto a setC. The composition ofr with s, written rs, is the set of pairs of the form (a, c) A×C, where (a, c)∈rsif and only if there existsb∈B such that (a, b)∈rand (b, c)∈s. ♢ Remark: A word of warning to those readers familiar with composition of functions. (For those who are not, disregard this remark. It will be repeated at an appropriate place in the next chapter.) As indicated above, the traditional way of describing a composition of two relations isrswhereris the first relation andsthe second. However, function composition is traditionally expressed in the opposite order: s◦r, where ris the first function andsis the second.

### 6.1.4 Exercises for Section 6.1

1. For each of the following relationsrdefined onP, determine which of the given ordered pairs belong tor

CHAPTER 6. RELATIONS 108 (a) xry iffx|y; (2, 3), (2, 4), (2, 8), (2, 17)

(b) xry iffx≤y; (2, 3), (3, 2), (2, 4), (5, 8) (c) xry iffy=x2; (1,1), (2, 3), (2, 4), (2, 6)

2. The following relations are on {1,3,5}. Let r be the relation xry iff y=x+ 2 andsthe relationxsy iffx≤y.

(a) List all elements in rs. (b) List all elements insr.

(c) Illustrate rsandsrvia a diagram. (d) Is the relationrsequal to the relationsr?

3. LetA={1,2,3,4,5} and definer onAby xry iffx+ 1 =y. We define r2=rr andr3=r2r. Find:

(a) r (b) r2

(c) r3

4. Givensandt, relations onZ,s={(1, n) :n∈Z}andt={(n,1) :n∈Z}, what arestandts? Hint: Even when a relation involves infinite sets, you can often get insights into them by drawing partial graphs.

5. Letρbe the relation on the power set,P(S), of a finite setSof cardinality ndefinedρby(A, B)∈ρiffA∩B=.

(a) Consider the specific case n = 3, and determine the cardinality of the setρ.

(b) What is the cardinality ofρfor an arbitraryn? Express your answer in terms ofn. (Hint: There are three places that each element of S can go in building an element ofρ.)

6. Letr1,r2, andr3 be relations on any setA. Prove that if r1 ⊆r2 then

r1r3⊆r2r3.

In document Applied Discrete Structures (Page 119-122)