• No results found

Find a formula for the kth term of the subsequence

3.2 ➜ Sequences and Strings

90. Find a formula for the kth term of the subsequence

Answer 91–94 using the sequences y and z defined by yn= 2n− 1, zn= n(n − 1).

Answer 95–102 for the sequence r defined by rn= 3 · 2n− 4 · 5n, n≥ 0.

95. Find r0. 96. Find r1. 97. Find r2. 98. Find r3.

99. Find a formula for rp. 100. Find a formula for rn−1. 101. Find a formula for rn−2.

102. Prove that{rn} satisfies

rn= 7rn−1− 10rn−2, n≥ 2.

Answer 103–110 for the sequence z defined by zn= (2 + n)3n, n≥ 0.

103. Find z0. 104. Find z1. 105. Find z2. 106. Find z3.

107. Find a formula for zi. 108. Find a formula for zn−1. 109. Find a formula for zn−2.

110. Prove that{zn} satisfies

zn= 6zn−1− 9zn−2, n≥ 2.

114. Let a and b be sequences, and let sk= This equation, known as the summation-by-parts formula, is the discrete analog of the integration-by-parts formula in calculus.

3.2 ◆ Sequences and Strings

147

115. Sometimes we generalize the notion of sequence as defined in this section by allowing more general indexing. Suppose that{ai j} is a sequence indexed over pairs of positive integers.

Prove that

116. Compute the given quantity using the strings α = baab, β = caaba, γ = bbab.

121. Find all substrings of the string babc.

122. Find all substrings of the string aabaabb.

123. Use induction to prove that

 1

n1· n2· · · nk = n,

for all n ≥ 1, where the sum is taken over all nonempty subsets{n1, n2,. . . , nk} of {1, 2, . . . , n}.

when n is odd, and any value between the two middle values of x1,. . . , xn when n is even. For example, if x1 < x2 <

· · · < x5, the median is x3. If x1< x2< x3< x4, a median is any value between x2and x3, including x2and x3.

Use Exercises 125 and 126 and mathematical induc-tion to prove that the sum

n i=1

|x − xi|, (3.2.9)

n ≥ 1, is minimized when x is equal to a median of x1,. . . , xn.

If we repeat an experiment n times and observe the values x1,. . . , xn, the sum (3.2.9) can be interpreted as a measure of the error in assuming that the correct value is x.

This exercise shows that this error is minimized by choos-ing x to be a median of the values x1,. . . , xn. The requested inductive argument is attributed to J. Lancaster.

128. Prove that back-ward). An example of a palindrome over X is bbaabb. De-fine a function from X to the set of palindromes over X as f (α) = ααR. Is f one-to-one? Is f onto? Prove your answers.

Let L be the set of all strings, including the null string, that can be constructed by repeated application of the following rules:

Ifα ∈ L, then aαb ∈ L and bαa ∈ L.

132. Show that aaabbb is in L.

133. Show that baabab is in L.

134. Show that aab is not in L.

135. Prove that ifα ∈ L, α has equal numbers of a’s and b’s.

136. Prove that ifα has equal numbers of a’s and b’s, then α ∈ L.

137. Let{an}n=1be a nondecreasing sequence, which is bounded above, and let L be the least upper bound of the set {an | n = 1, 2, . . .}. Prove that for every real number ε > 0, there exists a positive integer N such that L− ε < an ≤ L for every n≥ N. In calculus terminology, a nondecreasing sequence, which is bounded above, converges to the limit L, where L is the least upper bound of the set of elements of the sequence.

3.3 ➜ Relations

A relation from one set to another can be thought of as a table that lists which elements of the first set relate to which elements of the second set (see Table 3.3.1). Table 3.3.1 shows which students are taking which courses. For example, Bill is taking Computer Science and Art, and Mary is taking Mathematics. In the terminology of relations, we would say that Bill is related to Computer Science and Art, and that Mary is related to Mathematics.

Of course, Table 3.3.1 is really just a set of ordered pairs. Abstractly, we define a relation to be a set of ordered pairs. In this setting, we consider the first element of the ordered pair to be related to the second element of the ordered pair.

TABLE 3.3.1 Relation of Students to Courses

Student Course

Bill CompSci

