Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Math 373 Exam 1 Instructions In this exam, Z denotes the set of all integers and Zm = Z/mZ denotes the ring of all integers modulo m. Please be reminded that at least half of the credit will be for how the answers are found. Consequently, even correct solutions are found, full credit will not be granted if the supporting materials are not sufficient. For all classical cryptosystem problems, we use the English alphabet with A − Z represented by the mod 26 numbers 0 - 25, respectively, as shown below. A 0 B 1 C 2 D 3 E 4 F 5 G 6 H 7 I 8 J 9 K L M N O P Q R S T U V W X Y Z 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 1. (10 %) Find gcd(78, 45) by using Euclidean algorithm, and find integers u and v such that gcd(78, 45) = 78u + 45v. 2. (5 %) Suppose that a, b, c ∈ Z. Show that if a|b and a|c, then a|(b + c). 3. (10 %) Solve the equation 3x ≡ 7 (mod 13) 4. (10 %) Compute 3104 (mod 7). (Hint: What is the order of 3 mod 7?) 5. (10 %) Find the order of 4 modulo 7 and the order of 5 modulo 11. Is 4 a primitive root modulo 7? Is 5 a primitive root modulo 11? 6. (10 %) Find an integer x with 0 < x < 35 satisfying x ≡ 3 (mod 5) . x ≡ 2 (mod 7) and check your solution. 7. (10 %) Find all integer x with 0 ≤ x ≤ 12 satisfying x2 − 5x + 8 ≡ 2 (mod 13). 8. (10 %) Encrypt the plaintext how using the affine function f3,1 (x) = 3x + 1 (mod 26). Write down the ciphertext. What is the decryption function? (Check your answer to see it works). 9. (10 %) Consider an affine cypher fa,b (x) = ax + b (mod 26). Suppose you use this cipher to encrypt a plaintext nonono to a cipher text hihihi, find a and b. 10. (10 %) Find all the units in Z15 = Z/15Z. 11. (5 %) Show that is a1 , a2 are units modulo m, then the product a1 a2 is also a unit modulo m. 1 Math 373 Exam 1 Solutions 1. (10 %) Find gcd(78, 45) by using Euclidean algorithm, and find integers u and v such that gcd(78, 45) = 78u + 45v. Solution: Apply Euclidean Algorithm, 78 = 1(45) + 33 45 = 1(33) + 12 33 = 2(12) + 9 , 12 = 1(9) + 3 9 = 3(3) + 0 3 = 12 − 9, and 9 = 33 − 2(12) 3 = 12 − (33 − 2 · 12)) = −33 + 3(12), and 12 = 45 − 33 . 1 = −33 + 3(45 − 33) = 3(45) − 4(33), and 33 = 78 − 45 1 = 3(45) − 4(78 − 45) = 7(45) + (−4)(78) Thus gcd(78, 45) = 3, and 3 = (−4)(78) + (7)(45). 2. (5 %) Suppose that a, b, c ∈ Z. Show that if a|b and a|c, then a|(b + c). Proof: Claim 1 2 3 4 5 Statement a|b & a|c ∃u, v ∈ Z, b = au & c = av b + c = au + av = a(u ± v) b + c = am a|(b + c) Reason Assumption Definition of a|b & a|c Algebra/Remove common factor a. Let m = u + v, which is also an integer. Definition of divisibility. Another way to present the reasoning: Since a|b and since a|c, by the definition of divisibility, there exist integers u and v such that b = au and c = av. Add these equalities side by side to get b + c = au + av. Remove the common factor a leads to b + c = a(u + v). Since u and v are integers, m = u + v is also an integer. and so by the definition of divisibility, a|(b + c). 3. (10 %) Solve the equation 3x ≡ 7 (mod 13) Solution: First compute gcd(3, 13). We have 1 = gcd(3, 13) = (−4)(3) + (1)(13). Thus 3−1 ≡ −4 (mod 13). It follows that x ≡ (−4)(3x) ≡ (−4)(7) ≡ −28 ≡ −2 ≡ 11 (mod 13) . 4. (10 %) Compute 3104 (mod 7). (Hint: What is the order of 3 mod 7?) Solution: To find the order of 3 (mod 7), it suffices to compute 3k (mod 7) up to k = have 32 ≡ 2, 33 ≡ 6 = −1, and so 36 ≡ (33 )2 ≡ (−1)2 ≡ 1. 7−1 2 = 3. Thus we Hence the order of 3 mod 7 is 6, and 36 ≡ 1 (mod 7). Do the division and divide 104 by 6 to get 104 = 6(17)+2, and so 3104 ≡ 36·17+2 ≡ (36 )17 · 32 ≡ 1 · 32 ≡ 2 (mod 7) . 5. (10 %) Find the order of 4 modulo 7 and the order of 2 modulo 11. Is 4 a primitive root modulo 7? Is 5 a primitive root modulo 11? Solution: Since φ(7) = 6, it suffices to evaluate 4k up to k = 6/2 = 3. Compute 42 ≡ 2, 43 ≡ 8 ≡ 1 (mod 7). Hence the order of 4 mod 7 is 3. Since the order of 4 mod 7 is 3 6= φ(7) = 6, 4 is not a primitive root mod 7. 2 Since φ(11) = 10, it suffices to evaluate 5k up to k = 10/2 = 5. Compute 52 ≡ 3, 53 ≡ 4, 54 ≡ 9, 55 ≡ 1, (mod 11). It follows that the order of 5 mod 11 is 5 which is not equal to 10 = φ(11), and so 5 is not a primitive root mod 11. 6. (10 %) Find an integer x with 0 < x < 35 satisfying x ≡ 3 (mod 5) . x ≡ 2 (mod 7) and check your solution. Solution 1: (Straight forward. Good for small numbers time consuming for large numbers.) As x ≡ 2 (mod 7), in the lists of numbers, we pick up all that fits: They are of the form x = 2 + 7m, and so they are {2, 9, 16, 23, 29}. Now from among this list, check which one satisfies x ≡ 3 (mod 5). There are only 5 to check: 2 ≡ 2, 9 ≡ 4, 16 ≡ 1, 23 ≡ 3, 29 ≡ 4 (mod 5). It follows that the answer is x = 23. Solution 2: (The text book solution, can be used to deal with general cases. But usually long.) Since x ≡ 3 (mod 5), as an integer, x = 3 + 5y for some integer y. Substitute x = 3 + 5y into x ≡ 2 (mod 7) to get 3 + 5y ≡ 2 (mod 7). Now we solve 3 + 5y ≡ 2 (mod 7) by adding −3 (mod 7) both sides. This yields 5y ≡ −1 (mod 7). To find 5−1 (mod 7), we use Euclidean Algorithm (you can also use matlab) to get 1 = gcd(7, 5) = (−2)(7) + (3)(5), and so 5−1 ≡ 3 (mod 7). Hence y ≡ (3)(5y) ≡ 3(−1) ≡ −3 ≡ 4 (mod 7), or y = 4 + 7m for an integer m. To find x, we substitute y = 4 + 7m into x = 3 + 5y = 3 + 5(4 + 9m) = 23 + 35m, for integer m. Therefore, the smallest positive solution of x is x = 23. Checking the solution: Direct computation yields 23 = (4)(5) + 3 and 23 = (3)(7) + 2, and so 23 ≡ 3 (mod 5) and 23 ≡ 2 (mod 7). Therefore, x = 23 is a solution of the system with 0 ≤ x < 35. 7. (10 %) Find all integer x with 0 ≤ x ≤ 12 satisfying x2 − 5x + 8 ≡ 2 (mod 13). Solution: Add −2 (mod 13) both sides of x2 − 5x + 8 ≡ 2 (mod 13) to get x2 − 5x + 6 ≡ 0 (mod 13). Factoring x2 − 5x + 6 yields (x − 2)(x − 3). Therefore we are to solve (x − 2)(x − 3) ≡ 0 (mod 13). By definition, this means 13|(x − 2)(x − 3). Since 13 is a prime, we have either 13|(x − 2) or 13|(x − 3). Hence either x − 2 ≡ 0 and so x ≡ 2 (mod 13), or x − 3 ≡ 0 (mod 13) and so x ≡ 3 (mod 13). Checking solutions: For x = 2, 22 − 5(2) + 8 ≡ 2 (mod 13). For x = 3, 32 − 5(3) + 8 ≡ 2 (mod 13). Hence both x = 2 and x = 3 are solutions. 8. (10 %) Encrypt how using the affine function E3,1 (x) = 3x + 1 (mod 26). Write down the ciphertext. What is the decryption function? (Check your answer to see it works). Solution: Convert how to mod 26 numerical equivalence 7, 14, 22. Then f3,1 (7) = 3 · 7 + 1 ≡ 22, f3,1 (14) = 3 · 14 + 1 = 43 ≡ 17, f3,1 (22) = 3 · 22 + 1 = 67 ≡ 15 (mod 26) Thus the cipher text is wrp. To find the decryption function, we solve x from y = 3x + 1 to get x = (y − 1)/3. To compute 3−1 (mod 26), we first compute the gcd(3, 26) = (3)(9) + (−1)(26) = 1, and so 3−1 ≡ 9 (mod 26). Thus the decryption function is x = g(y) = 9(y − 1) = 9y − 9. 3 Checking the correctness: g(22) = 9(22 − 1) ≡ 9(−5) ≡ 7, g(17) = 9(17 − 1) ≡ 9(−10) ≡ 14, g(15) = 9(15 − 1) ≡ 9(14) ≡ 22 (mod 26) 9. (10 %) Consider an affine cypher fa,b (x) = ax + b (mod 26). Suppose you use this cipher to encrypt a plaintext dododo to cipher text hihihi, find a and b. Solution: As h = 7, i = 8, d = 3 and o = 14, we have 3 · a + b ≡ 7 and 14 · a + b ≡ 8 (mod 26). Thus 11a ≡ 1 (mod 26). Use Euclidean algorithm to find 1 = gcd(3(26) + (−7)(11), and so 11−1 ≡ −7 (mod 26). Hence a ≡ −7 ≡ 19 (mod 26). Substitute a ≡ −7 in 3a + b = 7 (mod 26), we have 3(−7) + b ≡ 7 (mod 26), and so b ≡ 28 ≡ 2 (mod 26). 10. Find all the units in Z15 = Z/15Z. Solution: From the list of elements in Z15 = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14}, we need to find all that are relatively prime with respect to 15. Since 15 = (3)(5), First we cross out the numbers divisible by 3, then all divisible by 5. The remaining list is 1, 2, 4, 7, 8, 11, 13, 14. These are all the numbers between 1 and 14 which are relatively prime with respect to 15, (since they do not share a common factor 3 or 5 with 15). Hence the units in Z15 are {1, 2, 4, 7, 8, 11, 13, 14}. 11. (5 %) Show that is a1 , a2 are units modulo m, then the product a1 a2 is also a unit modulo m. Reason: By definition, an element a is a unit mod m if there exists an element b such that ab ≡ 1 (mod m). Since a1 , a2 are units mod m, there exist integers b1 , b2 , such that a1 b1 ≡ 1, a2 b2 ≡ 1 (mod m). It follows that (a1 a2 )(b1 b2 ) ≡ (a1 b1 )(a2 b2 ) ≡ 1 · 1 ≡ 1 (mod m), and so by definition of unites, a1 a2 is a unit mod m. The can also be stated by using a table below. Claim 1 2 3 4 5 Statement a1 , a2 are units (mod m) ∃b1 , b2 ∈ Z such that a1 b1 ≡ 1, a2 b2 ≡ 1 (mod m) (a1 a2 )(b1 b2 ) ≡ (a1 b1 )(a2 b2 ) ≡ 1 (mod m) ∃b ∈ Z such that (a1 a2 )b ≡ 1 (mod m) a1 a2 is a unit (mod m). 4 Reason Assumption Definition of units Mod m multiplication, side by side of (2) Let b = b1 b2 , and by (3). Definition of units