Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 RELATIONS Learning outcomes Students are able to: a. determine the properties of relations – reflexive, symmetric, transitive, and antisymmetric b. determine.

Similar presentations


Presentation on theme: "1 RELATIONS Learning outcomes Students are able to: a. determine the properties of relations – reflexive, symmetric, transitive, and antisymmetric b. determine."— Presentation transcript:

1 1 RELATIONS Learning outcomes Students are able to: a. determine the properties of relations – reflexive, symmetric, transitive, and antisymmetric b. determine equivalence and partial order relations c. represent relations using matrix and graph.

2 2 Contents Properties of relations Matrix and graph representation of relations Equivalence relations Partial order relations

3 313 January 2016Relations3 The most basic relation is “=” (e.g. x = y) Generally x R y  TRUE or FALSE –R(x,y) is a more generic representation –R is a binary relation between elements of some set A to some set B, where x  A and y  B

4 413 January 2016Relations4 Binary relations: xRy On sets x  X y  Y R  X  Y Example: “ less than ” relation from A={0,1,2} to B={1,2,3} Use traditional notation 0 < 1, 0 < 2, 0 < 3, 1 < 2, 1 < 3, 2 < 3 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)} Or use Arrow Diagrams

5 513 January 2016Relations5 Formal Definition (Binary) relation from A to B where x  A, y  B, (x,y)  A  B and R  A  B xRy  (x,y)  R Finite example: A={1,2}, B={1,2,3} Infinite example: A = Z (set of integers) and B = Z aRb  a-b  Z even

6 613 January 2016Relations6 Example Let A = {2,3}, B = {1,3,6} Define a relation R from A to B such that: xRy  x – y is odd How could this explicitly be represented as tuples? –R = {(2,1),(2,3),(3,6)} What if A and B were the set of all integers? –R = {(x,y)  Z  Z |  k  Z such that x – y = 2k + 1}

7 713 January 2016Relations7 Properties of Relations Reflexive Symmetric Transitive

8 8 Example Let A = {1,2,3,4}. R 1 ={(1,1),(1,2),(2,2),(2,3),(3,3),(4,4)} R 1 is reflexive. R 2 = {(1,1),(2,2),(3,3)}. R 2 is not reflexive.

9 9 Example Let A = {1,2,3}. R 1 ={(1,2),(2,1),(1,3),(3,1)} R 1 is symmetric. R 2 = {(1,1),(2,2),(3,3),(2,3)}. R 2 is not symmetric because (3,2) ε R 2.