Mary Math

Bill Art

Beth History

Beth CompSci

Dave Math

Definition 3.3.1 A (binary) relation R from a set X to a set Y is a subset of the Cartesian product X× Y . If (x, y) ∈ R, we write x R y and say that x is related to y. If X = Y , we call R a (binary) relation on X .

A function (see Section 3.1) is a special type of relation. A function f from X to Y is a relation from X to Y having the properties:

(a) The domain of f is equal to X .

(b) For each x ∈ X, there is exactly one y ∈ Y such that (x, y) ∈ f .

Example 3.3.2 If we let

X = {Bill, Mary, Beth, Dave}

and

Y = {CompSci, Math, Art, History}, our relation R of Table 3.3.1 can be written

R= {(Bill, CompSci), (Mary, Math), (Bill, Art), (Beth, History), (Beth, CompSci), (Dave, Math)}.

Since (Beth, History)∈ R, we may write Beth R History.

Example 3.3.2 shows that a relation can be given by simply specifying which ordered pairs belong to the relation. Our next example shows that sometimes it is possible to define a relation by giving a rule for membership in the relation.

3.3Relations

149

Example 3.3.3 Let

X = {2, 3, 4} and Y = {3, 4, 5, 6, 7}.

If we define a relation R from X to Y by

(x, y)∈ R if x divides y, we obtain

R= {(2, 4), (2, 6), (3, 3), (3, 6), (4, 4)}.

If we rewrite R as a table, we obtain

X Y

2 4

2 6

3 3

3 6

4 4

Example 3.3.4 Let R be the relation on X = {1, 2, 3, 4} defined by (x, y) ∈ R if x ≤ y, x, y ∈ X. Then R= {(1, 1), (1, 2), (1, 3), (1, 4), (2, 2), (2, 3), (2, 4), (3, 3), (3, 4), (4, 4)}.

