Presentation is loading. Please wait.

Presentation is loading. Please wait.

Relations 1.Relations on a Set. 2.Properties of Relations. 3.Closures of Relations. 4.Equivalence of Relations. 5.Partial Ordering. 6.Hasse Diagram.

Similar presentations


Presentation on theme: "Relations 1.Relations on a Set. 2.Properties of Relations. 3.Closures of Relations. 4.Equivalence of Relations. 5.Partial Ordering. 6.Hasse Diagram."— Presentation transcript:

1 Relations 1.Relations on a Set. 2.Properties of Relations. 3.Closures of Relations. 4.Equivalence of Relations. 5.Partial Ordering. 6.Hasse Diagram

2 Definition: A relation on the set A is a relation from A to A. Example: Let A={1,2,3,4}. Find the relation R={(a,b) :a divides b}. Solution: Since (a,b) ϵ R if and only if a divides b. If a=1 and b=1 then 1 | 1  (1,1) R If a=1 and b=2 then 1 | 2  (1,2) R (because, 2= 1 * c) If a=1 and b=3 then 1 | 3  (1,3) R If a=1 and b=4 then 1 | 4  (1,4) R If a=2 and b=1 then 2 ∤ 1  (2,1) ∉ R If a=2 and b=2 then 2 | 2  (2,2) R If a=2 and b=3 then 2 ∤ 3  (2,3) ∉ R Relation on a set

3 If a=2 and b=4 then 2 | 4  (2,4) ) ϵ R (3,3) R and (4,4) R. Therefore, R={(1,1),(1,2), (1,3), (1,4), (2,2), (2,4), (3,3), (4,4)}

4 Properties of Relations There are several properties that are used to classify relations on a set. Reflexive SymmetricAntisymmetricTransitive

5 Definition: A relation on the set A is called reflexive if (a,a) ϵ R for every element a A. Example: Consider the following relations on A= {1,2,3,4} R1={(1,1),(1,2),(2,1),(2,2),(3,4),(4,1),(4,4)}, R2={(1,1),(1,2),(2,1)}, R3={(1,1),(1,2),(1,4),(2,1), (2,2),(3,3),(4,1), (4,4)}, R4={(2,1),(3,1),(3,2),(4,1),(4,2),(4,3)}, R5={(1,1),(1,2), (1,3),(1,4), (2,2),(2,3),(2,4),(3,3),(3,4),(4,4)}, R6={(3,4)} Which of those are reflexive? Solution: R1 is not reflexive because, (3,3) ∉ R1 R2 is not reflexive because, (2,2) ∉ R2, (3,3) ∉ R2 and (4,4) ∉ R2. R3 is reflexive, because that (1,1), (2,2), (3,3) and (4,4) in R3. R4 is not reflexive because, (1,1), (2,2), (3,3) and (4,4) ∉ R4. R5 is reflexive, because that (1,1), (2,2), (3,3) and (4,4) in R5. R6 is not reflexive because, (1,1), (2,2), (3,3) and (4,4) ∉ R6.

6 Definition: A relation on the set A is called symmetric if (b,a) ϵ R whenever (a,b) R, for all a, b A. Example: Which of those are symmetric? R1={(1,1),(1,2),(2,1),(2,2),(3,4),(4,1),(4,4)}, R1 is not symmetric because, (3,4) ϵ R1 and (4,3) ∉ R1. R2={(1,1),(1,2),(2,1)} R2 is symmetric because, (1,2) R2 and (2,1) R2. R3={(1,1),(1,2),(1,4),(2,1), (2,2),(3,3),(4,1), (4,4)}. R3 is symmetric, because that (1,2), (2,1) in R3, (1,4), (4,1) in R3.

7 Definition: A relation on the set A is called antisymmetric if (a,b) ϵ R and (b,a) R then a = b, for all a, b A,. Example: Which of those are antisymmetric? Solution: R1={(1,1),(1,2),(2,1),(2,2),(3,4),(4,1),(4,4)}, R1 is not antisymmetric because, (1,2) R1 and (2,1) R1, but 1≠2 R2={(1,1),(1,2),(2,1)} R2 is not antisymmetric because, (1,2) R2 and (2,1) R2, but 1≠2 R3={(1,1),(1,2),(1,4),(2,1), (2,2),(3,3),(4,1), (4,4)}. R3 is not antisymmetric because, (1,2) R2 and (2,1) R2, but 1≠2 By similar way, R4, R5 and R6 are antisymmetric.

