MATH 470.200/501 Examination 1 Solutions October 6, 2011 1. Complete the statements of the following theorems and definitions we have covered. Solution: The following are valid answers, but there are other possibilities. (a) Let a and m be integers. Then a has a multiplicative inverse modulo m if and only if a and m satisfy gcd(a, m) = 1 . (b) (Fundamental Theorem of Arithmetic) Every integer greater than 1 can be factored into the product of prime numbers in a unique way up to the order of the factors . (c) (Euler’s Theorem) Let m be a positive integer and let b be an integer with gcd(m, b) = 1. If we set φ(m) := #{a ∈ Z | 1 ≤ a ≤ m, gcd(a, m) = 1} , then bφ(m) ≡ 1 (mod m) . (d) (Chinese Remainder Theorem) For m and n relatively prime positive integers and integers a and b, the congruences x ≡ a (mod m), x ≡ b (mod n), can be solved simultaneously by a unique congruence class modulo mn . 2. (a) Use the Euclidean Algorithm to find gcd(2537, 4189) and to find one solution of 2537x + 4189y = gcd(2537, 4189) with x, y ∈ Z. Show your work. (b) Using your findings in part (a), find a multiplicative inverse of 43 modulo 71. Show your work. Solution: (a) We first perform the Euclidean algorithm to find gcd(2537, 4189): 4189 = 2537 + 1652, 2537 = 1652 + 885, 1652 = 885 + 767, 885 = 767 + 118, 767 = 6 · 118 + 59, 118 = 2 · 59 + 0. By the Euclidean algorithm, we conclude that gcd(2537, 4189) = 59 . Now we backsubstitute to find x and y: 59 = 767 − 6 · 118 = 767 − 6(885 − 767) = 7 · 767 − 6 · 885 = 7(1652 − 885) − 6 · 885 = 7 · 1652 − 13 · 885 = 7 · 1652 − 13(2537 − 1652) = 20 · 1652 − 13 · 2537 = 20(4189 − 2537) − 13 · 2537 = 20 · 4189 − 33 · 2537. 1 We can therefore take x = −33 and y = 20 . (b) In part (a), we show that 59 = −33 · 2537 + 20 · 4189. If we divide through by 59, we obtain 1 = −33 · 43 + 20 · 71. If we reduce this equation modulo 71, we see that −33 · 43 ≡ 1 (mod 71). Therefore 43−1 ≡ −33 ≡ 38 (mod 71) . 3. Find all congruence classes of solutions modulo 91 of the following congruences. Be sure to show your work. Solving by trial and error will yield no more than half credit. (a) 3x ≡ 20 (mod 91) (b) 7x ≡ 56 (mod 91) Solution: (a) Since gcd(3, 91) = 1, we know this congruence has a unique solution. We first look for 3−1 mod 91. There are various ways to do this, but since 183 = 2 · 91 + 1 = 3 · 61, we see that 3−1 ≡ 61 (mod 91). Multiplying the given congruence through by 61, we see that x ≡ 20 · 61 ≡ 37 (mod 91) . (b) Since gcd(7, 91) = 7 and 7 | 56, there will be 7 congruence classes of solutions to this congruence modulo 91. Dividing through by 7, we obtain x ≡ 8 (mod 13). Therefore the classes of solutions mod 91 are x ≡ 8 (mod 91), x ≡ 21 (mod 91), x ≡ 34 (mod 91), x ≡ 47 (mod 91) x ≡ 60 (mod 91), x ≡ 73 (mod 91), x ≡ 86 (mod 91). 4. Calculate φ(360), where φ is Euler’s φ-function. Show your work. Solution: First we factor 360 = 23 · 32 · 5. Then φ(360) = φ(23 )φ(32 )φ(5) = (8 − 4) · (9 − 3) · (5 − 1) = 4 · 6 · 4 = 96 . 5. We use the following alphabet: A B C D E F G 00 01 02 03 04 05 06 P Q R S T U V 15 16 17 18 19 20 21 H I J K L M 07 08 09 10 11 12 W X Y Z . ♥ 22 23 24 25 26 27 N O 13 14 ♣ 28 (a) Using the affine cipher x → 6x + 8 (mod 29), encrypt the plaintext message EULER into its ciphertext. (b) Someone has sent you the message A♥♣D using the encryption key in part (a). What did they say? (c) Suppose we had instead used a 30 letter alphabet, and used the encryption method x → 6x + 13 (mod 30). What problem would we have with this encryption scheme? 2 Solution: (a) We calculate easily that 4 7→ 3, 20 7→ 12, 11 7→ 16, and 17 7→ 23 under this affine cipher. So the ciphertext is DMQDX . (b) If we solve y ≡ 6x + 8 (mod 29) for x, we obtain x ≡ 61 (y − 8) ≡ 5y + 18 (mod 29) (since 6−1 ≡ 5 (mod 29)). Therefore upon decryption 0 7→ 18, 27 7→ 8, 28 7→ 13, and 3 7→ 4. So the plaintext is SINE . (c) Since gcd(6, 30) 6= 1, there is no multiplicative inverse of 6 modulo 30. This causes us not to be able to decrypt messages uniquely, as multiple letters/numbers would encrypt to the same thing. For example, 5 and 10 would both encrypt to 13. 6. Answer Yes or No to each of the following questions. In this problem ‘FLT’ stands for ‘Fermat’s Little Theorem’. Be careful: a lot of the numbers below look alike. (a) The number 31405529 is prime. Does FLT imply that 2001131405529 ≡ 20011 (mod 31405529)? (b) We know that 2001131405500 ≡ 1 (mod 31405501). Does FLT imply that 31405501 is prime? (c) We know that 2001131405480 ≡ 11935342 (mod 31405481). Does FLT imply that 31405481 is composite? Solution: The explanations here were not required for credit but may help illuminate things. (a) Yes : This was one of the formulations of Fermat’s Little Theorem. (b) No : The conclusion of Fermat’s Little Theorem can still hold, even if the modulus is not prime. In fact, 31405501 = 71 · 631 · 701. (c) Yes : If 31405481 were prime, then Fermat’s Little Theorem would imply that 2001131405480 must be 1 modulo 31405481. But it isn’t, so 31405481 must be composite. 7. Find a primitive root modulo 7. Justify your answer. Solution: The possible answers here are 3 or 5 . To demonstrate that 3 is a primitive root modulo 7, we observe that 31 ≡ 3 (mod 7), 34 ≡ 4 (mod 7), 32 ≡ 2 (mod 7), 35 ≡ 5 (mod 7), 33 ≡ 6 (mod 7), 36 ≡ 1 (mod 7). Since 6 = 7 − 1 is the first power of 3 that is 1 modulo 7, we conclude that 3 is a primitive root for 7. Equivalently, since the powers of 3 modulo 7 fill out all of the congruences of {1, 2, 3, 4, 5, 6}, we can reach the same conclusion. 8. Suppose there is a language that only has the letters Y and Z. The frequency of the letter Y is 0.9, and the frequency of the letter Z is 0.1. A message is encrypted using a Vigenè€re cipher (working mod 2 instead of mod 26). The ciphertext is YZYZYZZZYZ. (a) Show that the key length is probably 2. 3 (b) Using the information on the frequencies of the letters, determine the key and decrypt the message. Solution: (a) We shift the ciphertext and count letters that coincide: YZYZYZZZYZ YZYZYZZZYZ YZYZYZZZYZ YZYZYZZZYZ YZYZYZZZYZ We see that in shifting by 1 there are 2 letters in agreement; by 2 there are 6 letters in agreement; by 3 there are 2 letters in agreement; and by 4 there are 5 letters in agreement. Shifting by any more will certainly have less than 6 coincidences, so the key length is probably 2. (b) With a key length of 2, we split the cipher text into two pieces, using every other letter: W0 := YYYZY W1 := ZZZZZ. Now we perform a frequency analysis. In W0 the frequencies of the letters are h0.8, 0.2i. If we let a0 := h0.9, 0.1i be the given standard frequency, and a1 := h0.1, 0.9i be the frequency when the letters are shifted by 1, then h0.8, 0.2i · a0 = 0.72 + 0.02 = 0.74, h0.8, 0.2i · a1 = 0.08 + 0.18 = 0.26. Thus we conclude that W0 is most likely not shifted, or rather shifted by ‘Y ’. For W1 , the frequency of letters is h0, 1i, so h0, 1i · a0 = 0.1, h0, 1i · a1 = 0.9. Therefore W1 is most likely shifted by ‘Z’. So the key is Y Z , and thus the plaintext message is Y Y Y Y Y Y ZY Y Y . 4