An informative way to picture a relation on a set is to draw its digraph. (Di-graphs are discussed in more detail in Chapter 8. For now, we mention di(Di-graphs only in connection with relations.) To draw the digraph of a relation on a set X , we first draw dots or vertices to represent the elements of X . In Figure 3.3.1, we have drawn four vertices to represent the elements of the set X of Example 3.3.4. Next, if the element (x, y) is in the relation, we draw an arrow (called a directed edge) from x to y. In Figure 3.3.1, we have drawn directed edges to represent the members of the relation R of Example 3.3.4. Notice that an element of the form (x, x) in a relation corresponds to a directed edge from x to x. Such an edge is called a loop. There is a loop at every vertex in Figure 3.3.1.

2 1

4 3

Figure 3.3.1 The digraph of the relation of Example 3.3.4.

Example 3.3.5 The relation R on X = {a, b, c, d} given by the digraph of Figure 3.3.2 is R= {(a, a), (b, c), (c, b), (d, d)}.

d a

c

b

Figure 3.3.2 The digraph of the relation of Example 3.3.5.

We next define several properties that relations may have.

Definition 3.3.6 A relation R on a set X is reflexive if (x, x)∈ R for every x ∈ X.

Example 3.3.7 The relation R on X = {1, 2, 3, 4} defined by (x, y) ∈ R if x ≤ y, x, y ∈ X, is reflexive because for each element x ∈ X, (x, x) ∈ R; specifically, (1, 1), (2, 2), (3, 3), and (4, 4) are each in R. The digraph of a reflexive relation has a loop at every vertex. Notice that the digraph of this relation (see Figure 3.3.1) has a loop at every vertex.

By the generalized De Morgan’s laws for logic (Theorem 1.5.14), a relation R on X is not reflexive if there exists x ∈ X such that (x, x) ∈ R.

Example 3.3.8 The relation

R= {(a, a), (b, c), (c, b), (d, d)}

on X = {a, b, c, d} is not reflexive. For example, b ∈ X, but (b, b) /∈ R. That this relation is not reflexive can also be seen by looking at its digraph (see Figure 3.3.2);

vertex b does not have a loop.

Definition 3.3.9 A relation R on a set X is symmetric if for all x, y∈ X, if (x, y) ∈ R, then (y, x) ∈ R.

Example 3.3.10 The relation

R= {(a, a), (b, c), (c, b), (d, d)}

on X = {a, b, c, d} is symmetric because for all x, y, if (x, y) ∈ R, then (y, x) ∈ R. For example, (b, c) is in R and (c, b) is also in R. The digraph of a symmetric relation has the property that whenever there is a directed edge fromv to w, there is also a directed edge from w tov. Notice that the digraph of this relation (see Figure 3.3.2) has the property that for every directed edge fromv to w, there is also a directed edge from w to v.

In symbols, a relation R is symmetric if

∀x∀y[(x, y) ∈ R] → [(y, x) ∈ R].

Thus R is not symmetric if

¬[∀x∀y[(x, y) ∈ R] → [(y, x) ∈ R]]. (3.3.1) Using the generalized De Morgan’s laws for logic (Theorem 1.5.14) and the fact that

¬( p → q) ≡ p ∧ ¬q (see Example 1.3.13), we find that (3.3.1) is equivalent to

∃x∃y[[(x, y) ∈ R] ∧ ¬[(y, x) ∈ R]]

or, equivalently,

∃x∃y[[(x, y) ∈ R] ∧ [(y, x) ∈ R]].

In words, a relation R is not symmetric if there exist x and y such that (x, y) is in R and ( y, x) is not in R.

3.3Relations

151

Example 3.3.11 The relation R on X = {1, 2, 3, 4} defined by (x, y) ∈ R if x ≤ y, x, y ∈ X, is not symmetric. For example, (2, 3) ∈ R, but (3, 2) /∈ R. The digraph of this relation (see Figure 3.3.1) has a directed edge from 2 to 3, but there is no directed edge from 3 to 2.

Definition 3.3.12 A relation R on a set X is antisymmetric if for all x, y∈ X, if (x, y) ∈ R and (y, x) ∈ R, then x= y.

Example 3.3.13 The relation R on X = {1, 2, 3, 4} defined by (x, y) ∈ R if x ≤ y, x, y ∈ X, is antisymmetric because for all x, y, if (x, y) ∈ R (i.e., x ≤ y) and (y, x) ∈ R (i.e., y≤ x), then x = y.

Example 3.3.14 It is sometimes more convenient to replace

if (x, y)∈ R and (y, x) ∈ R, then x = y

in the definition of “antisymmetric” (Definition 3.3.12) with its logically equivalent contrapositive (see Theorem 1.3.18)

if x = y, then (x, y) ∈ R or (y, x) ∈ R

to obtain a logically equivalent characterization of “antisymmetric”: A relation R on a set X is antisymmetric if for all x, y∈ X, if x = y, then (x, y) ∈ R or (y, x) ∈ R.

Using this equivalent definition of “antisymmetric,” we again see that the relation R on X = {1, 2, 3, 4} defined by (x, y) ∈ R if x ≤ y, x, y ∈ X, is antisymmetric because for all x, y, if x = y, (x, y) ∈ R (i.e., x > y) or (y, x) ∈ R (i.e., y > x).

The equivalent characterization of “antisymmetric” translates for digraphs as fol-lows. The digraph of an antisymmetric relation has the property that between any two distinct vertices there is at most one directed edge. Notice that the digraph of the relation R in the previous paragraph (see Figure 3.3.1) has at most one directed edge between each pair of vertices.

Example 3.3.15 If a relation has no members of the form (x, y), x = y, we see that the equivalent characterization of “antisymmetric”

for all x, y∈ X, if x = y, then (x, y) ∈ R or (y, x) ∈ R

(see Example 3.3.14) is trivially true (since the hypothesis x = y is always false). Thus if a relation R has no members of the form (x, y), x = y, R is antisymmetric. For example,

R= {(a, a), (b, b), (c, c)}

on X = {a, b, c} is antisymmetric. The digraph of R shown in Figure 3.3.3 has at most one directed edge between each pair of distinct vertices. Notice that R is also reflexive and symmetric. This example shows that “antisymmetric” is not the same as “not symmetric”

because this relation is in fact both symmetric and antisymmetric.

a b c

Figure 3.3.3 The digraph of the relation of Example 3.3.15.

In symbols, a relation R is antisymmetric if

∀x∀y[(x, y) ∈ R ∧ (y, x) ∈ R] → [x = y].

Thus R is not antisymmetric if

¬[∀x∀y[(x, y) ∈ R ∧ (y, x) ∈ R] → [x = y]]. (3.3.2) Using the generalized De Morgan’s laws for logic (Theorem 1.5.14) and the fact that

¬( p → q) ≡ p ∧ ¬q (see Example 1.3.13), we find that (3.3.2) is equivalent to

∃x∃y[(x, y) ∈ R ∧ (y, x) ∈ R] ∧ ¬[x = y]]

