Relations Relations on a Set. Properties of Relations.

Presentation on theme: "Relations Relations on a Set. Properties of Relations."— Presentation transcript:

Relations Relations on a Set. Properties of Relations.
Closures of Relations. Equivalence of Relations. Partial Ordering. Hasse Diagram

Relation on a set 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

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)}

Properties of Relations
There are several properties that are used to classify relations on a set. Reflexive Symmetric Antisymmetric Transitive

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.

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.

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.

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.

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

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.

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.

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.

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.

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

R ∪ △ , where △ ={(a,a): a ϵ A}
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.

R ∪ △ , where △ ={(a,a): a ϵ A}
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.

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}.

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.

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)}. Relations

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} Relations

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.

Equivalence Relation Examples: On N, x R y  x + y is even.
On {1, 2, 3}, R = {(1,1),(2,2),(3,3),(1,3),(3,1)} Relations

Example: Let m be a positive integer with m > 1
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. 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. 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.

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

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.

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 R is reflexive ((a,a) in the relation) Since a ≥ a for every integer a, therefore, (a,a) in R. 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. 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.

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 R is reflexive ((a,a) in the relation) Since a ⊆ a for every integer a, therefore, (a,a) in R. 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. 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.

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.

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 d c An edge of the form (b, b) is called a loop.

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.

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

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. ) 4 3 2 1 4 3 2 1

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. 4 3 2 1

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).

Hasse Diagrams

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.

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

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.

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.

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.

The upper bounds of {a,b,c} are e,f,j, and h and its lower bound is a.
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. h j g f d e b c a

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<b, therefore b is the greatest lower bound. h j g f d e b c a

Lattices 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. ♦ 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.

(i) The upper bounds of {b,d,e} are e and f.
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 e c d b a

It is not a lattice, because the element b and c
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. f d e b c a f d e b c a

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)}

(a) Reflexive closure of R (b) Symmetric closure of R
(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)}

(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.