8 Definition: A relation R on a set A is called transitive if whenever (a,b) R and (b,c) R then (a,c) R for all a,b,c A. Example: Which of those are transitive? R1={(1,1),(1,2),(2,1),(2,2),(3,4),(4,1),(4,4)}, R1 is not transitive because, (3,4) ϵ R1 and (4,1)R1, but (3,1) ∉ R1. R2={(1,1),(1,2),(2,1)} R2 is not transitive because, (2,1) R2 and (1,2) R2, but (2,2) ∉ R2. R3={(1,1),(1,2),(1,4),(2,1), (2,2),(3,3),(4,1), (4,4)}. R3 is not transitive, because that (2,1) R2 and (1,4) R2, but (2,4) ∉ R3.

9 Example: Which of those are transitive? The relations R4, R5 are transitive, because in each case it can be verify that if (a,b) and (b,c) belongs to relation, then (a,c) also does. R4={(2,1),(3,1),(3,2),(4,1),(4,2),(4,3)}, R5={(1,1),(1,2), (1,3),(1,4), (2,2),(2,3),(2,4),(3,3),(3,4),(4,4)}, For instance R4 is transitive because (3,2) and (2,1), (3,1) (4,2) and (2,1), (4,1) (4,3) and (3,1), (4,1) (4,3) and (3,2), (4,2) Similarly it can be verified for R5

10 Properties of a relation A relation R on a set A is reflextive: (x,x)  R for all x  A. symmetric: for all x,y  A, if (x,y)  R then (y,x)  R. antisymmetric: all x,y  A, if (x,y)  R and x  y, then (y,x)  R. if (x,y) ϵ R and (y,x) R then a = b. transitive: for all x,y,z  A, if (x,y)  R and (y,z)  R, then (x,z)  R.

11 Properties of Relations Are the following relations on {1, 2, 3, 4} reflexive? R = {(1, 1), (1, 2), (2, 3), (3, 3), (4, 4)} No. R = {(1, 1), (2, 2), (2, 3), (3, 3), (4, 4)} Yes. R = {(1, 1), (2, 2), (3, 3)} No.

12 Properties of Relations Are the following relations on {1, 2, 3, 4} symmetric or antisymmetric? R = {(1, 1), (1, 2), (2, 1), (3, 3), (4, 4)}symmetric R = {(1, 1)}sym. and antisym. R = {(1, 3), (3, 2), (2, 1)}antisym. R = {(4, 4), (3, 3), (1, 4)}antisym.

13 Properties of Relations Are the following relations on {1, 2, 3, 4} transitive? R = {(1, 1), (1, 2), (2, 2), (2, 1), (3, 3)}Yes. R = {(1, 3), (3, 2), (2, 1)}No. R = {(2, 4), (4, 3), (2, 3), (4, 1)}No.

14 Closures of Relations Definition: Let R be a relation on a set A. R may or may not have some property of P (reflexivity, symmetry, or transitivity). If there is a relation S with property P containing R such that S is a subset of every relation with property P containing R, then S is called the closure of R with respect to P

15 Given a relation R on a set A, the reflexive closure of R can be formed by adding to R all pairs of the form (a,a) with a A, not already in R. R ∪ △, where △ ={(a,a): a A} Example: Find the reflexive closure of the relation R={(1,1), (1,2), (2,1), (3,2)} on the set A= {1, 2, 3}. Solution: since R is not reflexive. We can make it reflexive by adding (2,2) and (3,3) to R.

16 Given a relation R on a set A, the reflexive closure of R can be formed by adding to R all pairs of the form (a,a) with a A, not already in R. R ∪ △, where △ ={(a,a): a A} Example: Find the reflexive closure of the relation R={(1,1), (1,2), (2,1), (3,2)} on the set A= {1, 2, 3}. Solution: since R is not reflexive. We can make it reflexive by adding (2,2) and (3,3) to R.

17 Given a relation R on a set A, the symmetric closure of R can be formed by adding to R all pairs of the form (b,a) that are not already present in R, where (a,b) in R. Example: Find the symmetric closure of the relation R={(1,1), (1,2), (2,1), (3,2)} on the set A= {1, 2, 3}. Solution: since R is not symmetric. We can make it symmetric by adding (2,3) to R. The symmetric closure of a relation can be constructed by taking the union of a relation with its inverse; that is, R U R -1 is the symmetric closure of R, where R -1 ={(b,a) | (a,b) R}.

18 Given a relation R on a set A, the transitive closure of R can be formed by adding to R all pairs of the form (a,c), where (a,b) and (b,c) are already in the relation. Example: Find the transitive closure of the relation R={(1,1), (1,2), (2,1), (3,2)} on the set A= {1, 2, 3}. Solution: since R is not transitive. We can make it transitive by adding (2,2), (3,1) to R.