which, in turn, is equivalent to

∃x∃y[(x, y) ∈ R ∧ (y, x) ∈ R ∧ (x = y)].

In words, a relation R is not antisymmetric if there exist x and y, x= y, such that (x, y) and ( y, x) are both in R.

Example 3.3.16 The relation

R= {(a, a), (b, c), (c, b), (d, d)}

on X= {a, b, c, d} is not antisymmetric because both (b, c) and (c, b) are in R. Notice that in the digraph of this relation (see Figure 3.3.2) there are two directed edges between b and c.

Definition 3.3.17 A relation R on a set X is transitive if for all x, y, z∈ X, if (x, y) and (y, z) ∈ R, then (x, z)∈ R.

Example 3.3.18 The relation R on X = {1, 2, 3, 4} defined by (x, y) ∈ R if x ≤ y, x, y ∈ X, is transitive because for all x, y, z, if (x, y) and ( y, z)∈ R, then (x, z) ∈ R. To formally verify that this relation satisfies Definition 3.3.17, we can list all pairs of pairs of the form (x, y) and ( y, z) in R and then verify that in every case, (x, z)∈ R:

Pairs of Form Pairs of Form

(x, y) ( y, z) (x, z) (x, y) ( y, z) (x, z) (1, 1) (1, 1) (1, 1) (2, 2) (2, 2) (2, 2) (1, 1) (1, 2) (1, 2) (2, 2) (2, 3) (2, 3) (1, 1) (1, 3) (1, 3) (2, 2) (2, 4) (2, 4) (1, 1) (1, 4) (1, 4) (2, 3) (3, 3) (2, 3) (1, 2) (2, 2) (1, 2) (2, 3) (3, 4) (2, 4) (1, 2) (2, 3) (1, 3) (2, 4) (4, 4) (2, 4) (1, 2) (2, 4) (1, 4) (3, 3) (3, 3) (3, 3) (1, 3) (3, 3) (1, 3) (3, 3) (3, 4) (3, 4) (1, 3) (3, 4) (1, 4) (3, 4) (4, 4) (3, 4) (1, 4) (4, 4) (1, 4) (4, 4) (4, 4) (4, 4)

Actually, some of the entries in the preceding table were unnecessary. If x= y or y= z, we need not explicitly verify that the condition

if (x, y) and ( y, z)∈ R, then (x, z) ∈ R

is satisfied since it will automatically be true. Suppose, for example, that x= y and (x, y) and ( y, z) are in R. Since x = y, (x, z) = (y, z) is in R and the condition is satisfied.

3.3Relations

153

Eliminating the cases x= y and y = z leaves only the following to be explicitly checked to verify that the relation is transitive:

Pairs of Form

(x, y) ( y, z) (x, z) (1, 2) (2, 3) (1, 3) (1, 2) (2, 4) (1, 4) (1, 3) (3, 4) (1, 4) (2, 3) (3, 4) (2, 4)

The digraph of a transitive relation has the property that whenever there are directed edges from x to y and from y to z, there is also a directed edge from x to z. Notice that the digraph of this relation (see Figure 3.3.1) has this property.

In symbols, a relation R is transitive if

∀x∀y∀z[(x, y) ∈ R ∧ (y, z) ∈ R] → [(x, z) ∈ R].

Thus R is not transitive if

¬[∀x∀y∀z[(x, y) ∈ R ∧ (y, z) ∈ R] → [(x, z) ∈ R]]. (3.3.3) Using the generalized De Morgan’s laws for logic (Theorem 1.5.14) and the fact that

¬( p → q) ≡ p ∧ ¬q (see Example 1.3.13), we find that (3.3.3) is equivalent to