10 10 Example (transitive) Let A = {1,2,3,4}. R = {(2,1),(3,1),(3,2),(4,1),(4,2),(4,3). R is transitive because (3,2) & (2,1) → ( 3,1) (4,2) & (2,1) → (4,1) (4,3) & (3,1) → (4,1) (4,3) & (3,2) → (4,2)

11 1113 January 2016Relations11 Example Define a relation of A called R –A = {2,3,4,5,6,7,8,9} –R = {(4,4),(4,7),(7,4),(7,7),(2,2),(3,3),(3,6),(3,9), (6,6),(6,3),(6,9),(9,9),(9,3),(9,6)} Draw the arrow diagram Is R  Reflexive? No.  Symmetric? Yes  Transitive? Yes

12 1213 January 2016Relations12 Example A = {0,1,2,3} R over A = {(0,0),(0,1),(0,3),(1,0), (1,1),(2,2),(3,0),(3,3)} Is R –Reflexive? Yes. –Symmetric? Yes. –Transitive? No. (1,0),(0,3) ε R but (1,3) ε R

13 13 Question ?????

14 14 Proving Properties on Infinite Sets - “less than” relation Define a relation R on R (the set of all real numbers): For all x, y ε R, x R y ↔ x < y Is R reflexive? symmetric? transitive? R is reflexive iff  x ε R, x R x. By definition of R, this means x < x, for all x ε R. But this is false. Hence, R is not reflexive.

15 15 “less than” relation R is not symmetric. R is symmetric iff  x,y ε R, if x R y then y R x. By definition of R. this means that  x,y ε R, if x x. But this is false. R is transitive.

16 1613 January 2016Relations16 Congruence Modulo 3 Define a relation R on Z: for all m,n  Z, m R n ↔ 3 | (m – n) R is called congruence modulo 3 Is R reflexive? Is R symmetric? Is R transitive?

17 17 Properties of Congruence modulo 3 R is reflexive iff for all m in Z, m R m. By definition of R, this means 3 | m – m. or 3|0. This is true since 0 = 0. 3 R is symmetric iff for all m,n in Z, m R n then n R m. By definition of R, this means if 3|(m – n) then 3|(n – m). This is true. m – n = 3k, for some integer k. n – m = - (m – n) = 3(-k). Hence 3|(n – m).

18 18 Properties of Congruence modulo 3 Is R transitive? It is necessary to show that For all m,n ε Z, if m R n and n R p then m R p. m – n = 3k for some k. n – p = 3l for some l. m – p = (m – n) + (n – p) = 3k + 3l = 3(k + l). Hence 3|(m – p). Therefore, R is transitive.

19 1913 January 2016Relations19 Exercise Define R(x,y) R: Z +  Z + to be {(x,y)  Z +  Z + | x|y} Prove whether or not this is: –Reflexive? –Symmetric? –Transitive?

20 2013 January 2016Relations20 Matrix Representation of a Relation M R = [m ij ] –m ij ={1 iff (i,j)  R and 0 iff (i,j)  R} Example: –R : {1,2,3}  {1,2} R = {(2,1),(3,1),(3,2)}

21 21 Example Example: A = {1,2,3,4} B = {w,x,y,z} R = {(1,x),(2,x),(3,y),(3,z)} w x y z 1 0 1 0 0 M R = 2 0 1 0 0 zero-one matrix 3 0 0 1 1 4 0 0 0 0

22 22 Graph Representation of a Relation A = {1,2,3,4} R = {(1,1),(1,2),(2,3),(3,2),(3,3), (3,4),(4,2)}

23 2313 January 2016Relations23 Union, Intersection, Difference and Composition of relations R: A  B and S: A  B R: A  B and S: B  C

24 24 Composition of Relations Example A = {1,2,3,4} B = {w,x,y,z} C={5,6,7} R 1 : A  B = {(1,x),(2,x),(3,y),(3,z)} R 2 : B  C = {(w,5),(x,6)} R 1 o R 2 = {(1,6),(2,6)}

25 2513 January 2016Relations25 Example - application Let ID = set of student IDs Let Course = set of courses offered Define relation Summer2007 {(x,y)  ID  Course | student x is registered for course y} Can we do this? Relational databases …

26 26 Databases ID Course 12345 Structure Discrete 45678 Java Programming … …

27 2713 January 2016Relations27 Equivalence Relations Any binary relation that is: –Reflexive –Symmetric –Transitive Example: A = {1,2,3} R = {(1,1),(2,2),(2,3),(3,2),(3,3)} R is reflexive, symmetric and transitive. Therefore, R is an equivalence relation. Congruence modulo 3 is an equivalence.

28 28 Antisymmetric relation Let R be a relation on a set A. R is antisymmetric iff for all a and b in A, if a R b and b R a then a = b. In other words, a relation is antisymmetric iff there are no pairs of distinct elements a and b with a related to b and b related to a. Let A = {0,1,2} R 1 = {(0,2),(1,2),(2,0)}. R 1 is not antisymmetric R 2 = {(0,0),(0,1),(0,2),(1,1),(1,2)}. R 2 is symmetric.

29 29 Example A = {1,2,3} R = {(1,2),(2,1),(2,3)} R is not symmetric, (3,2) ε R R is also not antisymmetric because (1,2),(2,1) ε R. S = {(1,1),(2,2)} S is both symmetric and antisymmetric.

30 3013 January 2016Relations30 Example Let R 1 be the divides relation on Z + Let R 2 be the divides relation on Z Is R 1 antisymmetric? Prove or give counterexample. a R 1 b and b R 1 a  a = b a R 1 b means a|b → b = k 1 a b R 1 a means b|a → a = k 2 b It follows that, b = k 1 a = k 1 (k 2 b) = k 1 k 2 b Thus, k 1 = k 2 = 1. Hence a = b. Is R 2 antisymmetric? Prove or give counterexample. Counterexample (a = 2, b = -2) R 2 is not antisymmetric

31 3113 January 2016Relations31 Partial Order Relation R is a Partial Order Relation if and only if –R is Reflexive, Antisymmetric and Transitive Partial Order Set (POSET) (S,R) = R is a partial order relation on set S Examples –(Z,  ) –(Z +,|){note: | symbolizes divides}

32 32 Activity E is the congruence modulo 2 relation on Z: For all m, n ε Z, m E n ↔ 2|(m-n). Determine whether E is reflexive, symmetric, transitive, or none of these.

33 33 Summary What you have learned: - properties of relations: reflexive, symmetric, transitive, asymmetric - representation of relations - equivalence relations - partial order relations

34 34 End Thank you


Download ppt "1 RELATIONS Learning outcomes Students are able to: a. determine the properties of relations – reflexive, symmetric, transitive, and antisymmetric b. determine."

Similar presentations


Ads by Google