RELATIONS Logic & Problem Solving Lecture week 10 RELATIONS (Contd..) Agenda: Review of week 9 Week 10 lecture coverage • Relation • Properties of relations • Types of relations • Equivalence classes and partitions of a set. Amazing Talent… Review of week 9 Some Special Relations 1.Reflexive Relations 2.Symmetric Relations 3.Transitive Relations 4.Equivalence Relations 5.Anti-symmetric Relations 6.Asymmetric Relations 7.Irreflexive Relations Review of week 9 Question : Let S be the relation on set A ={1,2,3,4} given by S={(1,1),(1,2), (2,1), (2,2), (3,3), (1,3), (3,2), (3,1), (2,3),(4,4) ,(4,3)} Draw the digraph and matrix representation of S and Check all the seven properties of relations for S. Any Questions? Reflexive Relations (Contd.): The digraph and matrix representations of a reflexive relation have simple characteristic features. Since x R x for all x A it follows easily that for a reflexive relation: a. Every vertex of the digraph has a loop attached. b. The matrix M representing R must have a 1 in every position in its main diagonal (that is, the diagonal from the top left of the matrix). Reflexive Relations (Contd.): Example: Let A = {1, 2, 3, 4} and R = {(1, 1), (1, 2), (2, 2), (2, 3), (3, 3), (3, 1), (4, 4)} and matrix of R and is reflexive . gives the following digraph Symmetric Relations (Contd.): We next look at what effect being symmetric has on the digraph and matrix representation of a relation. • If R is a symmetric relation on A we know that x R y y R x. This means that if there is an edge from x to y in the digraph of R then there must also be an edge from y to x. Hence, if R is symmetric, every edge of the digraph of R comes as part of a pair of edges of the form Symmetric Relations (Contd.): The only exception to this is that a symmetric relation may have edges: loop The relation R = { (1, 2), (2, 1), (2, 3), (2, 2), (3, 2) } on the set A = {1, 2, 3} is symmetric. Its digraph is as below: Symmetric Relations (Contd.): Now suppose M is the matrix of a symmetric relation. Since x R y y R x, if there is a 1 in position (x, y) of M x).Similarly, there must also be a 1 in position (y, 0 in position (x, y) implies 0 in position (y, x). Consequently, A relation R is symmetric if and only if the matrix of R is symmetric. [Note: a matrix is symmetric if it is equal to its own transpose ] Symmetric Relations (Contd.): The relation R = { (1, 2), (2, 1), (2, 3), (2, 2), (3, 2) } on the set A = {1, 2, 3} is symmetric. Its Matrix representation M is as below: M= 0 1 0 1 1 1 0 1 0 Transitive Relations : In terms of the digraph and the matrix representation of a relation, transitivity is easy to interpret but much more difficult to check, especially for relations on large sets. Since x R y and y R z x R z it follows that, Every time there is an edge from a vertex x to vertex y and an edge from y to z, there must be an edge from x to z, shown as the broken line below: Transitive Relations (Contd.): Every time there is an edge from x to y and an edge from y back to x there must be loops at both x and y: Transitive Relations (Contd.): Every time there is a 1 in position (x, y) and a 1 in position (y, z) there must be a 1 in a position (x, z). Every time there is a 1 in position (x, y) and a 1 in position (y, x) there must be a 1 in both diagonal positions (x, x) and (y, y). The above interpretations would be difficult to check for relations on large sets. For small sets following systematic approaches may be helpful. Transitive Relations (Contd.): The digraph and matrix representations for the relation which is transitive . Let A = {1, 2, 3, 4} and R = { (1, 1), (1, 2), (2, 3), (1, 3), (4, 1), (4, 2), (4, 3)} Any Questions? Equivalence Relations : Example I: If A is any set of real numbers, we define the "is equal to" relation on A by a R b if a = b. Prove R is an equivalence relation. i) a = a for all real numbers a. a R a for all a A and R is reflexive. ii) if a = b then b = a for all real numbers a and b a R b b R a and R is symmetric. iii) if a = b and b = c then a = c a R b and b R c a R c and R is transitive. Hence the relation is an equivalence relation. Equivalence Relations (Contd.): Example II: Let S be the relation on Z defined by m S n if m + n is even. Show that S is a equivalence relation . (Note first that an integer x is even if we can write x = 2k for some integer k) i. m + m = 2m (even) for all m Z m S m and S is Reflexive. ii. if m S n then m + n = 2k for some k Z. Then n + m = 2k and n S m also. m S n n S m and S is Symmetric. Equivalence Relations (Contd.): iii. if m S n and n S p then m + n = 2k1 and n + p = 2k2 for some k1, k2 Z. Then m +n +n +p = 2k1 + 2k2 m + 2n +p = 2k1 + 2k2 m + p = 2k1 + 2k2 — 2n = 2(k1 + k2 — n) = 2l ,where I = (k1 + k2 — n) Z m S p and S is transitive. Hence S is an equivalence relation. Anti – Symmetric Relations : It is easy to interpret "antisymmetry" in both the digraph and matrix representations of the relation. a) Since x R y and y R x are not both allowed for distinct x, y A we cannot have any configurations of the form in the digraph of an antisymmetric relation. We can have loops in vertices . Not Allowed Anti – Symmetric Relations Contd.. b) For the matrix, if there is a 1 in position (x, y) with (x y) there must be a 0 in position (y, x). Example: Let A = {1, 2, 3, 4} and R = {(1, 3), (2, 2), (2, 1), (3, 4), (4, 1), (4, 4)} we obtain the digraph and matrix below: Asymmetric Relations : It is easy to interpret "asymmetric" in both the digraph and matrix representations of the relation. a) Since x R y and y R x are not both allowed for x, y A we cannot have any configurations of the form in the digraph of an antisymmetric relation. No loops are allowed. b) For the matrix, if there is a position (y, x). 1 in position (x, y) then there must be a 0 in Not Allowed Irreflexive Relations : The digraph and matrix representations of a irreflexive relation have simple characteristic features. a. Every vertex of the digraph should not have a loop attached. b. The matrix M representing R must have a 0 in every position in its main diagonal (that is, the diagonal from the top left of the matrix). Any Questions? Congruence Property: If a and b are any 2 integers we say, a is congruent to b modulo 5, or a and b are congruent modulo 5, if 5 | (a – b) (i.e. if 5 divides a – b) If this is the case, we write a ≡ b (mod 5) and if not, we write a ≢ b (mod 5). For example, 23 ≡ 13 (mod 5) since 23 – 13 = 10 and 5 |10. 67 ≡ –8 (mod 5) since 67 – ( – 8 ) = 75 and 5 | 75. 28 ≢ 16 (mod 5) since 28 – 16 = 12 and 5 does not divide 12. Congruence Relations (Contd.): Definition: Let n Z+ and n> 1. For a, b Z we say a is congruent to b (mod n), if n I(a — b), or, equivalently, if a — b = n k for some k Z. modulo n, written a b Congruence Relations (Contd.): Theorem: Let n Z+ and n > 1. The relation R defined on Z by a R b if a b (mod n) is an equivalence relation. Proof: i. Since a — a = 0 and 0 = n x 0 (0 Z) it follows that a a a (mod n). a R a for all a Z, and R is reflexive. ii. If a R b then a — b = n k for some k Z. b — a = — (a — b) = — n k = n • (— k) and —k Z. b a (mod n) i.e. a R b = b R a and R is symmetric. Congruence Relations (Contd.): iii. If a R b and b R c then there exist k1, k2 Z such that a — b = nk1 and b — c = nk2 a —c = a— b + b—c = nk1 +nk2 = n(k1 + k2) and k1 + k2 Z. a c (mod n) i.e. a R b and b R c = a R c and R is transitive R is an equivalence relation. Equivalence Classes: Definition: If R is an equivalence relation on A, then the set of all elements of A which are related to a particular element a A is called the equivalence class of a and is written [a]. More formally, Let R be an equivalence relation on a set A. If a A, we define the equivalence class [a] of a by [a] = { x : x A, x R a } Equivalence Classes (Contd.): Example: Let A = { 1, 2, 3, 4, 5, 6, 7 } and let R be the relation on A defined by a R b if a + b is even. Then R is an equivalence relation. Since IAI = 7 we expect 7 equivalence classes. The elements related to 1 are 1, 3, 5 and 7 and so [1] = {1, 3, 5, 7} Similarly, [2] = { 2, 4, 6 } However, all other equivalence classes are identical to one or other of these two sets. In fact [3] = [5] = [7] = [1] and [4] = [6] = [2]. Equivalence Classes (Contd.): Noting that [1] [2] = Ø we see that if [a] and [b] are any two equivalence classes then either i. [a] = [b] ( e.g. [3] = [7] ) Or, ii. [a] [b] = 0 ( e.g. [5] [4] = Ø ) In other words (in this example) equivalence classes are either or Disjoint. Identical Equivalence classes .. Question : If A = {1, 2, 3, 4, 5} and Let R be the relation on set A defined by R= {(1, 1), (2, 2), (2, 3), (3, 2), (3, 3), (4, 4), (4, 5), (5, 4), (5, 5)} Check weather R is an equivalence relation or not . If R is an equivalence relation, then find the equivalence classes of all the elements of A . Equivalence classes .. Solution , A = {1, 2, 3, 4, 5} R= {(1, 1), (2, 2), (2, 3), (3, 2), (3, 3), (4, 4), (4, 5), (5, 4), (5, 5)} R is reflexive because for all p belongs to A then (p , p) also belongs to R . R is symmetric because for all (p , q ) belongs to R then (q , p ) also belongs to R . R is transitive because for all (p , q ) and (q , r ) belongs to R then (p , r) also belongs to R . Hence R is an equivalence relation . Equivalence classes .. A = {1, 2, 3, 4, 5} R= {(1, 1), (2, 2), (2, 3), (3, 2), (3, 3), (4, 4), (4, 5), (5, 4), (5, 5)} Here R is an equivalence relation, so the equivalence classes exists , [1] = {1} [2] = {2,3} [3] = {2,3} [4] = {4,5} [5] = {4,5} Any Questions? Summary: Week 10 Lecture: • Relation • Properties of relations • Types of relations • Equivalence classes . What to Expect: Week 10 Tutorials • Review and practice Relations problems through in-class assignments to actually acquire them. • Practice problems to know how concept of relations can be useful in solving various mathematical problems. Thank you