Euclid’s Algorithm “Backwards” Theorem 17.1 ∀a b ∈ N ∃x y ∈ Z a ∗ x + b ∗ y = gcd(a, b) Furthermore, x and y are efficiently computable from a and b using Euclid’s Algorithm. Example 17.2 18 = 1 ∗ 12 + 6 = gcd(18, 12) Express gcd(18, 12) in terms of previous values, i.e., 18 and 12. 6 = 18 ∗ 1 + 12 ∗ (−1) Example 17.3 123 = 42 2 ∗ 42 + = 1 ∗ 39 + 39 = 3 gcd(123, 42) Express gcd(a, b) in terms of previous values; regroup; 3 = 42 ∗ 1 + 39 ∗ (−1) 3 = 42 ∗ 1 + (123 + 42 ∗ (−2)) ∗ (−1) 3 = 123 ∗ (−1) + 42 ∗ 3 1 repeat. Example 17.4 13 = 1 ∗ 8 8 = 1∗5 5 = 1∗3 3 = 1∗2 + + + + 5 3 2 1 = gcd(13, 8) Express gcd(a, b) in terms of previous values; 3∗1 3∗1 + + 2 ∗ (−1) (5 + 3 ∗ (−1)) ∗ (−1) 1 = 1 = 5 ∗ (−1) 5 ∗ (−1) + + 3∗2 (8 + 5 ∗ (−1)) ∗ 2 1 = 1 = 8 ∗ (2) 8 ∗ (2) + + 5 ∗ −3 (13 + 8 ∗ (−1)) ∗ −3 1 1 1 = = = 13 ∗ (−3) + regroup; 8∗5 Don’t forget to check: 1 = −39 + 40 2 repeat. Multipicative Inverses Mod m Corollary 17.5 Proof: If gcd(a, b) = 1 then we can efficiently compute the multiplicative inverse of a (mod b). Compute x, y, s.t. a ∗ x + b ∗ y = gcd(a, b) = 1. x is the multiplicative inverse of a (mod b). a∗x Corollary 17.6 1−b∗y = ≡ 1 (mod b) For all integers a, m, s.t. m > 1, a has a multiplicative inverse mod m Proof: a and m are relatively prime. iff Recall that a and m are relatively prime iff gcd(a, m) = 1. Let a and m be arbitrary with m > 1. Assume: gcd(a, m) = 1 Then by Cor. 17.5, a has a multiplicative inverse mod m. Assume: a has a multiplicative inverse mod m, and call it a−1 m . Thus, a ∗ a−1 m ≡ 1 (mod m). Thus, a ∗ a−1 m +k∗m = 1 Let d = gcd(a, m). Thus d|1. for some Thus, d|a and k ∈ Z. d|m. Therefore, d = 1 = gcd(a, m). 3 ∀a, m > 1 (a has mult. inverse mod m iff gcd(a, m) = 1) × mod 6 0 1 2 3 4 5 0 0 0 0 0 0 0 1 0 1 2 3 4 5 4 2 0 2 4 0 2 4 3 0 3 0 3 0 3 4 0 4 2 0 4 2 5 0 5 4 3 2 1 ∀a, m > 1 (a has mult. inverse mod m iff gcd(a, m) = 1) Definition 17.7 Let the multiplicative group mod m be Z ? U Zm a 0 < a < m ∧ gcd(a, m) = 1 = ? U Zm is the set of natural numbers less than m that are relatively prime to m, with operation multiplication mod m. Z?6 1 5 ? 6 U Z = {1, 5} Z?5 1 2 3 4 ? U Z5 = {1, 2, 3, 4} 5 1 1 5 1 1 2 3 4 5 5 1 2 2 4 1 3 3 3 1 4 2 4 4 3 2 1 Definition 17.8 A group is a world of vocabulary Σgroup = (; e, ∗2 [infix],−1 1 [postfix]) that satisfies Γgroup . Γgroup = ∀x (x ∗ e = x ∧ e ∗ x = x) ∧ ∀x (x ∗ x−1 = e ∧ x−1 ∗ x = e) ∧ ∀x y z x ∗ (y ∗ z) = (x ∗ y) ∗ z A group is a set with a an associative operation, an identity and inverses. Theorem 17.9 For all m > 1, ∗ Zm is a group. For m > 1, define Definition 17.10 (Euler’s phi function) ϕ(m) Example 17.11 ϕ(6) = 2; Proposition 17.12 = ∗ |Zm | = number of numbers less than m and relatively prime to m ϕ(5) = 4. For all p, if p is prime, then ϕ(p) = p − 1. 6
© Copyright 2024 ExpyDoc