Discrete Mathematics for Computing Lecture Notes PDF
Document Details
Uploaded by TalentedOpArt
Rochester Institute of Technology
Tags
Summary
These lecture notes cover discrete mathematics, specifically relations on sets, equivalence relations, and equivalence classes. The lecture was given on 10/22/24, and provided examples and definitions within the computer science context taught from a university perspective.
Full Transcript
MATH 190 – Discrete Mathematics for Computing Lecture: 10/22/24 Relations on Sets Equivalence Relations Equivalence Classes RIT “a divides b” Notation: a | b...
MATH 190 – Discrete Mathematics for Computing Lecture: 10/22/24 Relations on Sets Equivalence Relations Equivalence Classes RIT “a divides b” Notation: a | b a | b s such that b sa 3 | 15 since s such that 15 s 3. Here s 5 Note that 15 is divisible by 3. 4 | 0 since s such that 0 s 4. Here s 0 0 | 0 since s such that 0 s 0. Here s 0 Note that every integer divides 0. Last Thursday’s Worksheet Let S be the set of positive integers, and for all a, b , (a, b) R a | b. Reflexive: (Every element is related to itself). We need to show that ( a, a ) R.. (a, a ) R a | a. We know that a | a since a 1 a. So this relation is reflexive. Symmetric: We need to show that (a, b) R (b, a) R 3 |15 but it is not true that 15 | 3. So this relation is not symmetric. Antisymmetric We need to show that: If (a, b) R then (b, a ) R. This is the same as: (a, b) R and (b, a ) R a b The only elements for which both the pair and its mirror image are in R are the pairs of the form ( x, x). Let S be the set of positive integers, and for all a, b , (a, b) R a | b. Anti‐Symmetric: We need to show that ( a, b) R and (b, a ) R a b That is, we need to show that a | b and b | a a b. a | b s such that b sa. b | a t such that a tb. Then combining these we have b s a s tb . b stb st 1, so s 1 and t 1. Earlier we saw b sa, and since s 1 we have a b. Let S be the set of positive integers, and for all a, b , (a, b) R a | b. Transitive: We need to show that ( a, b) R and (b, c) R (a, c) R. That is, we need to show that a | b and b | c a | c. Have a | b s such that b sa. b|c t such that c tb. c t b c t sa c ts a c wa w ts Want a | c w such that c wa. Definition. Let S be a non‐empty set, and let R be a relation on S. Notation: (S,R) The relation R is reflexive if: (a, a) R a S The relation R is symmetric if: (a, b) R (b, a ) R The relation R is transitive if: (a, b) R and (b, c ) R ( a, c ) R If a relation R is reflexive, symmetric, and transitive, then (S,R) is called an equivalence relation. Example Let S be the set of integers and let R be defined as follows: (a, b) R a b is even. Prove that (S,R) is an equivalence relation. We need to prove the relation is reflexive, symmetric, and transitive. Reflexive: (Every element is related to itself). We need to show that (a, a ) R. Since a a 2a (which is even) for all a we have that (a, a ) R. Example Let S be the set of integers and let R be defined as follows: (a, b) R a b is even. Symmetric: We need to show that (a, b) R (b, a ) R. Assume that (a, b) R. Then a b is even which means that b a is even. Then (b, a ) R. Example Let S be the set of integers and let R be defined as follows: (a, b) R a b is even. Transitive: We need to show that (a, b) R and (b, c) R ( a, c) R. HAVE (a, b) R. a b is even (b, c) R. + b c is even a b b c is even a 2b c is even WANT (a, c) R. a c is even Since (S,R) is reflexive, symmetric, and transitive, the relation is an equivalence relation. We did it! Example Let S be the set of integers and let R be defined as follows: (a, b) R a b. Is this relation an equivalence relation? Reflexive: (Every element is related to itself). We need to show that (a, a ) R. (a, a) R since a a. Example Let S be the set of integers and let R be defined as follows: (a, b) R a b. Symmetric: We need to show that (a, b) R (b, a ) R. (a, b) R a b. But this does not imply that b a. For example 2 3 but it is not true that 3 2. Since (2,3) R and (3,2) R this relation is not symmetric. Therefore (S,R) is not an equivalence relation. If I see that a relation is not reflexive, symmetric, or transitive, can I just say that the relation is not an equivalence relation? Yes. For example if you checked the symmetric property first RIT and saw that this did not hold, there is no need to check the other two properties. Equality vs. Equivalence Not equal Equivalent 4 1 4 1 Let a, b, c, d , with b 0 and d 0. a c We will say that ad bc. b d 4 1 4 1 Let a, b, c, d , with b 0 and d 0. a c We will say that ad bc. b d Let S and (a, b), (c, d ) R ad bc. Prove that this relation is an equivalence relation. Reflexive: a, b , a, b R ab ba Symmetric a, b , c, d R ad bc cb da c, d , a, b R Transitive HAVE a , b , c, d R c, d , e, f R ad bc cf de adcf bcde WANT a, b , e, f R af be Since the relation is reflexive, symmetric, and transitive, it is an equivalence relation. 1 Which elements are equivalent to ? 2 1 x , R y 2 x which means the denominator is twice the numerator. 2 y 1 2 3 , , ,... 2 4 6 Here is an example of another relation. (a, b), (c, d ) R a d b c for all a, b, c, and d S. 1, 2 , (3, 4) R since 1+4=2+3 6, 2 , (3,5) R since 6+5 2+3 Example Let S be the set of integers and let R be defined as follows: (a, b), (c, d ) R a d b c for all a, b, c, and d S. Prove that (S,R) is an equivalence relation. ‐ Note that here we are working with pairs, (not single elements) ‐ Also two pairs are related if the sum of the first number and the last number equals the sum of the two middle numbers. We need to prove the relation is reflexive, symmetric, and transitive. Reflexive: (Every pair is related to itself). We need to show that (a, b), (a, b) R. (a, b), (a, b) R is true since a b a b. (The sum of the first number and the last number equals the sum of the two middle numbers.) Let S be the set of integers and let R be defined as follows: (a, b), (c, d ) R a d b c for all a, b, c, and d S. Symmetric: We need to show that (a, b), (c, d ) R (c, d ), ( a, b) R. (a, b), (c, d ) R a d b c c b d a (c, d ), (a, b) R Transitive: We need to show that If (a, b), (c, d ) R and (c, d ), (e, f ) R then (a, b), (e, f ) R. HAVE (a, b), (c, d ) R ad bc (c, d ), (e, f ) R + c f d e ad c f bcd e ad c f bcd e WANT (a, b), (e, f ) R a f be Since (S,R) is reflexive, symmetric, and transitive, the relation is an equivalence relation. I remember when I was in the first grade, we learned about… “Clock Arithmetic” 2+3=5 8+6=2 “Modular Arithmetic” 0 We replace the 12 by 0 and now we have Arithmetic modulo 12. 7 9 4(mod12) This means when we divide 7+9 by 12 we get a remainder of 4. 4 | (7 9 4) “Modular Arithmetic” 7 9 4(mod12) 12 | (7 9 4) a b(mod n) n | (b a) Example Let S be the set of non-negative integers and let R be defined as follows: (a, b) R a b(mod 4) Prove that (S,R) is an equivalence relation. Remember a b(mod 4) 4 | (b a ) We need to prove the relation is reflexive, symmetric, and transitive. Reflexive: (Every element is related to itself). We need to show that (a, a ) R. a a mod 4 is the same as 4 | ( a a) and we know 4 | 0 is true. Example Let S be the set of non‐negative integers and let R be defined as follows: (a, b) R a b(mod 4) Symmetric: We need to show that (a, b) R (b, a ) R. (a, b) R 4 | (b a) 4 | (a b) (b, a ) R Example Let S be the set of non‐negative integers and let R be defined as follows: (a, b) R a b(mod 4) Transitive: We need to show that (a, b) R and (b, c) R ( a, c) R. HAVE (a, b) R. 4 | (b a) so 4 divides the sum of b a and c b (b, c) R. 4 | (c b ) 4 | (b a ) (c b) 4 | (c a ) WANT (a, c) R. 4 | (c a ) Definition. Given a set S , a partition is a set of subsets P1 , P2 ,..., Pn such that: n (i) Pi S and i 1 (ii) Pi Pj i, j Definition. Given a set S , a partition is a set of subsets P1 , P2 ,..., Pn such that: n (i) Pi S and i 1 (ii) Pi Pj i, j This looks complicated, but all of you have seen this notion before and understood it before you were 10 years old! So you have to be able to understand it now! Jigsaw Puzzles! Definition. Given a set S , a partition is a set of subsets P1 , P2 ,..., Pn such that: n (i) Pi S and (ii) Pi Pj i, j i 1 No two puzzle pieces overlap! The union of all of the pieces the entire puzzle! P1 P2 S P4 P3 Example Let S be the set of non‐negative integers and let R be defined as follows: (a, b) R a b(mod 4) Prove that (S,R) is an equivalence relation. Remember a b(mod 4) 4 | (b a ) We need to prove the relation is reflexive, symmetric, and transitive. Reflexive: (Every element is related to itself). We need to show that (a, a ) R. a a mod 4 is the same as 4 | ( a a) and we know 4 | 0 is true. Example Let S be the set of non‐negative integers and let R be defined as follows: (a, b) R a b(mod 4) Symmetric: We need to show that (a, b) R (b, a ) R. (a, b) R 4 | (b a) 4 | (a b) (b, a ) R Example Let S be the set of non‐negative integers and let R be defined as follows: (a, b) R a b(mod 4) Transitive: We need to show that (a, b) R and (b, c) R ( a, c) R. HAVE (a, b) R. 4 | (b a) so 4 divides the sum of b a and c b (b, c) R. 4 | (c b ) 4 | (b a ) (c b) 4 | (c a ) WANT (a, c) R. 4 | (c a ) Since (S,R) is reflexive, symmetric, and transitive, the relation is an equivalence relation. Let S be the set of nonnegative integers and let R be defined as follows: (a, b) R a b(mod 4) We have shown that our relation is an equivalence relation. Jigsaw Puzzle Next Problem: Identify the equivalence classes and show they form a partition of S n , n 0. Choose any integer. Say we choose 0. Then find all elements that are related to 0. Question: What are some elements that are related to zero? These are the integers that have the same remainder as 0 when divided by 4. That is {0,4,8,12,16,….}. These are the integers equivalent to 0mod4. 0 mod 4 {0, 4,8,12,16,...} 0 mod 4 {0, 4,8,12,16,...} Then we ask if we have covered all of the non‐negative integers. No. Choose any integer that we are missing. Say we choose 1. Then find all elements that are related to 1. What are some elements related to 1? These are the integers that have the same remainder as 1 when divided by 4. That is {1,5,9,13,17,….}. These are the integers equivalent to 1mod4. 1mod 4 {1,5,9,13,17,...} 0 mod 4 {0, 4,8,12,16,...} 1mod 4 {1,5,9,13,17,...} Then we ask if we have covered all of the non‐negative integers. No. Choose any integer that we are missing. Say we choose 2. Then find all elements that are related to 2. These are the integers that have the same remainder as 2 when divided by 4. That is {2,6,10,14,18,….}. These are the integers equivalent to 2mod4. 0 mod 4 {0, 4,8,12,16,...} 1mod 4 {1,5,9,13,17,...} Then we ask if we have covered all of the non‐negative integers. No. Choose any integer that we are missing. Say we choose 3. Then find all elements that are related to 2. These are the integers that have the same remainder as 2 when divided by 4. That is {2,6,10,14,18,….}. These are the integers equivalent to 2mod4. {2, 6,10,14,18,...} 2 mod 4 0 mod 4 {0, 4,8,12,16,...} 1mod 4 {1,5,9,13,17,...} 2 mod 4 {2, 6,10,14,18,...} Then we ask if we have covered all of the non‐negative integers. No. Choose any integer that we are missing. Say we choose 3. Then find all elements that are related to 3. These are the integers that have the same remainder as 3 when divided by 4. That is {3,7,11,15,19….}. These are the integers equivalent to 3mod4. 3mod 4 {3, 7,11,15,19,...} We have covered all of the non‐negative integers! Here are the four equivalence classes: S n , n 0. P1 {0, 4,8,12,16,...} P1 P2 P2 {1,5,9,13,17,...} P3 {2, 6,10,14,18,...} P4 P3 P4 {3, 7,11,15,19,...} And there’s our puzzle! Worksheet Let S 0 and let (a, b) R ab 0. Prove that (S,R) is an equivalence relation. Reflexive: (a, a) R a 2 0 which is true. Symmetric: (a, b) R ab 0 ba 0 (b, a ) R Transitive: HAVE (a, b) R ab 0 (b, c) R bc 0 ab bc 0 ab 2c 0 ac 0 WANT ( a, c ) R Let S 0 and let (a, b) R ab 0. We proved this is an Equivalence Relation. What are its Equivalence Classes?