∃x∃y∃z[(x, y) ∈ R ∧ (y, z) ∈ R] ∧ ¬[(x, z) ∈ R]

or, equivalently,

∃x∃y∃z[(x, y) ∈ R ∧ (y, z) ∈ R ∧ (x, z) ∈ R].

In words, a relation R is not transitive if there exist x, y, and z such that (x, y) and ( y, z) are in R, but (x, z) is not in R.

Example 3.3.19 The relation

R= {(a, a), (b, c), (c, b), (d, d)}

on X= {a, b, c, d} is not transitive. For example, (b, c) and (c, b) are in R, but (b, b) is not in R. Notice that in the digraph of this relation (see Figure 3.3.2) there are directed edges from b to c and from c to b, but there is no directed edge from b to b.

Relations can be used to order elements of a set. For example, the relation R defined on the set of integers by

(x, y)∈ R if x ≤ y

orders the integers. Notice that the relation R is reflexive, antisymmetric, and transitive.

Such relations are called partial orders.

Definition 3.3.20 A relation R on a set X is a partial order if R is reflexive, antisymmetric, and transitive.

Example 3.3.21 Since the relation R defined on the positive integers by (x, y)∈ R if x divides y is reflexive, antisymmetric, and transitive, R is a partial order.

If R is a partial order on a set X , the notation x y is sometimes used to indicate that (x, y)∈ R. This notation suggests that we are interpreting the relation as an ordering of the elements in X .

Suppose that R is a partial order on a set X . If x, y∈ X and either x  y or y  x, we say that x and y are comparable. If x, y∈ X and x  y and y  x, we say that x and y are incomparable. If every pair of elements in X is comparable, we call R a total order. The less than or equal to relation on the positive integers is a total order since, if x and y are integers, either x ≤ y or y ≤ x. The reason for the term “partial order” is that in general some elements in X may be incomparable. The “divides” relation on the positive integers (see Example 3.3.21) has both comparable and incomparable elements.

For example, 2 and 3 are incomparable (since 2 does not divide 3 and 3 does not divide 2), but 3 and 6 are comparable (since 3 divides 6).

One application of partial orders is to task scheduling.

Example 3.3.22 Task Scheduling

Consider the set T of tasks that must be completed in order to take an indoor flash picture with a particular camera.

1. Remove lens cap.

2. Focus camera.

3. Turn off safety lock.

4. Turn on flash unit.

5. Push photo button.

Some of these tasks must be done before others. For example, task 1 must be done before task 2. On the other hand, other tasks can be done in either order. For example, tasks 2 and 3 can be done in either order.

The relation R defined on T by

i R j if i = j or task i must be done before task j orders the tasks. We obtain

R= {(1, 1), (2, 2), (3, 3), (4, 4), (5, 5), (1, 2), (1, 5), (2, 5), (3, 5), (4, 5)}.

Since R is reflexive, antisymmetric, and transitive, it is a partial order. A solution to the problem of scheduling the tasks so that we can take a picture is a total ordering of the tasks consistent with the partial order. More precisely, we require a total ordering of the tasks

t1, t2, t3, t4, t5

such that if tiR tj, then i = j or tiprecedes tjin the list. Among the solutions are 1, 2, 3, 4, 5

and

3, 4, 1, 2, 5.

3.3Relations

155

Given a relation R from X to Y , we may define a relation from Y to X by reversing the order of each ordered pair in R. The inverse relation generalizes the inverse function.

The formal definition follows.

Definition 3.3.23 Let R be a relation from X to Y . The inverse of R, denoted R−1, is the relation from Y to X defined by

R−1= {(y, x) | (x, y) ∈ R}.

Example 3.3.24 If we define a relation R from X= {2, 3, 4} to Y = {3, 4, 5, 6, 7} by (x, y)∈ R if x divides y,

we obtain

R= {(2, 4), (2, 6), (3, 3), (3, 6), (4, 4)}.

The inverse of this relation is

R−1= {(4, 2), (6, 2), (3, 3), (6, 3), (4, 4)}.

In words, we might describe this relation as “is divisible by.”

If we have a relation R1 from X to Y and a relation R2 from Y to Z , we can form the composition of the relations by applying first relation R1and then relation R2. Composition of relations generalizes composition of functions. The formal definition follows.

