Unformatted text preview: Week 2: Additional notes on Modular Arithmetic Written by: Vicky Mak (Burwood) [email protected] Contents based on: Introduction to Cryptography with Coding Theory, by Trappe et al. July, 2008 1 Finding a−1( mod n) Solve as + nt = 1. We have that a−1 ≡ s ( mod n). An Example Solve 3x ≡ 1 mod 11. (Note that 3 and 11 are coprime, i.e. gcd(3, 11) = 1). We are to ﬁnd x, the inverse of 3 mod 11. Solving 3s+11t = 1, we get 3(4) = 11(−1) = 1. Therefore 3(4) ≡ 1( mod 11). 2 Hence, 4 is the inverse of 3 modulo 11. Solving ax ≡ c ( mod n) Case 1: When gcd(a, n) = 1 Solve: as + nt = 1. We have that x = cs ( mod n). So there is exactly one solution. Case 2: When gcd(a, n) = d > 1 If d does not divide c, then there is no solutions. Case 3: When gcd(a, n) = d > 1 3 If d divides c, then there are multiple solutions. Solving ax ≡ c ( mod n): Case 3 continued To obtain the solutions, ﬁrst we solve (a/d)x0 ≡ c/d ( mod n/d). Note that a/d, c/d, and n/d are all integers and that gcd(a/d, n/d) = 1. Now, the solutions to ax ≡ c ( mod n) are: x0, x0 + n/d, x0 + 2n/d, . . . , x0 + (d − 1)(n/d). 4 Solving ax ≡ c ( mod n): Case 3–An example Solve 12x ≡ 21( mod 39). Note that gcd(12, 39) = 3 > 1. Since 321, we can ﬁrst solve: 12 21 39 x0 ≡ ( mod ), 3 3 3 i.e. solve 4x0 ≡ 7 ( mod 13). Solving 4s + 13t = 1, we get s = −3, and therefore mod 13) ≡ 5 ( mod 13). x0 ≡ 7s ≡ −21 ( Now, the solutions to 12x ≡ 21( mod 39) are: 5, 5 + 39/3, 5 + 2(39/3) ( mod 39), 5 i.e. 5, 18, 31 ( mod 39). A division example You can divide by a ( mod n) if gcd(a, n) = 1. E.g. 2x + 7 ≡ 3( mod 17) i.e. 2x ≡ −4( mod 17) Since gcd(2, 17) = 1, we get: x ≡ −2 ( mod 17) ≡ 15 ( mod 17). 6 What happens when you can’t divide? E.g. Solving 5x + 6 ≡ 13 ( mod 11) i.e. 5x ≡ 7( mod 11). But, 7 ≡ 18 ≡ 29 ≡ 40 ( mod 11), and now both sides can be divided by 5 as gcd(5, 11) = 1. So we have: x≡8 ( mod 11). 7 ...
View
Full
Document
 Spring '10
 jhhgjhgjh
 Division, Prime number, Vicky Mak, Trappe

Click to edit the document details