19 Relations19 Closures of Relations Let A = {1, 2, 3} and R = {(1,1), (1,2), (1,3), (3,1), (2,3)}. –This is not reflexive, transitive or symmetric. –The closure of R with respect to reflexivity is {(1,1),(1,2),(1,3), (3,1), (2,3), (2,2), (3,3)} and it contains . –The closure of R with respect to symmetry is {(1,1), (1,2), (1,3), (3,1), (2,3), (2,1), (3,2)}. –The closure of R with respect to transitivity is {(1,1), (1,2), (1,3), (3,1), (2,3), (3,2), (3,3), (2,1), (2,2)}.

20 Relations20 Exercise: Closures of Relations Find the reflexive, symmetric and transitive closure of the relation {(a,a), (b,b), (c,c), (a,c), (a,d), (b,d), (c,a), (d,a)} on the set A = {a, b, c, d}

21 Equivalence Relations Definition: A relation on a set A is called an equivalence relation if it is reflexive, symmetric and transitive. ♦ Two elements a and b that are related by equivalence relation are called equivalent. ♦ The notation a ~ b is often used to denote that a and b are equivalent elements with respect to a particular equivalence relation.

22 Relations22 Equivalence Relation Examples: –On N, x  R y  x + y is even. –On {1, 2, 3}, R 

23 Example: Let m be a positive integer with m > 1. Show that the relation R={(a,b) | a ≡ b (mod m)} is the equivalence relation on set of integers. Solution: a ≡ b (mod m) if and only if m is divided by (a -b.) We will prove that R is reflexive, symmetric and transitive. 1)R is reflexive ( (a,a) in R), a ≡ a mod m because m divides a-a=0, 0 is divided by m. Therefore, (a,a) in R. 2)R is symmetric (if (a,b) in R then (b,a) in R) If (a,b) in R then a ≡ b (mod m). This means that (a-b) is divided by m a-b=c m, c is an integer -a+b=- c m  b - a= c’ m, b-a is divided by m b ≡ a (mod m)  (b,a) in R.

24 3)R is transitive (if (a,b) and (b,c) in R then (a,c) in R). if (a,b) and (b,c) in R This means that: a - b= k 1 m and b - c= k 2 m, where k 1 and k 2 are integers. By adding a - b= k 1 m and b - c= k 2 m, we have a –c = ( k 1 + k 2 ) m a - c = k m, where k= k 1 + k 2 This means that: m divides a-c. Therefore, (a,c) in R.

25 Partial Orderings Definition: A relation R on a set S is called a partial ordering or partial order if it is reflexive, anti-symmetric and transitive. ♦ A set S together with a partial ordering R is called a partially ordered set or poset, and is denoted by (S,R). ♦ Members of S are called elements of poset.

26 Example: Show that the “greater than or equal” relation (≥) is a partial ordering on Z a set of integers. Solution: R={(a,b)| a ≥ b} We need to prove that R is reflexive, anti-symmetric and transitive 1. R is reflexive ((a,a) in the relation) Since a ≥ a for every integer a, therefore, (a,a) in R. 2.R is anti-symmetric (if (a,b) and (b,a) in R then a=b) If (a,b) and (b,a) in R then a ≥ b and b ≥ a. This means that a=b. 3.R is transitive (if (a,b) and (b,c) in R then (a,c) in R). if (a,b) and (b,c) in R then a ≥ b and b ≥ c. Therefore, a ≥ c. This imply that (a,c) in R. Hence, ≥ is a partial ordering on a set of integers and (Z, ≥) is poset.

27 Example: Show that the inclusion relation ⊆ is a partial ordering on the power set of a set S. Solution: R={(a,b)| a ⊆ b} We need to prove that R is reflexive, anti-symmetric and transitive 1. R is reflexive ((a,a) in the relation) Since a ⊆ a for every integer a, therefore, (a,a) in R. 2.R is anti-symmetric (if (a,b) and (b,a) in R then a=b) If (a,b) and (b,a) in R then a ⊆ b and b ⊆ a. This means that a=b. 3.R is transitive (if (a,b) and (b,c) in R then (a,c) in R). if (a,b) and (b,c) in R then a ⊆ b and b ⊆ c. Therefore, a ⊆ c. This imply that (a,c) in R. Hence, ⊆ is a partial ordering on P(S) and (P(S), ⊆ ) is a poset.