Definition 3.3.25 Let R1be a relation from X to Y and R2be a relation from Y to Z . The composition of R1and R2, denoted R2◦ R1, is the relation from X to Z defined by

R2◦ R1= {(x, z) | (x, y) ∈ R1and ( y, z)∈ R2for some y∈ Y }.

Example 3.3.26 The composition of the relations

R1 = {(1, 2), (1, 6), (2, 4), (3, 4), (3, 6), (3, 8)}

and

R2= {(2, u), (4, s), (4, t), (6, t), (8, u)}

is

R2◦ R1= {(1, u), (1, t), (2, s), (2, t), (3, s), (3, t), (3, u)}.

For example, (1, u)∈ R2◦ R1because (1, 2)∈ R1and (2, u)∈ R2.

Example 3.3.27 Suppose that R and S are transitive relations on a set X . Determine whether each of R∪ S, R ∩ S, or R ◦ S must be transitive.

We try to prove each of the three statements. If we fail, we will try to determine where our proof fails and use this information to construct a counterexample.

To prove that R∪ S is transitive, we must show that if (x, y), (y, z) ∈ R ∪ S, then (x, z)∈ R ∪ S. Suppose that (x, y), (y, z) ∈ R ∪ S. If (x, y) and (y, z) happen to both be in R, we could use the fact that R is transitive to conclude that (x, z)∈ R and, therefore, (x, z)∈ R ∪ S. A similar argument shows that if (x, y) and (y, z) happen to both be in

S, then (x, z)∈ R ∪ S. But what if (x, y) ∈ R and (y, z) ∈ S? Now the fact that R and S are transitive seems to be of no help. We try to construct a counterexample in which R and S are transitive but there exist (x, y)∈ R and (y, z) ∈ S such that (x, z) ∈ R ∪ S.

We put (1, 2) in R and (2, 3) in S and ensure that (1, 3) is not in R∪ S. In fact, if R = {(1, 2)}, R is transitive. Similarly, if S = {(2, 3)}, S is transitive. We have our counterexample. We could write up our solution as follows.

We show that R∪ S need not be transitive. Let R = {(1, 2)} and S = {(2, 3)}.

Then R and S are transitive, but R∪ S is not transitive; (1, 2), (2, 3) ∈ R ∪ S, but (1, 3)∈ R ∪ S.

Next we turn our attention to R∩ S. To prove that R ∩ S is transitive, we must show that if (x, y), ( y, z)∈ R ∩ S, then (x, z) ∈ R ∩ S. Suppose that (x, y), (y, z) ∈ R ∩ S.

Then (x, y), ( y, z)∈ R. Since R is transitive, (x, z) ∈ R. Similarly, (x, y), (y, z) ∈ S, and since S is transitive, (x, z) ∈ S. Therefore (x, z) ∈ R ∩ S. We have proved that R∩ S is transitive.

Finally, consider R◦ S. To prove that R ◦ S is transitive, we must show that if (x, y), ( y, z) ∈ R ◦ S, then (x, z) ∈ R ◦ S. Suppose that (x, y), (y, z) ∈ R ◦ S. Then there exists a such that (x, a)∈ S and (a, y) ∈ R, and there exists b such that (y, b) ∈ S and (b, z) ∈ R. We now know that (a, y), (b, z) ∈ R, but the fact that R is transitive does not allow us to infer anything from (a, y), (b, z)∈ R. A similar statement applies to S. We try to construct a counterexample in which R and S are transitive but R◦ S is not transitive.

We will arrange for (1, 2), (2, 3)∈ R ◦ S, but (1, 3) /∈ R ◦ S. In order for (1, 2) ∈ R◦ S, we must have (1, a) ∈ S and (a, 2) ∈ R, for some a. We put (1, 5) in S and (5, 2) in R. (We chose a to be a number different from 1, 2, or 3 to avoid a clash with those numbers. Any number different from 1, 2, 3 would do.) So far, so good! In order for (2, 3) ∈ R ◦ S, we must have (2, b) ∈ S and (b, 3) ∈ R, for some b. We put (2, 6) in S and (6, 3) in R. (Again, we chose b= 6 to avoid a clash with the other numbers already chosen.) Now R= {(5, 2), (6, 3)} and S = {(1, 5), (2, 6)}. Notice that R and S are transitive. We have our counterexample. We could write up our solution as follows.

