Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 CMSC 250 Discrete Structures CMSC 250 Lecture 41 May 7, 2008.

Similar presentations


Presentation on theme: "1 CMSC 250 Discrete Structures CMSC 250 Lecture 41 May 7, 2008."— Presentation transcript:

1 1 CMSC 250 Discrete Structures CMSC 250 Lecture 41 May 7, 2008

2 2 CMSC 250 Chapter 10, Relations

3 3 CMSC 250 Definitions l On sets x  X y  Y R  X  Y A relation on x 1, x 2, …, x n is a subset of x 1  x 2  …  x n l Binary relations xRy

4 4 CMSC 250 Example l "Less than" relation from A = {0,1,2} to B = {1,2,3} l Use traditional notation 0 < 1, 0 < 2, 0 < 3, 1 < 2, 1 < 3, 2 < 3 1 < 1, 2 < 1, 2 < 2 l Or use set notation A  B = {(0,1),(0,2),(0,3),(1,1),(1,2),(1,3),(2,1),(2,2),(2,3)} R = {(0,1),(0,2),(0,3), (1,2),(1,3), (2,3)} l Or use arrow diagrams

5 5 CMSC 250 Formal definition l (Binary) relation from A to B where x  A, y  B, (x,y)  A  B and R  A  B xRy  (x,y)  R l Finite example: A = {1,2}, B = {1,2,3}, aRb  a < b l Infinite example: A = Z and B = Z aRb  a  b  Z even

6 6 CMSC 250 Properties of relations Reflexive Symmetric Transitive

7 7 CMSC 250 Equivalence relations l Partition the elements: any elements “related” are in the same partition l Equivalence relations are –reflexive, –symmetric, and –transitive l Partitions are called equivalence classes –[a] = the equivalence class containing a –[a] = {x  A | xRa}

8 8 CMSC 250 Examples l R: X  X X = {a,b,c,d,e,f} R = {(a,a),(b,b),(c,c),(d,d),(e,e),(f,f),(a,e),(a,d),(d,a),(d,e), (e,a),(e,d),(b,f),(f,b)} l Lemma 10.3.3: If A is a set, R is an equivalence relation on A, and x and y are elements of A, then either [x]  [y] =  or [x] = [y]

9 9 CMSC 250 Discrete Structures CMSC 250 Lecture 43 May 12, 2008

10 10 CMSC 250 Proving properties on infinite sets l Show R is an equivalence relation, where (m, n)  R if m  n (mod 2) (where m, n  Z) –show this relation is: reflexive symmetric transitive

11 11 CMSC 250 The matrix representation of a relation l M R = [m ij ] m i j = 1 iff (i,j)  R and 0 iff (i,j)  R l Example: R : {1,2,3}  {1,2} R = {(2,1),(3,1),(3,2)}

12 12 CMSC 250 Other properties Reflexive Irreflexive Symmetric Antisymmetric Asymmetric Non-symmetric Transitive

13 13 CMSC 250 Partial order relation l R is a partial order relation if and only if R is reflexive, antisymmetric and transitive l Partial order set (POSET) (S,R) = R is a partial order relation on set S l Examples – (Z,  ) – (Z +,  ) (note: “  ” symbolizes “divides”)

14 14 CMSC 250 Total ordering l When all pairs from a set are “comparable” it is called a total ordering l a and b are comparable if and only if a R b or b R a l a and b are non-comparable if and only if a R b and b R a

15 15 CMSC 250 The inverse of a relation l R: A  B R = {(x,y)  A  B | xRy} l R  1 : B  A R  1 = {(y,x)  B  A | (x,y)  R} l D: {1,2}  {2,3,4} D = {(1,2),(2,3),(2,4)} D  1 = ? l S = {(x,y)  R  R | y = 2  |x|} S  1 = ?

16 16 CMSC 250 The complement of a relation l R: A  B R = {(x,y)  A  B | xRy} l R ' : A  B R' = {(x,y)  A  B | (x,y)  R} l D: {1,2}  {2,3,4} D = {(1,2),(2,3),(2,4)} D' = ?

17 17 CMSC 250 Closures over the properties l Reflexive closure l Symmetric closure l Transitive closure R xc has property x R  R xc R xc is the minimal addition to R (if S is any other relation with property x that contains R, then R xc  S)

18 18 CMSC 250 Union, intersection, and difference l R: A  B and S: A  B

19 19 CMSC 250 Composition l R: A  B and S: B  C


Download ppt "1 CMSC 250 Discrete Structures CMSC 250 Lecture 41 May 7, 2008."

Similar presentations


Ads by Google