340 likes | 351 Views
Chap6 Relations. Def 1: Let A and B be sets. A binary relation from A to B is a subset of A x B a R b: (a,b) R a R b: (a,b) R Figure1 Def 2: A relation on the set A is a relation from A to A Example 4
E N D
Chap6 Relations Def 1: Let A and B be sets. A binary relation from A to B is a subset of A x B a R b: (a,b) R a R b: (a,b) R Figure1 Def 2:A relation on the set A is a relation from A to A Example 4 Example 6 ( How many “possible“ relations…)
Chap6 Relations Def 3: A relation R on a set A is called reflexive if (a,a) R for every element a A . Example 7
Chap6 Relations Def 4:A relation R on a set A is called symmetric if (b,a) R whenever (a,b) R , for a,b A. A relation R on a set A such that (a,b) R and (b ,a) R only if a=b , for a,b A , is called antisymmetric . Example 10 a relation can be both or neither ex both : {(1,1)} neither : { (1,2), (2,3),(3,2) }
Chap6 Relations Def 5: A relation R on a set A is called transitive if whenever (a,b) R and (b,c) R ,then (a,c) R , for a,b,c A. Example 13 Example 16
Chap6 Relations Def 6:Let R be arelation from a set A to a set B and S be a relation from B to a set C . The composite of R and S is the relation consisting of ordered pairs (a,c) , where a A ,cC , and for which there exists an element b B such that (a,b) R and (b,c) S. We denote the composite of R and S by S R Example 19
Chap6 Relations Def 7 : Let R be arelation on a set A . The power Rn , n=1,2,3,…, are defined inductively by R1=R and R n+1=Rn R Example 20 1 2 3 4
Theorem1:The relation R on a set A is transitive if and only if Rn R , for n=1,2,3,….. “ if “ Rn R , R2 R if ( a,b) R and ( b,c ) R ,( a,c ) R2 R2 R => (a,c) R => R is transitive
Chap6 Relations “ only if “ by mathematical induction n=1,trivial assume Rk R to show Rk+1 R assume (a,b) Rk+1 since Rk+1 = Rk R there exist x A such that (a,x) R and ( x,b) Rk since Rk R , ( x,b) R ( a,b) R Rk+1 R
Chap6 Representing Relations Using Digraphs Def 1: -Example 7 -determine whether a relation is reflexive , symmetric ,antisymmetric and transitive -Example 10
Chap6 Closure of Relation • R= { (1,1), (1,2) , (2,1), (3,2) } on A = {1,2,3}is not reflexive R’ = { (1,1), (1,2) , (2,1), (3,2) , (2,2), (3,3)} R R’ , R’ is reflexive , R’ , where is any reflexive relation and R R’ is the reflexive closure of R R’ = R , ={(a,a)| a A} is the diagonal relation on A Example 1 R R R
Chap6 Closure of Relation • R={ (1,1), (1,2) , (2,2), (2,3) , (3,1), (3,2)} on {1,2,3} R’={ (1,1), (1,2) ,(2,1), (2,2), (2,3) ,(3,1), (3,2),(1,3)} R R’ , R’ is symmetric , R’ , where is any symmetric relation and R R’ is the symmetric closure of R R’=R R-1, R-1={(b,a) | ( a,b) R, a=b} Example 2 R R R
Chap6 Closure of Relation -R= { (1,3), (1,4) , (2,1) , (3,2)} on {1,2,3,4} 1 2 1 2 4 3 4 3 add (2,4), (3,1) ,(2,3) ,(1,2) to become transitive?
Chap6 Relations Def 1: path ,cycle Example 3 Theorem 1 Let R be a relation on a set A .There is a path of length n from a to b if and only if ( a,b) Rn
Chap6 Relations Def 2: Let R be a relation on a set A . The connectivity relation R* consists of the pairs (a,b) such that there is a path between a and b in R R* = Rn Example 4 a Rb if a has met b R2contains ( a,b) if c,( a,c)R and ( c,b) R Rn contains ( a,b) if x1,x2,..,x n-1 ,( a,x1)R , (x1,x2) R ,…(x n-1,b) R R*, dose R* contain ( you, Mongolis presidat ) ? n=1
Chap6 Relations Theorem 2 The transitive closure of a relation R equal the connectivity relation R* Proof: R R* have to show : 1. R* is transitive 2. R* where is transitive and R R R R
Chap6 Relations • If ( a,b) R* and (b,c) R* ,then there are paths from a to b and from b to c in R ( a,c) R* R* is transitive b c a a
Chap6 Relations 2. is transitive and R to prove R* nis also transitive and n since * = kandk , * since R , R* *(anypath in R is also a path in) R* * R* = R R2 R3 ….. Rn R R R R R R R R R R R R k=1 R R R R R
Chap6 Relations xj+1 a=x1 x2 xi-1 xi =xj b=xm xi+1 xj-1 xj-2 m>n
Chap6 Equivalence Relations Def 1 :A relation on a set A is an equivalence relation if it is reflexive, symmetric, and transitive • Two elements related by an equivalence relation are called equivalent. Example 1 R: relation on the set of strings of English letters such that aRb iff l (a)=l (b), where l(x) is the length of the string X. Is R an equivalence relation ?
Chap6 Equivalence Relations l(a) =l(a) : reflexive Suppose a R b , l(a)= l(b) , then since l(b)=l(a), b R a : symmetric suppose a R b and b R c , l(a)= l(b) and l(b)=l(c) , l(a)=l(c), a R c : transitive
Chap6 Equivalence Relations Example 2 R: relation on the set of real numbers, aRb iff a-b is an integer . transitive : aRb and bRc, a - b and b-c are integers a-c=(a-b)+(b-c) is an integer Example 3Congruence Modulo m show R={(a,b)|ab(mod m)} is an equivalence relation on the set of integers , m ﹥1
Chap6 Equivalence Relations a b ( mod m ) iff m divides a – b – a – a = 0 is divisible by m – a – b is divisible by m, a – b = km b – a = ( – k )m, b a ( mod m ) – a b ( mod m ) and b c ( mod m ) m divides a – b and b – c a – b = km and b – c = lm a – c = ( a – b ) + ( b – c ) = ( k+l )m
Chap6 Equivalence Relations Equivalence classes A: set of students at NDHU, who graduated from high school R on A:{(x,y)|x and y graduated from same high school } given a student x, we can form a set of all students equivalentto x with respect to R ; This set is an equivalence class of R, denoted [x]R [x]R = { s | ( x , s ) R }
Chap6 Equivalence Relations Example 6 What are the equivalence classes of 0 and 1 for congruence modulo 4 ? 0 : a 0 (mod 4), integers divisible by 4 [0]= { …,-8 ,-4, 0, 4, 8,…} 1: a 1 (mod 4) a-1 divisible by 4 integers having a remained 1 when divided by 4
Chap6 Equivalence Relations [1]= { …,-7 ,-3, 1, 5, 9,…} The equivalence classes of the relation congruence modulo m are congruence classes modulo m [a]m={…, a-2m, a-m, a, a+m, a+2m,…} x a (mod m) x – a = km x = a + km
Chap6 Equivalence Relations Partitions A: Students majoring in exactly one subject R on A:{(x ,y)|x and y have same major } R splits all students in A into a collections of disjoint subsets, where each subset contains students with a specified major
Chap6 Equivalence Relations Theorem 1. Let R be an equivalence relation on a set A. The following statements are equivalent: ( i ) a R b (ii ) [ a ] = [ b ] (iii) [ a ] [ b ]
Chap6 Equivalence Relations Proof: (i) implies (ii) a R b, prove [a]=[b], to show [a] [b] and [b] [a] suppose c [a], to show c [b] a R c, since a R b, b R a b R c c [b] (ii) implies (iii) [a] is nonempty, [a][b]
Chap6 Equivalence Relations (iii)implies (i) [a][b], there is an element c , c [a] and c [b] a R c and b R c a R b We have shown (i) implies (ii), (ii) implies (iii) , and (iii) implies (i) . (i) , (ii) , (iii) are equivalent
Chap6 Equivalence Relations a partition of a set S is a collection of disjoint nonempty subsets of S that have S as their union the collection of subsets Ai, iI forms a partition of S iff Ai for iI Ai Aj , when ij, and Ai= S iI Figure 1
Chap6 Equivalence Relations an equivalent relation partitions a set [ a ]R= A aA [a]R [b]R= when [a]R [b]R
Chap6 Equivalence Relations Theorem 2 Let R be an equivalence on a set S. Then the equivalence classes of R form a partition of S. Conversely, given a partition {Ai | iI }of the set S, there is an equivalence relation R that has the set Ai, iI, as its equivalence classes
Chap6 Equivalence Relations There are m different congruence classes modulo m , corresponding to the m different remainders possible when an integer is divided by m [ 0 ]m, [ 1 ]m,…, [ m-1]m
Chap6 Equivalence Relations Example 8 What are the sets in the partition of the integers arising from congruence modulo 4 ? [ 0 ]4={… , -8 , -4 , 0 , 4 , 8 , … } [ 1 ]4={… , -7 , -3 , 1 , 5 , 9 , … } [ 2 ]4={… , -6 , -2 , 2 , 6 , 10 , … } [ 3 ]4={… , -5 , -1 , 3 , 7 , 11 , … }