28 Example: Let R be the relation on the set of people such that x R y if x and y are people and x is older than y. Show that R is not a partial ordering. Solution: R is anti-symmetric because if a person x is older than a person y, then y is not older than x. That is if (x,y) R, then (y,x) ∉ R is not possible. R is transitive because if a person x is older than person y and y is older then person z, then x is older then z. that is, x R y and y R z, then x R z. However, R is not reflexive, because no person is older than himself or herself. That is, (x,x) ∉ R for all people x. it follows that R is not a partial ordering and poset.

29 Representing Relations Using Digraphs Example: Display the digraph with V = {a, b, c, d}, E = {(a, b), (a, d), (b, b), (b, d), (c, a), (c, b), (d, b)}.a b cd An edge of the form (b, b) is called a loop.

30 Hasse Diagrams In general, we can represent a partial ordering on a finite set using this procedure: 1. Start with the directed graph for this relation. 2. Because a partial ordering is reflexive, a loop is present at every vertex. Remove these loops. 3. If (a,b) and (b,c) are in the partial ordering, remove the edge (a,c). 4. Remove all the arrows on the directed edges.

31 2 3 4 Example: Consider the directed graph for the partial ordering {(a,b): a ≤b}on the set {1,2,3,4} 1 Directed graph has loops at all vertices (reflexive). R= {(1,1), (2,2), (3,3), (4,4), (1,2), (1,3), (1,4), (2,3), (2,4), (3,4),

32 Constructing a Hasse Diagram: To construct the Hasse diagram complete the following steps: 1) Remove all loops. 2) Remove all edges implied by transitive property(that must be in the partial ordering). (For example, if (a,b) and (b,c) are in the partial ordering then remove (a,c), because it must be present also. ) 2 3 4 1 2 3 4 1

33 3) Remove all arrows on the directed edges. Hasse Diagram for ({1,2,3,4},≤) When all steps have been taken, the resulting diagram contains sufficient information to find the partial ordering. This diagram is called Hasse diagram, named after the 20 the century German mathematician Helmut Hasse. 2 3 4 1

34 Hasse Diagrams Example. Draw the Hasse diagram representing the partial ordering {(a,b) where a divides b } on {1, 2, 3, 4, 6, 8, 12} Answer: Begin with the digraph for this partial order, as shown in Figure 3(a). Remove all loops, as shown in Figure 3(b). Then delete all the edges implied by the transitive property. These are (1,4), (1,6), (1,8), (1,12), (2,8), (2,12); and (3,12): Arrange all edges to point upward, and delete all arrows to obtain the Hasse diagram. The resulting Hasse diagram is shown in Figure 3(c).

35 Hasse Diagrams

36 Definition: An element a is a maximal in the poset (S,≤) if there is no b S such that a< b. Definition: An element a is a minimal in the poset (S,≤) if there is no b S such that b < a. An element of a poset is called maximal if it is not less than any element of the poset. Similarly, an element of a poset is called minimal if it is not greater than any element of the poset. Maximal and minimal elements are easy to spot using a Hasse diagram. They are the “top” and “bottom” elements in the diagram.

37 The Hasse diagram in Figure for this poset shows that the maximal element are 12, 20, and 25, and the minimal elements are 2 and 5

38 Definition: An element a is a greatest element of the poset (S,≤) if b ≤ a for all b S. Definition: An element a is a least element of the poset (S,≤) if a ≤ b for all b S. Greatest element: An element in a poset that is greater than every other element. The greatest element is unique when it exist. Least element: An element in a poset that is less than every other element is called least element. The least element is unique when it exist.

39 Example: Determine whether the poset represented by each of the Hasse diagram in the following figures have a greatest and a least element. The least element of the poset with Hasse diagram (a) is a. This poset has no greatest element. The poset with Hasse diagram (b) has neither a least nor a greatest element. The poset with Hasse diagram (c) has no least element. Its greatest element is d. The poset with Hasse diagram (d) has least element a and greatest element d.

40 An element u of S is an upper bound of A if a ≤ u for all a A. An element l of S is an lower bound of A if l ≤ a for all a A. An element x is called the least upper bound of the subset A if a ≤ x whenever a A, and x ≤ z whenever z is an upper bound of A. An element y is called the greatest lower bound of the subset A if y is lower bound of A and z ≤ y whenever z is lower bound of A.

41 h g Example :Find the lower and upper bounds of the subsets {a,b,c}, {j,h}, and {a,c,d,f} in the poset with the Hasse diagram shown in the following figure. Solution: The upper bounds of {a,b,c} are e,f,j, and h and its lower bound is a. There are no upper bounds of {j,h}, and its lower bounds are a, b, c,d,e, and f. The upper bounds of {a,c,d,f} are f, h and j and its lower bound is a. d b f a c e j