We show that R◦ S need not be transitive. Let R = {(5, 2), (6, 3)} and S = {(1, 5), (2, 6)}. Then R and S are transitive. Now R◦S = {(1, 2), (2, 3)} is not transitive;

(1, 2), (2, 3)∈ R ◦ S, but (1, 3) ∈ R ◦ S.

Problem-Solving Tips

To prove that a relation is reflexive, show that (x, x)∈ R for every x ∈ X. In words, a relation is reflexive if every element in X is related to itself. Given an arrow diagram, the relation is reflexive if there is a loop at every vertex.

To prove that a relation R on a set X is not reflexive, find x ∈ X such that (x, x)∈ R. Given an arrow diagram, the relation is not reflexive if some vertex has no loop.

To prove that a relation R on a set X is symmetric, show that for all x, y∈ X, if (x, y)∈ R, then (y, x) ∈ R. In words, a relation is symmetric if whenever x is re-lated to y, then y is rere-lated to x. Given an arrow diagram, the relation is symmetric if whenever there is a directed edge from x to y, there is also a directed edge from y to x.

To prove that a relation R on a set X is not symmetric, find x, y ∈ X such that (x, y)∈ R and (y, x) ∈ R. Given an arrow diagram, the relation is not symmetric if there are two distinct vertices x and y with a directed edge from x to y but no directed edge from y to x.

To prove that a relation R on a set X is antisymmetric, show that for all x, y∈ X, if (x, y)∈ R and (y, x) ∈ R, then x = y. In words, a relation is antisymmetric if whenever x is related to y and y is related to x, then x = y. An equivalent characterization of

3.3Relations

157

“antisymmetric” can also be used: Show that for all x, y∈ X, if x = y, then (x, y) ∈ R or ( y, x)∈ R. Given an arrow diagram, the relation is antisymmetric if between any two distinct vertices there is at most one directed edge. Note that “not symmetric” is not necessarily the same as “antisymmetric.”

To prove that a relation R on a set X is not antisymmetric, find x, y∈ X, x = y, such that (x, y)∈ R and (y, x) ∈ R. Given an arrow diagram, the relation is not antisymmetric if there are two distinct vertices x and y and two directed edges, one from x to y and the other from y to x.

To prove that a relation R on a set X is transitive, show that for all x, y, z∈ X, if (x, y) and ( y, z) are in R, then (x, z) is in R. [It suffices to check ordered pairs (x, y) and ( y, z) with x = y and y = z.] In words, a relation is transitive if whenever x is related to y and y is related to z, then x is related to z. Given an arrow diagram, the relation is transitive if whenever there are directed edges from x to y and from y to z, there is also a directed edge from x to z.

To prove that a relation R on a set X is not transitive, find x, y, z∈ X such that (x, y) and ( y, z) are in R, but (x, z) is not in R. Given an arrow diagram, the relation is not transitive if there are three distinct vertices x, y, z and directed edges from x to y and from y to z, but no directed edge from x to z.

A partial order is a relation that is reflexive, antisymmetric, and transitive.

The inverse R−1of the relation R consists of the elements ( y, x), where (x, y)∈ R.

In words, x is related to y in R if and only if y is related to x in R−1.

If R1is a relation from X to Y and R2is a relation from Y to Z , the composition of R1and R2, denoted R2◦ R1, is the relation from X to Z defined by

R2◦ R1= {(x, z) | (x, y) ∈ R1and ( y, z)∈ R2for some y∈ Y }.

To compute the composition, find all pairs of the form (x, y)∈ R1and ( y, z)∈ R2; then put (x, z) in R2◦ R1.

Section Review Exercises

1. What is a binary relation from X to Y ? 2. What is the digraph of a binary relation?

3. Define reflexive relation. Give an example of a reflexive relation. Give an example of a relation that is not reflexive.

4. Define symmetric relation. Give an example of a symmetric relation. Give an example of a relation that is not symmetric.

4. Define symmetric relation. Give an example of a symmetric relation. Give an example of a relation that is not symmetric.