Chapter 6 PDF
Chapter 6 PDF
GOALS
One understands a set of objects completely only if the structure of that set is made clear by the interrelationships between its elements. For
example, the individuals in a crowd can be compared by height, by age, or through any number of other criteria. In mathematics, such compar-
isons are called relations. The goal of this chapter is to develop the language, tools, and concepts of relations.
More precisely, let A = 8blue shirt, tan shirt, mint green shirt< and B = 8grey slacks, tan slacks<. Then certainly A × B is the set of all possible
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.
combinations (six) of shirts and slacks that the individual can wear. However, the individual may wish to restrict himself or herself to combina-
one such subset may be 8Hblue shirt, grey slacksL, Hblue shirt, tan slacksL, Hmint green shirt, tan slacksL<.
tions which are color coordinated, or "related." This may not be all possible pairs in A µ B but will certainly be a subset of A µ B. For example,
Definition: Relation. Let A and B be sets. A relation from A into B is any subset of A×B.
Example 6.1.1. Let A = 81, 2, 3< and B = 84, 5<. Then 8H1, 4L, H2, 4L, H3, 5L< is a relation from A into B. Of course, there are many
others we could describe; 64, to be exact.
Example 6.1.2. Let A = 82, 3, 5, 6< and define a relation r from A into A by Ha, bL œ r if and only if a divides evenly into b. So
r = 8H2, 2L, H3, 3L, H5, 5L, H6, 6L, H2, 6L, H3, 6L<.
Definition: Relation on a Set. A relation from a set A into itself is called a relation on A.
The relation "divides" in Example 6.1.2 is will appear throughout the book. Here is a general definition on the whole set of integers.
Definition: Divides. Let a, b œ Z .
a b if and only if there exists an integer k such that a k = b.
b
Based on the equation a k = b, we can say that a b is equivalent to k = , or a divides evenly into b. In fact the "divides" is short for "divides
a
b
evenly into." You might find the equation k = initially easier to understand, but in the long run we will find the equation a k = b more
a
useful.
Sometimes it is helpful to illustrate a relation. Consider Example 6.1.1. A picture of r can be drawn as in Figure 6.1.1. The arrows indicate that
1 is related to 4 under r. Also, 2 is related to 4 under r, and 3 is related to 5, while the upper arrow denotes that r is a relation from the whole set
A into the set B.
A typical element in a relation r is an ordered pair Hx, yL. In some cases, r can be described by actually listing the pairs which are in r, as in the
previous examples. This may not be convenient if r is relatively large. Other notations are used depending on personal preference or past
practice. Consider the following relations on the real numbers:
Applied Discrete Structures by A. Doerr & K. Levasseur is licensed under a Creative Commons Attribution-Noncommercial-No Derivative Works 3.0
Chapter 6 - Relations
The notation H4, 16L œ r or H3, 7.2L œ s makes sense in both cases. However, r would be more naturally expressed as r HxL = x2 or r HxL = y,
Many of the relations we will work with "resemble" the relation §, so x s y is a common way to express the fact that x is related to y through the
relation s.
Relation Notion. Let s be a relation from a set A into a set B. Then the fact that Hx, yL œ s is frequently written x s y.
Let A = 82, 3, 5, 8<, B = 84, 6, 16<, and C = 81, 4, 5, 7<; let r be the relation "divides," denoted by », from A into B; and let s be the
relation § from B into C. So r = 8H2, 4L, H2, 6L, H2, 16L, H3, 6L, H8, 16L< and s = 8H4, 4L, H4, 5L, H4, 7L, H6, 7L<.
Notice from Figure 6.1.2 that we can, for certain elements of A, go through elements in B to results in C. That is:
2 4 and 4 § 4
2 4 and 4 § 5
2 4 and 4 § 7
2 6 and 6 § 7
3 6 and 6 § 7
Based on this observation, we can define a new relation, call it rs, from A into C. In order for Ha, cL to be in rs, it must be possible to travel
along a path in Figure 6.1.2 from a to c. In other words, Ha, cL œ rs if and only if H$ bLB Ha r b and b s cL. The name rs was chosen solely
8H2, 4L, H2, 5L, H2, 7L, H3, 7L<. We summarize in a definition.
because it reminds us that this new relation was formed by the two previous relations r and s. The complete listing of all elements in rs is
composition of r and s, written rs, is the set of pairs of the form Ha, cL œ A µ C, where Ha, cL œ rs if and only if there exists b œ B such that
Definition: Composition of Relations. Let r be a relation from a set A into a set B, and let s be a relation from B into a set C. The
Ha, bL œ r and Hb, cL œ 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 Chapter 7.) As indicated above, the traditional way of describing a composition of two relations is rs where r
is the first relation and s the second. However, function composition is traditionally expressed "backwards"; that is, as sr (or s Î r), where r is the
first function and s is the second.
Applied Discrete Structures by A. Doerr & K. Levasseur is licensed under a Creative Commons Attribution-Noncommercial-No Derivative Works 3.0
Chapter 6 - Relations
2. The following relations are on {1, 3, 5} . Let r be the relation x r y iff y = x + 2 and s the relation x s y iff x § y.
(a) Find rs.
b) Find sr.
(c) Illustrate rs and sr via a diagram.
(d) Is the relation (set) rs equal to the relation sr? Why?
3. Let A = 81, 2, 3, 4 , 5< and define r on A by x r y iff x + 1 = y. We
(b) r2
(c) r3
4. Given s and t, relations on Z, s = 8H1, nL : n œ Z< and t = 8Hn, 1L : n œ Z<, what are st and ts?
B Exercises
5. Let r be the relation on the power set, PHS L, of a finite set S of cardinality n. Define r by HA, BL œ r iff A › B = «,
(a) Consider the specific case n = 3, and determine the cardinality of the set r.
(b) What is the cardinality of r for an arbitrary n? Express your answer in terms of n. (Hint: There are three places that each element of S can
go in building an element of r.)
6. Let r1 , r2 , and r3 be relations on any set A. Prove that if r1 Œ r2 then r1 r3 Œ r2 r3 .
Applied Discrete Structures by A. Doerr & K. Levasseur is licensed under a Creative Commons Attribution-Noncommercial-No Derivative Works 3.0
Chapter 6 - Relations
1 3
FIGURE 6.2.1
The actual location of the vertices is immaterial. The main idea is to place the vertices in such a way that the graph is easy to read. Obviously,
after a rough-draft graph of a relation, we may decide to relocate and/or order the vertices so that the final result will be neater. Figure 6.2.1
could be presented as in Figure 6.2.2.
0 3
1 2
FIGURE 6.2.2
A vertex of a graph is also called a node, point, or a junction. An edge of a graph is also referred to as an arc, a line, or a branch. Do not be
concerned if two graphs of a given relation look different. It is a nontrivial problem to determine if two graphs are graphs of the same relation.
s = 8H1, 2L, H2, 1L, H1, 3L, H3, 1L, H2, 3L, H3, 3L<,
Applied Discrete Structures by A. Doerr & K. Levasseur is licensed under a Creative Commons Attribution-Noncommercial-No Derivative Works 3.0
Chapter 6 - Relations
FIGURE 6.2.3
Example 6.2.3. Let B = 8a, b<, and let A = P HBL = 80, 8a<, 8b<, 8a, b<<. Then Œ is a relation on A whose digraph is Figure 6.2.4.
8a,b<
8a< 8b<
FIGURE 6.2.4
various subsets in P HBL. Some relations, such as this one, can also be conveniently depicted by what is called a Hasse, or ordering, diagram. To
This graph is helpful insofar as it reminds us that each set is a subset of itself (How?) and shows us at a glance the relationship between the
Applied Discrete Structures by A. Doerr & K. Levasseur is licensed under a Creative Commons Attribution-Noncommercial-No Derivative Works 3.0
Chapter 6 - Relations
81, 2<
81< 82<
«
FIGURE 6.2.5
Example 6.2.4. Consider the relation s whose Hasse diagram is Figure 6.2.6.
2 3
FIGURE 6.2.6
How do we read this diagram? What is A? What is s? What does the digraph of s look like? Certainly A = 81, 2, 3, 4, 5< and 1 s 2, 3 s 4,
1 s 4, 1 s 5, etc., so
s = 8H1, 1L, H2, 2L, H3, 3L, H4, 4L, H5, 5L, H1, 3L, H1, 4L, H1, 5L, H1, 2L, H3, 4L, H3, 5L, H4, 5L, H2, 5L<
A digraph for s is Figure 6.2.7. It is certainly more complicated to read than the Hasse diagram.
Applied Discrete Structures by A. Doerr & K. Levasseur is licensed under a Creative Commons Attribution-Noncommercial-No Derivative Works 3.0
Chapter 6 - Relations
Applied Discrete Structures by A. Doerr & K. Levasseur is licensed under a Creative Commons Attribution-Noncommercial-No Derivative Works 3.0
Chapter 6 - Relations
Z µ Z* defined by Ha, bL q Hc, dL if and only if a d = b c. We will leave it to the reader to, verify that q is indeed an equivalence relation. Be
Example 6.3.3. Let Z* be the set of nonzero integers. One of the most basic equivalence relations in mathematics is the relation q on
aware that since the elements of Z µ Z* are ordered pairs, proving symmetry involves four numbers and transitivity involves six numbers.
Two ordered pairs, Ha, bL and Hc, dL, are related if the fractions and are numerically equal.
a c
b d
Example 6.3.4. Consider the relation s described by the digraph in Figure 6.3.1. This relation is reflexive (Why?), not symmetric
(Why?), and not transitive (Why?). Is s an equivalence relation? A partial ordering? It is neither, and among the valid reasons of stating this
is that s isn't transitive.
Applied Discrete Structures by A. Doerr & K. Levasseur is licensed under a Creative Commons Attribution-Noncommercial-No Derivative Works 3.0
Chapter 6 - Relations
a b
FIGURE 6.3.1.
A classic example of a partial ordering relation is § on the real numbers, R. Indeed, when graphing partial ordering relations, it is natural to
"plot" the elements from the given poset starting with the "least" element to the "greatest" and to use terms like "least," "greatest," etc. Because
of this the reader should be forewarned that many texts use the § notation when describing an arbitrary partial ordering. This can be quite
confusing for the novice, so we continue to use the general notation r, s, etc., when speaking of relations.
Applied Discrete Structures by A. Doerr & K. Levasseur is licensed under a Creative Commons Attribution-Noncommercial-No Derivative Works 3.0
Chapter 6 - Relations
Figure 6.3.2
4. Determine which of the following are equivalence relations and/or partial ordering relations for the given sets:
(a) A = 8lines in the plane<; x r y if and only if x is parallel to y.
(b) A = R; x r y if and only if x—y § 7.
5. Consider the following relation on 81, 2, 3, 4, 5, 6<. r = 8Hi, jL : i - j = 2<.
(a) Is r reflexive?
(b) Is r symmetric?
(c) Is r transitive?
Applied Discrete Structures by A. Doerr & K. Levasseur is licensed under a Creative Commons Attribution-Noncommercial-No Derivative Works 3.0
Chapter 6 - Relations
(b) Let a œ A and define c HaL = 8b œ A a r b<. c(a) is called the equivalence class of a under r. Find c HaL for each element a œ A.
(c) Show that 8c HaL a œ A< forms a partition of A for this set A.
(d) Let r be an equivalence relation on an arbitrary set A. Prove that the set of all equivalence classes under r constitutes a partition of A.
8. Define r on the power set of 81, 2, 3< by A r B ñ A = B . Prove that r is an equivalence relation. What are the equivalence classes
under r?
9. Consider the following relations on Z8 = 80, 1, . . . , 7<. Which are equivalence relations? For the equivalence relations, list the equiva-
lence classes.
(a) a r b iff the English spellings of a and b begin with the same letter.
(b) a s b iff a - b is a positive integer.
(c) a t b iff a - b is an even integer.
10. Define t on A = 81, 2, . . . , 9< by x t y iff x + y = 10. Is t an equivalence relation on A? If yes, list its equivalence classes. If no, why
not?
B Exercises
11. In this exercise, we prove that implication is a partial ordering. Let A be any set of propositions.
(a) Verify that q Ø q is a tautology, thereby showing that is a reflexive relation on A.
(b) Prove that is antisymmetric on A. Note: we do not use = when speaking of propositions, but rather equivalence, ñ.
(c) Prove that is transitive on A.
(d) Given that qi is the proposition n < i on N, draw the Hasse diagram for the relation on 8q1 , q2 , q3 , …<.
C Exercise
12. Let S = 81, 2, 3, 4, 5, 6, 7< be a poset HS, §L with the Hasse diagram shown in Figure 6.3.3. Another relation r Œ S µ S is defined as
follows: Hx, yL œ r if and only if there exists z œ S such that z < x and z < y in the poset HS, §L.
(a) Prove that r is reflexive.
(b) Prove that r is symmetric.
(c) A compatible with respect to relation r is any subset Q of set S such that x œ Q and y œ Q Hx, yL œ r. A compatible g is a maximal
compatible if Q is not a proper subset of another compatible. Give all maximal compatibles with respect to relation r defined above.
(d) Discuss a characterization of the set of maximal compatibles for relation r when HS, §L is a general finite poset. What conditions, if any,
on a general finite poset HS, §L will make r an equivalence relation?
6 7
3 4 5
1 2
FIGURE 6.3.3
Applied Discrete Structures by A. Doerr & K. Levasseur is licensed under a Creative Commons Attribution-Noncommercial-No Derivative Works 3.0
Chapter 6 - Relations
Rij = :
1 if ai r b j
0 otherwise
R is called the adjacency matrix (or the Boolean matrix, or the relation matrix) of r.
Example 6.4.1. Let A = 82, 5, 6< and let r be the relation 8H2, 2L, H2, 5L, H5, 6L, H6, 6L< on A. Since r is a relation from A into the
same set A (the B of the definition), we have a1 = 2, a2 = 5, and a3 = 6, and b1 = 2, b2 = 5, and b3 = 6. Next, since
2 r 2, we have R11 = 1;
2 r 5, we have R12 = 1;
5 r 6, we have R23 = 1; and
6 r 6, we have R33 = 1;
All other entries of R are 0, so
1 1 0
R = 0 0 1
0 0 1
From the definition of r and of composition, we note that
0 1 0 0 0 1 1 1
1 0 1 0 0 0 1 1
If R = and S = .
0 1 0 1 0 0 0 1
0 0 1 0 0 0 0 0
0 0 1 1 1 1 1 1
0 1 1 1 0 1 1 1
Then using Boolean arithmetic, R S = and S R = .
0 0 1 1 0 0 1 0
0 0 0 1 0 0 0 0
Theorem 6.4.1. Let A1 , A2 , and A3 be finite sets where r1 is a relation from A1 into A2 and r2 is a relation from A2 into A3 . If R1 and R2
are the adjacency matrices of r1 and r2 , respectively, then the product R1 R2 using Boolean arithmetic is the adjacency matrix of the
composition r1 r2 .
Remark: A convenient help in constructing the adjacency matrix of a relation from a set A into a set B is to write the elements from A in a
column preceding the first column of the adjacency matrix, and the elements of B in a row above the first row. Initially, R in Example 6.4.1
would be
2 5 6
2
5
6
Applied Discrete Structures by A. Doerr & K. Levasseur is licensed under a Creative Commons Attribution-Noncommercial-No Derivative Works 3.0
Chapter 6 - Relations
and Rij is 1 if and only if Iai , b j M œ r. So that, since the pair H2, 5L œ r, the entry of R corresponding to the row labeled 2 and the column labeled
5 in the matrix is a 1.
Example 6.4.3, This final example gives an insight into how relational data base programs can systematically answer questions pertain-
ing to large masses of information. Matrices R (on the left) and S (on the right) define the relations r and s where a r b if software a can be run
with operating system b, and b s c if operating system b can run on computer c.
OS1 OS2 OS3 OS4 C1 C2 C3
P1 1 0 1 0 OS1 1 1 0
P2 1 1 0 0 OS2 0 1 0
P3 0 0 0 1 OS3 0 0 1
P4 0 0 1 1 OS4 0 1 1
Although the relation between the software and computers is not implicit from the data given, we can easily compute this information. The
matrix of rs is RS, which is
C1 C2 C3
P1 1 1 1
P2 1 1 0
P3 1 1 1
P4 0 1 1
This matrix tells us at a glance which software will run on the computers listed. In this case, all software will run on all computers with the
exception of program P2, which will not run on the computer C3, and program P4, which will not run on the computer C1.
(b) Using the matrices found in part (a) above, find r2 of each relation in Exercise 3 of Section 6.3.
(c) Find the digraph of r2 directly from the given digraph and compare your results with those of part (b).
3. Suppose that the matrices in Example 6.4.2 are relations on 81, 2, 3, 4<. What relations do R and S describe?
4. Let D be the set of weekdays, Monday through Friday, let W be a set of employees 81, 2, 3< of a tutoring center, and let V be a set of
computer languages for which tutoring is offered, {A(PL), B(asic), C(++), J(ava), L(isp), P(ython)}. We define s (schedule) from D into W by
d s w if w is scheduled to work on day d. We also define r from W into V by w r l if w can tutor students in language l. If s and r are defined by
matrices
1 2 3
M 1 0 1 A B C J L P
T 0 1 1 1 0 1 1 0 0 1
S = and R =
W 1 0 1 2 1 1 0 1 0 1
Th 0 1 0 3 0 1 0 0 1 1
F 1 1 0
(a) compute S R using Boolean arithmetic and give an interpretation of the relation it defines, and
(b) compute S R using regular arithmetic and give an interpretation of the result describes.
5. How many different reflexive, symmetric relations are there on a set with three elements? (Hint: Consider the possible matrices.)
6. Let A = 8a, b, c, d<. Let r be the relation on A with adjacency matrix
a b c d
a 1 0 0 0
b 0 1 0 0
c 1 1 1 0
c 0 1 0 1
Applied Discrete Structures by A. Doerr & K. Levasseur is licensed under a Creative Commons Attribution-Noncommercial-No Derivative Works 3.0
Chapter 6 - Relations
Applied Discrete Structures by A. Doerr & K. Levasseur is licensed under a Creative Commons Attribution-Noncommercial-No Derivative Works 3.0
Chapter 6 - Relations
This situation can be described by the relation r = 8Ha, bL, Ha, cL, Hb, dL, Hc, dL<. We would like to change the system so that the main office
communicate to another person, d; however, the main office cannot communicate with d. Assume communication is only one way, as indicated.
a can communicate with person d and still maintain the previous system. We, of course, want the most economical system.
This can be rephrased as follows; Find the smallest relation r+ which contains r as a subset and which is transitive;
r+ = 8Ha, bL, Ha, cL, Hb, dL, Hc, dL, Ha, dL<.
Definition: Transitive Closure. Let A be a set and r be a relation on A. The transitive closure of r, denoted by r+ , is the smallest
transitive relation that contains r as a subset.
A = {1, 2, 3, 4} , and let S = 8H1, 2L, H2, 3L, H3, 4L< be a relation on A. This relation is called the successor
relation on A since each element is related to its successor. How do we compute S+ ? By inspection we note that H1, 3L must be in S+ . Let's
Example 6.5.1. Let
analyze why. This is so because H1, 2L œ S and H2, 3L œ S, and the transitive property forces H1, 3L to be in S+ .
In general, it follows that if Ha, bL œ S and Hb, cL œ S, then (a, c) œS + . This condition is exactly the membership requirement for the pair
(a, c) to be in the composition SS = S2 . So every element in S2 must be an element in S+ . So far, S+ contains at least S ‹ S2 . In particu-
lar, for this example, since S = 8H1, 2L, H2, 3L, H3, 4L< and S2 = 8H1, 3L, H2, 4L<, we have
S ‹ S2 = 8H1, 2L, H2, 3L, H3, 4L, H1, 3L, H2, 4L<.
Is the relation S ‹ S2 transitive? Again, by inspection, H1, 4L is not an element of S ‹ S2 , but it must be an element of S+ since H1, 3L and
H3, 4L are required to be in S+ . From above, H1, 3L œ S2 and H3, 4L œ S, and the composite S2 S = S3 produces H1, 4L. This shows that
S3 Œ S + . This process must be continued until the resulting relation is transitive. If A is finite, as is true in this example, the transitive
closure will be obtained in a finite number of steps. For this example,
S+ = S ‹ S 2 ‹ S 3 = 8H1, 2L, H2, 3L, H3, 4L, H1, 3L, H2, 4L, H1, 4L< .
Theorem 6.5.1. If r is a relation on a set A and A = n, then the transitive closure of r is the union of the first n powers of r. That is,
r+ = r ‹ r2 ‹ r 3 ‹ º⋯ ‹ rn .
Let's now consider the matrix analogue of the transitive closure.
Example 6.5.2. Consider the relation
r = 8H1, 4L, H2, 1L, H2, 2L, H2, 3L, H3, 2L, H4, 3L, H4, 5L, H5, 1L<
on the set A = 81, 2, 3, 4, 5<. The matrix of r is
0 0 0 1 0
1 1 1 0 0
R= 0 1 0 0 0
0 0 1 0 1
1 0 0 0 0
Recall that r2 , r3 , … can be determined through computing the matrix powers R2 , R3 , …. Here,
0 0 1 0 1 1 1 0 0 0
1 1 1 1 0 1 1 1 1 1
R2 = 1 1 1 0 0 , R3 = 1 1 1 1 0 ,
1 1 0 0 0 1 1 1 1 0
0 0 0 1 0 0 0 1 0 1
1 1 1 1 0 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1
R4 = 1 1 1 1 1 , and R5 = 1 1 1 1 1 ,
1 1 1 1 1 1 1 1 1 1
1 1 0 0 0 1 1 1 1 0
i=1
Theorem 6.5.2. Let r be a relation on a finite set and let R+ be the matrix of r+ , the transitive closure of r. Then
R = R + R2 + º⋯ + Rn , using Boolean arithmetic.
+
Using this theorem, we find R+ is the 5 µ 5 matrix consisting of all 1 ' s, thus, r+ is all of A µ A.
Applied Discrete Structures by A. Doerr & K. Levasseur is licensed under a Creative Commons Attribution-Noncommercial-No Derivative Works 3.0
Chapter 6 - Relations
WARSHALL'S ALGORITHM
Let r be a relation on the set 81, 2, ... , n< with relation matrix R. The matrix of the transitive closure R+ , can be computed by the equation
R+ = R + R 2 + º⋯ + Rn . By using ordinary polynomial evaluation methods, you can compute R+ with n - 1 matrix multiplications:
R+ = RHI + RHI + H º⋯ RHI + RL º⋯LLL.
For example, if n = 3, R = RHI + RHI + RLL.
We can make use of the fact that if T is a relation matrix, T + T = T due to the fact that 1 + 1 = 1 in Boolean arithmetic. Let
Sk = R + R2 + º⋯ + Rk . Then
R = S1
S1 (I + S1 ) = R (I + R) = R + R2 = S2
S2 HI + S 2 L = HR + R2 L HI + R + R2 L
= IR + R 2 M + IR2 + R 3 M + HR3 + R4 L
= R + R2 + R 3 + R 4 = S4
Similarly,
S4 HI + S4 L = S8
etc..
Notice how each matrix multiplication doubles the number of terms that have been added to the sum that you currently have computed. In
algorithmic form, we can compute R2 as follows.
Algorithm 6.5.1: Transitive Closure Algorithm 1. Let R be a known relation matrix and let R+ be its transitive closure matrix, which is to be
computed.
1.0. T := R
2.0. Repeat
2.1 S := T
2.2 T := S HI + SL // using Boolean arithmetic
Until T = S
Notes:
(a) Often the higher-powered terms in Sn do not contribute anything to R+ . When the condition T = S becomes true in Step 2, this is an
indication that no higher-powered terms are needed.
(b) To compute R+ using this algorithm, you need to perform no more than `log2 np matrix multiplications, where `xp is the least integer that is
greater than or equal to x. For example, if r is a relation on 25 elements, no more than `log2 25p = 5 matrix multiplications are needed.
A second algorithm, Warshall's Algorithm, reduces computation time to the time that it takes to perform one matrix multiplication.
Algorithm 6.5.2; Warshall's Algorithm. Let R be a known relation matrix and let R+ be its transitive closure matrix, which is to be computed.
1.0 T := R
2.0 FOR k : = 1 to n DO
FOR i : = 1 to n DO
FOR j := 1 to n DO
T@i, jD := T@i, jD + T@i, kD ÿ T@k, jD
Applied Discrete Structures by A. Doerr & K. Levasseur is licensed under a Creative Commons Attribution-Noncommercial-No Derivative Works 3.0
Chapter 6 - Relations
2. Let A and r be as in Example 6.5.2. Compute the relation r+ as in Example 6.5.1. Verify your results.
3. (a) Draw digraphs of the relations S, S2 , S3 , and S+ of Example 6.5.1.
(b) Verify that in terms of the graph of S, a S+ b if and only if b is reachable from a along a path of any finite nonzero length.
4. Let r be the relation represented by the digraph in Figure 6.5,1.
(a) Find r+ .
(b) Determine the digraph of r+ directly from the digraph of r.
(c) Verify your result in part (b) by computing the digraph from your result in part (a).
1 3
5 4
FIGURE 6.5.1
5. (a) Define reflexive closure and symmetric closure by imitating the definition of transitive closure.
(b) Use your definitions to compute the reflexive and symmetric closures of Examples 6.5.1 and 6.5.2.
(c) What are the transitive reflexive closures of these examples?
(d) Convince yourself that the reflexive closure of the relation < on the set of positive integers P is §.
6. What common relations on Z are the transitive closures of the following relations?
(a) a S b if and only if a + 1 = b.
(b) a R b if and only if a - b = 2.
B Exercise
7. (a) Let A be any set and r a relation on A, prove that Hr+ L+ = r+ .
(b) Is the transitive closure of a symmetric relation always both symmetric and reflexive? Explain.
Applied Discrete Structures by A. Doerr & K. Levasseur is licensed under a Creative Commons Attribution-Noncommercial-No Derivative Works 3.0
Chapter 6 - Relations
Section 6.1
1. Give an example to illustrate how the relation "is a grandparent of" is a composition of the relation "is a parent of" on people.
2. Three students, Melissa, John, and Ted, would like to set up a tutorial program in the languages Pascal, FORTRAN, and COBOL. Melissa is
proficient in all three languages, John in Pascal and FORTRAN, and Ted in just FORTRAN.
(a) Let S = 8three students<, L = 8three Languages<, and let p be the relation "is proficient in the language of". Describe this relation as
a set of ordered pairs and illustrate the relation by a diagram similar to that of Figure 6.1.1.
(b) Two P.C.s are available for tutoring purposes; one has software for Pascal and FORTRAN, and the second only for Pascal. Describe
by a composite relation which student can tutor on each machine. Illustrate this composite relationship.
Section 6.2
3. Let A = 8-1, 0, 1, 2<. List the ordered pairs and draw the digraphs of each of the following relations on A.
(a) r = 8Hx, yL y = x + 1<
(b) s = 8Hx, yL x2 = y 2 <
(c) t = 8Hx, yL x ¹≠ y<
4. List the ordered pairs and draw the digraph of the relation s2 for the relation s of Exercise 2, Section 6.2.
5. In Figure 6.2, 1, assume the nodes stand for four separate cities where a manufacturer has warehouses, while the arrows represent one-way
streets. Where should the manufacturer place his main office? Where is the least desirable location? How can we interpret the arrows in both
directions between nodes 1 and 2?
6. The problem of computer compatibility is an important one. In Figure 6.2.2 interpret the four nodes as representing computers, and an arrow
from one node to another as "is compatible with". Note that some software does not go both ways.
(a) Is there any one computer that is not compatible with any other?
(b) Is it possible to create a network where any computer could be linked with any other using at most two links? If not, what soft ware
should be created to enhance compatibility?
(c) If an arrow from a node to itself is interpreted as "high flexibility" of the system, does this affect your answer in part b?
Section 6.3
7. In Figure 6.3.2 (vii), interpret the four nodes as representing people, and an arrow from one node to another as "being friendly toward". Note
that some friendships are not mutual.
(a) Is there any individual in this group unfriendly to everyone else?
(b) If this group were a committee, who is most likely to be the chairperson; that is, who is friendly toward the most people?
(c) If an arrow from one vertex to itself is interpreted as "great person ality," does your answer to part b still hold?
(d) The four people are to be seated at a round table. A person is to be seated between two people only if he is friendly toward both of
them. Does a seating arrangement exist? Is there more than one?
8. Let A = 8a, b, c, d, e< and let r, s, and t be the following relations on A:
r = 8Ha, aL, Ha, bL, Hb, bL, Hb, cL, Hc, cL, Hc, dL, Hd, dL, Hd, eL, He, eL, He, aL<
s = 8Ha, aL, Ha, bL, Ha, dL, Hb, aL, Hb, bL, Hb, dL, Hc, cL, Hd, aL, Hd, bL, Hd, dL, He, eL<
t = 8Ha, aL, Ha, bL, Hb, bL, Hc, bL, Hc, cL, Hd, dL, He, aL, He, bL, He, cL, He, dL, He, eL<
(a) Which relation is a partial ordering? Draw its Hasse diagram.
(b) Which relation is an equivalence relation? List its equivalence classes.
9. Demonstrate that the relation "living in the same house" on the set of people in a given city is an equivalence relation. State the necessary
assumption for this to be the case.
10. Let A = 800, 01, 10, 11<, the set of strings of 0s and 1s with length two. Given r and s defined by
x r y ñ x and y differ in exactly one position (for example 01 r 11, but not 10 r 01), and
x s y ñ x and y have the same number of 0s.
(a) Draw a directed graph of r.
(b) Which of the adjectives, reflexive, symmetric, antisymmetric, and transitive, describe r? Explain your answers.
(c) Which of the adjectives, reflexive, symmetric, antisymmetric, and transitive, describe s?
(d) Describe with a directed graph the relation rs.
11. Determine whether the following relations are partial orderings and/or equivalence relations on the given set:
(a) C = 8students in this class<; x r y iff x and y have the same grade point average.
(b) C = 8students in this class<; x s y iff x is taller than y,
(c) Rephrase (slightly) the relation in part b so it is a partial ordering relation.
Applied Discrete Structures by Alan Doerr & Kenneth Levasseur is licensed under a Creative Commons Attribution-Noncommercial-No Derivative Works 3.0 United States
Chapter 6 - Relations
12. Let A = 8a, b, c, d<. Draw the graph of a relation where the relation is:
(a) reflexive, symmetric, but not transitive.
(b) transitive, but not symmetric and not reflexive.
(c) both an equivalence relation and a partial ordering.
Section 6.4
13. How many symmetric relations can there be on a four-element set? Hint: Think of the possible relation matrices.
14. Let A = 81, 2, 3, 4, 5, 6< and let p = 8Hi, jL i divides j< be a relation on A.
(a) List the elements in p.
(b) Determine the relation matrix of p.
(c) Construct the digraph and the Hasse diagram of p.
15. Let A = 8a, b, c<. The following matrices describe relations on A:
1 1 0 1 0 1
(i) 1 1 0 (ii) 0 0 0
0 0 1 1 1 1
(a) Draw the graph of the relation.
(b) Describe each relation as a set of ordered pairs.
(c) Compute r2 for each relation r.
Section 6.5
16. Let the relation s on the set 8a, b, c, d, e< be given by the matrix
a b c d e
a 0 0 0 0 0
b 1 0 1 0 0
c 0 1 0 0 0
d 0 0 1 0 0
e 1 1 0 0 0
(a) Draw the digraph of s.
(b) Find the transitive closure of s. Give the adjacency matrix or the digraph or the set of ordered pairs.
17. Consider the relation r on 81, 2, 3, 4< whose Boolean matrix is
1 2 3 4
1 0 0 1 1
R= 2 0 1 0 0
3 0 0 1 0
4 1 0 0 0
(a) Draw the graph of r.
(b) Determine whether r is reflexive, symmetric, antisymmetric, and/or transitive. Explain fully.
(c) Find the transitive closure of r and draw the graph of r+ .
18. In a small town a bank HbL, school HsL, town hall HtL, and shopping mall HmL are connected by a series of narrow one-way streets; a street
from the town hall to the bank, one from the bank to the school, one from the school to the shopping mall, and one from the shopping mall to
the town hall.
(a) Draw a digraph of this system of roads.
(b) Find the matrix representation of the digraph in part a.
(c) Assuming that the given streets cannot be widened, assist the mayor in planning the construction of new roads to increase traffic
flow. Assume that if there is a one-way street from point a to b and one from point b to c, there should be one from point a to c.
(d) If you have not done so yet, draw the matrix representation and the graph of your answer to part c and interpret the results for the
mayor.
19. The ambassadors of four countries are to meet with the ambassador of the United States HA1 ) to discuss world problems. Some countries are
friendly to each other, some are not, and in certain situations the friendship is one-way. The U.S. ambassador's daughter (who obviously took a
discrete structures course) assists her father in diagnosing this complex situation and, using the relation "is friendly toward," has come up with
the following digraph.
Applied Discrete Structures by Alan Doerr & Kenneth Levasseur is licensed under a Creative Commons Attribution-Noncommercial-No Derivative Works 3.0 United States
Chapter 6 - Relations
Applied Discrete Structures by Alan Doerr & Kenneth Levasseur is licensed under a Creative Commons Attribution-Noncommercial-No Derivative Works 3.0 United States