42 Example : Find the greatest lower bound and the least upper bounds of {b,d,g}, if they exist in the poset shown in figure of the previous example. Solution: 1) The upper bounds of {b,d,g} are g and h because g < h therefore g is the least upper bound. 2) The lower bounds of {b,d,g} are a and b. Because a { "@context": "http://schema.org", "@type": "ImageObject", "contentUrl": "http://images.slideplayer.com/11/3336259/slides/slide_42.jpg", "name": "Example : Find the greatest lower bound and the least upper bounds of {b,d,g}, if they exist in the poset shown in figure of the previous example.", "description": "Solution: 1) The upper bounds of {b,d,g} are g and h because g < h therefore g is the least upper bound. 2) The lower bounds of {b,d,g} are a and b. Because a

43 Lattices ♦ Applications of lattices are (1) models of information flow: the flow of information from one person or computer program to another is restricted via security clearances. We can use lattice model to represent different information flow policies. (2) Boolean algebra. Definition: A poset(partially ordered set) in which every pair of elements has both a least upper bound and a greatest lower bound is called a Lattices.

44 Example : Determine whether the poset represented by each of the Hasse diagram in the following figures are lattices. Solution: (i) The upper bounds of {b,d,e} are e and f. While e is the least upper bound because e < f. The lower bounds of {b,d,e} are a and b. While b is the greatest lower bound because a < b. (ii) The upper bounds of {b,c,e} are e and f. While e is the least upper bound because e < f. The lower bounds of {b,c,e} are a and b. While b is the greatest lower bound because a < b. In general, each pair of elements has both a least upper bound and a greatest lower bound. Therefore, the diagram is lattices. f b a d e c

45 f For Figure (b) It is not a lattice, because the element b and c have no least upper bound. Note that b and c have d, e, and f upper bounds. For Figure (c) (i) The upper bounds of {d,g} are g and h. While g is the least upper bound because g < h. The lower bounds of {d,g} are a and d. While d is the greatest lower bound because a < d. (ii) The upper bounds of {b,e} are e and h. While e is the least upper bound because e < h. The lower bounds of {b,e} are a and b. While b is the greatest lower bound because a < b. d b a c e f d b a c e

46 Home Work (Q1) For each of these relations on the set {1,2,3,4}, decide whether it is reflexive, symmetric, anti-symmetric and transitive. R1= {(2,2), (2,3), (2,4), (3,2), (3,3), (3,4)} R2= {(1,1), (1,2), (2,1), (2,2), (3,3), (4,4)} R3= {(2,4), (4,2)} R4= {(1,2), (2,3), (3,4)} R5= {(1,1), (2,2), (3,3), (4,4)} R6= {(1,3), (1,4), (2,3), (2,4), (3,1), (3,4)}

47 (Q2) Let R be the relation on the set {0,1,2,3} containing the ordered pairs (0,1),(1,1),(1,2),(2,0),(2,2), and (3,0). Find (a) Reflexive closure of R (b) Symmetric closure of R (Q3) if A= {1,2,3,4}, then find the transitive closures of the following relations; R1= {(1,2), (2,1), (2,3), (3,4), (4,1)} R2= {(2,1), (2,3), (3,1), (3,4), (4,1), (4,3)} R3= {(1,2), (1,3), (1,4), (2,3), (2,4), (3,4)} R4= {(1,1), (1,4), (2,1), (2,3), (3,1), (3,2), (3,4), (4,2)} (Q4) Which of these relations on A= {0,1,2,3} are equivalence relations? R1={(0,0), (1,1), (2,2), (3,3)} R2={(0,0), (0,2), (2,0), (2,2), (2,3), (3,2), (3,3)} R3={(0,0), (1,1), (1,2), (2,1), (2,2), (3,3)} R4={(0,0), (1,1), (1,3), (2,2), (2,3), (3,1), (3,2), (3,3)} R5={(0,0), (0,1), (0,2), (1,0), (1,1), (1,2), (2,0), (2,2), (3,3)}

48 (Q5) Draw the Hasse diagram representing the partial ordering {(a,b) | a divides b} on {1,2,3,4,6,8,12} as shown in figure (Q6) Determine whether the posets with these Hasse diagrams.


Download ppt "Relations 1.Relations on a Set. 2.Properties of Relations. 3.Closures of Relations. 4.Equivalence of Relations. 5.Partial Ordering. 6.Hasse Diagram."

Similar presentations


Ads by Google