340 likes | 369 Views
(CSC 102). Discrete Structures. Lecture 18. Previous Lectures Summary. Transitive closure of a relations Combining Relations The Relation Induced by a Partition Equivalence Relations Equivalence classes. Relations. Today’s Lecture. Equivalence classes
E N D
(CSC 102) Discrete Structures Lecture 18
Previous Lectures Summary • Transitive closure of a relations • Combining Relations • The Relation Induced by a Partition • Equivalence Relations • Equivalence classes
Today’s Lecture • Equivalence classes • Equivalence Classes of Congruence Modulo 3 • Equivalence of Congruence Modulo n • Properties of Congruence Modulo n • Modular Arithmetic • Partial Order Relations • Hasse Diagram
An Equivalence Relation on a Set of Subsets Suppose A is a set, R is an equivalence relation on A, and a and b are elements of A. If a R b, then [a] = [b]. Let A be a set, let R be an equivalence relation on A, and suppose a and b are elements of A such that a R b. [We must show that [a] = [b].] Proof that [a] ⊆ [b]: Let x ∈ [a]. [We must show that x ∈ [b]]. Since x ∈ [a] then x R a by definition of class. But a R b by hypothesis. Thus, by transitivity of R, x R b. Hence x ∈ [b], by definition of class. [a] ⊆ [b]
An Equivalence Relation on a Set of Subsets Proof that [b] ⊆ [a]:Let x ∈ [b]. [We must show that x ∈ [a]]. Since x ∈ [b], then x R b by definition of class. Now a R b by hypothesis. Thus, since R is symmetric, b R a also. Then, since R is transitive and x R b and b R a, x R a. Hence, x ∈ [a] by definition of class. [This is what was to be shown]. Thus [b] ⊆ [a]. Since [a] ⊆ [b] and [b] ⊆ [a], it follows that [a] = [b] by definition of set equality.
An Equivalence Relation on a Set of Subsets Theorem: If A is a set, R is an equivalence relation on A, and a and b are elements of A, then either [a] ∩ [b] = ∅ or [a] = [b]. The statement of the theorem has the form if p then (q or r ). where p is the statement “A is a set, R is an equivalence relation on A, and a and b are elements of A,” q is the statement “[a] ∩ [b] = ∅,” and r is the statement “[a] = [b].” To prove the theorem, we will prove the logically equivalent statement if (p and not q) then r. That is, we will prove the following: If A is a set, R is an equivalence relation on A, a and b are elements of A, and [a] ∩ [b] ≠ ∅, then [a] = [b].
An Equivalence Relation on a Set of Subsets Proof: Suppose A is a set, R is an equivalence relation on A, a and b are elements of A, and [a] ∩ [b] ≠ ∅. [We must show that [a] = [b].] Since [a] ∩ [b] ≠ ∅, there exists an element x in A such that x ∈ [a] ∩ [b]. By definition of intersection, x ∈ [a] and x ∈ [b] and so x R a and x R b by definition of class. Since R is symmetric [being an equivalence relation] and x R a, then a R x. But R is also transitive [since it is an equivalence relation], and so, since a R x and x R b, a R b. Now a and b satisfy the hypothesis of previous theorem. Hence, by that theorem, [a] = [b].
Equivalence Classes of Congruence Modulo 3 Let R be the relation of congruence modulo 3 on the set Z of all integers. That is, for all integers m and n, m R n ⇔ 3 | (m − n) ⇔ m ≡ n (mod 3). Describe the distinct equivalence classes of R. For each integer a, [a] = {x ∈ Z |x R a} = {x ∈ Z | 3 | (x − a)} = {x ∈ Z | x − a = 3k, for some integer k}. Therefore, [a] = {x ∈ Z | x = 3k + a, for some integer k}. In particular, [0] = {x ∈ Z| x = 3k + 0, for some integer k} = {x ∈ Z| x = 3k, for some integer k} = {. . . − 9,−6,−3, 0, 3, 6, 9, . . .},
Equivalence Classes of Congruence Modulo 3 [1] = {x ∈ Z| x = 3k + 1, for some integer k} = {. . . − 8,−5,−2, 1, 4, 7, 10, . . .}, [2] = {x ∈ Z| x = 3k + 2, for some integer k} = {. . . − 7,−4,−1, 2, 5, 8, 11, . . .}. Now since 3 R 0, [3] = [0]. More generally, by the same reasoning, [0] = [3] = [−3] = [6] = [−6] = . . . , and so on. Similarly, [1] = [4] = [−2] = [7] = [−5] = . . . , and so on. And [2] = [5] = −1 = [8] = [−4] = . . . , and so on.
Equivalence Classes of Congruence Modulo 3 Notice that every integer is in class [0], [1], or [2]. Hence the distinct equivalence classes are {x ∈ Z| x = 3k, for some integer k}, {x ∈ Z| x = 3k + 1, for some integer k}, and {x ∈ Z| x = 3k + 2, for some integer k}. In words, the three classes of congruence modulo 3 are (1) The set of all integers that are divisible by 3, (2) The set of all integers that leave a remainder of 1 when divided by 3, and (3) The set of all integers that leave a remainder of 2 when divided by 3.
Equivalence Classes of Congruence Modulo 3 [0] = {. . . − 9,−6,−3, 0, 3, 6, 9, . . .}, [1] = {. . . − 8,−5,−2, 1, 4, 7, 10, . . .}, [2] = {. . . − 7,−4,−1, 2, 5, 8, 11, . . .}. Partition of Z : Z = [0] U [1] U [2] And [0] ∩ [1] ∩ [2] = ø
Lecture Summery • Transitive closure of a relations • Combining Relations • The Relation Induced by a Partition • Equivalence Relations • Equivalence Classes of Congruence Modulo 3
Equivalence of Congruence Modulo n Congruence Modulo n Is an Equivalence Relation If n is any integer with n > 1, congruence modulo n is an equivalence relation on the set of all integers. The distinct equivalence classes of the relation are the sets [0], [1], [2], . . . , [n − 1], where for each a = 0, 1, 2, . . . , n − 1, [a] = {m ∈ Z |m ≡ a (mod n)}, or, equivalently, [a] = {m ∈ Z | m = a + kn for some integer k}.
Equivalence of Congruence Modulo n Proof: Suppose n is any integer with n > 1. We must show that congruence modulo n is reflexive, symmetric, and transitive. Proof of reflexivity:Suppose a is any integer. To show that a ≡ a (mod n), we must show that n | (a − a). But a − a = 0, and n | 0 because 0 = n · 0. Therefore a ≡ a (mod n).
Equivalence of Congruence Modulo n Proof: Suppose n is any integer with n > 1. We must show that congruence modulo n is reflexive, symmetric, and transitive. Proof of symmetry: Suppose a and b are any integers such that a ≡ b (mod n). We must show that b ≡ a (mod n). But since a ≡ b (mod n), then n | (a − b). Thus, by definition of divisibility, a − b = nk, for some integer k. Multiply both sides of this equation by −1 to obtain −(a − b) = −nk, or, equivalently, b − a = n(−k). Thus, by definition of divisibility n | (b − a), and so, by definition of congruence modulo n, b ≡ a (mod n).
Equivalence of Congruence Modulo n Proof: Suppose n is any integer with n > 1. We must show that congruence modulo n is reflexive, symmetric, and transitive. Proof of transitivity: Suppose a,b and c are any integers such that a ≡ b (mod n) and b ≡ c (mod n) . We must show that a ≡ c (mod n). Since a ≡ b (mod n), then n | (a − b). And b ≡ c (mod n), then n | (b − c). As we know that if m | k and m | p then m | (k+p). Thus, n | (a – b + b − c) = (a − c) a ≡ c (mod n), Therefore Congruence Modulo n relation is an Equivalence relation
Properties of Congruence Modulo n • Theorem:Let a, b, and n be any integers and suppose n > 1. The following statements are all equivalent: • 1. n | (a − b) • 2. a ≡ b (mod n) • 3. a = b + kn for some integer k • a and b have the same (nonnegative) remainder • when divided by n • 5. a mod n = b mod n
Modular Arithmetic Theorem:Let a, b, c, d, and n be integers with n > 1, and suppose a ≡ c (mod n) and b ≡ d (mod n). Then 1. (a + b) ≡ (c + d) (mod n) 2. (a − b) ≡ (c − d) (mod n) 3. ab ≡ cd (mod n) 4. a·m ≡ c·m (mod n), for all integers m.
Modular Arithmetic Theorem:Let a, b, c, d, and n be integers with n > 1, and suppose a ≡ c (mod n) and b ≡ d (mod n). Then 3. ab ≡ cd (mod n) Proof of Part 3:Suppose a, b, c, d, and n are integers with n > 1, and suppose a ≡ c (mod n) and b ≡ d (mod n). There exist integers s and t such that a = c + sn and b = d + tn. Then ab = (c + sn)(d + tn) = cd + ctn + snd + sntn = cd + n(ct + sd + stn) Let k = ct + sd + stn. Then k is an integer and ab = cd + nk. Thus ab ≡ cd (mod n).
Modular Arithmetic • Verify the following statements. • 55 + 26 ≡ (3 + 2) (mod 4), b. 55 − 26 ≡ (3 − 2) (mod 4) • c. 55·26 ≡ (3·2) (mod 4), d. 552 ≡ 32(mod 4) a. Compute 55 + 26 = 81 and 3 + 2 = 5. By definition of congruence modulo n, to show that 81 ≡ 5 (mod 4), you need to show that 4 | (81 − 5). But this is true because 81 − 5 = 76, and 4 | 76 since 76 = 4·19. b. Compute 55 − 26 = 29 and 3 − 2 = 1. By definition of congruence modulo n, to show that 29 ≡ 1 (mod 4), you need to show that 4 | (29 − 1). But this is true because 29 − 1 = 28, and 4 | 28 since 28 = 4· 7. c. Compute 55·26 = 1430 and 3·2 = 6. By definition of congruence modulo n, to show that 1430 ≡ 6 (mod 4), you need to show that 4 | (1430 − 6). But this is true because 1430 − 6 = 1424, and 4 | 1424 since 1424 = 4·356. d. Compute 552 = 3025 and 32 = 9. By definition of congruence modulo n, to show that 3025 ≡ 9 (mod 4), you need to show that 4 | (3025 − 9). But this is true because 3025 − 9 = 3016, and 4 | 3016 since 3016 = 4·754.
Modular Arithmetic Let a, b, and n be integers with n > 1. Then ab ≡ [(a mod n)(b mod n)] (mod n), or, equivalently, ab mod n = [(a mod n)(b mod n)] mod n. In particular, if m is a positive integer, then am≡ [(a mod n)m] (mod n). Example Find the residue of 55·26 modulo 4. (55·26) mod 4 = {(55 mod 4)(26 mod 4)} mod 4 ≡ (3·2) mod 4 ; because 55 mod 4 = 3 and 26 mod 4 = 2 ≡ 6 mod 4 ≡ 2
Modular Arithmetic Computing ak mod n When k Is a Power of 2 Find 1444mod 713. Solution: We can write 1444 = (1442)2. Then 1444mod 713 = (1442)2mod 713 = (1442mod 713)2mod 713 = (20736 mod 713)2mod 713 because 1442 = 20736 = 592mod 713 because 20736 mod 713 = 59 = 3481 mod 713 because 592 = 3481 = 629 because 3481 mod 713 = 629.
Modular Arithmetic Computing ak mod n When k Is Not a Power of 2 Find 1243mod 713. Solution:First write the exponent as a sum of powers of 2: 43 = 25 + 23 + 2 + 1 = 32 + 8 + 2 + 1. Next compute powers of 12. 12 mod 713 = 12 122mod 713 = 144 124mod 713 = 1442 mod 713 = 59 128mod 713 = 592 mod 713 = 629 1216mod 713 = 6292 mod 713 = 639 1232mod 713 = 6392 mod 713 = 485
Modular Arithmetic 1243 = 1232+8+2+1 = 1232 ·128 ·122 ·121 1243mod 713 = {(1232 mod713)·(128mod 713)·(122mod713)·(12 mod 713)} mod713 = (485·629·144·12) mod713 = 527152320 mod713 = 48.
Partial Order Relations Definition Let R be a relation defined on a set A. R is a partial order relationif, and only if, R is reflexive, antisymmetric, and transitive. Example: The “Subset” Relation Let A be any collection of sets and define the “subset” relation, ⊆, on A as follows: For all U, V ∈ A , U ⊆ V ⇔ for all x, if x ∈ U then x ∈ V. Prove that the subset relation is a partial order relation.
Partial Order Relations The “Subset” Relation U ⊆ V ⇔ for all x, if x ∈ U then x ∈ V. For ⊆ to be antisymmetric means that for all sets U and V in A if U ⊆ V and V ⊆ U then U = V. But this is true by definition of equality of sets.
Partial Order Relations The “Less Than or Equal to” Relation Let S be a set of real numbers and define the “less than or equal to” relation, ≤, on S as follows: For all real numbers x and y in S, x ≤ y ⇔ x < y or x = y. Show that ≤ is a partial order relation. ≤ is reflexive:For ≤ to be reflexive means that x ≤ x for all real numbers x in S. But x ≤ x means that x < x or x = x, and x = x is always true. ≤ is antisymmetric: For ≤ to be antisymmetric means that for all real numbers x and y in S, if x ≤ y and y ≤ x then x = y. This follows immediately from the definition of ≤ and the trichotomy property, which says that given any real numbers, x and y, exactly one of the following holds: x < y or x = y or x > y.
Partial Order Relations ≤ is transitive:For ≤ to be transitive means that for all real numbers x, y, and z in S if x ≤ y and y ≤ z then x ≤ z. This follows from the definition of ≤ and the transitivity property of order, which says that given any real numbers x, y, and z, if x < y and y < z then x < z. Because ≤ is reflexive, antisymmetric, and transitive, it is a partial order relation.
Partial Order Relations Hasse Diagrams Let A = {1, 2, 3, 9, 18} and consider the “divides” relation on A: For all a, b ∈ A, a | b ⇔ b = ka for some integer k. The directed graph of this relation has the following appearance:
Partial Order Relations Hasse Diagrams To obtain a Hasse diagram, proceed as follows: Start with a directed graph of the relation, placing vertices on the page so that all arrows point upward. Then eliminate 1. the loops at all the vertices, 2. all arrows whose existence is implied by the transitive property, 3. the direction indicators on the arrows.
Partial Order Relations Hasse Diagrams To obtain a Hasse diagram, proceed as follows: Start with a directed graph of the relation, placing vertices on the page so that all arrows point upward. Then eliminate 1. the loops at all the vertices, 2. all arrows whose existence is implied by the transitive property, 3. the direction indicators on the arrows.
Lecture Summery • Equivalence classes • Equivalence Classes of Congruence Modulo 3 • Equivalence of Congruence Modulo n • Properties of Congruence Modulo n • Modular Arithmetic • Partial Order Relations • Hasse Diagram