MATH 1310: Freshman Seminar Unit 1 1. Powers in mod m arithmetic In this chapter, we ll learn an analogous result to Fermat s theorem. Fermat s theorem told us that if p is prime and p does not divide a, then there is a number k so that a k 1 mod p. In fact, k = p 1 works. In this result, we ll see that if m is any number and gcd(a,m) = 1, then there is a number k so that a k 1 (mod m). In fact, we can take k = φ(m), where φ(m) is the Euler function from Unit 10. We ll use the result a φ(m) 1 (mod m) when gcd(a,m) = 1 to compute a n (mod m) for very large numbers of n. 1.1. Some examples. Let s start by looking at some tables of powers. Here is a table of powers mod 9. In the table, the entry 7 in the 4-row, -column, means that 4 7 (mod 9). Mod 9 table of powers, I n 1 2 3 4 6 7 8 9 10 11 12 2 n 2 4 8 7 1 2 4 8 7 1 3 n 3 0 0 0 0 0 0 0 0 0 0 0 4 n 4 7 1 4 7 1 4 7 1 4 7 1 n 7 8 4 2 1 7 8 4 2 1 6 n 6 0 0 0 0 0 0 0 0 0 0 0 7 n 7 4 1 7 4 1 7 4 1 7 4 1 8 n 8 1 8 1 8 1 8 1 8 1 8 1 Let s make some observations about the table: 1. Once a 1 appears in a column, the pattern leading up to the 1 repeats over and over. For example, 4 3 1 (mod 9), and the first three powers are 4, 7, 1. The pattern 4, 7, 1, 4, 7, 1, 4, 7, 1,... repeats over and over. 2. The rows 1 n, 2 n, 4 n, n, 7 n, and 8 n are quite different from the rows 3 n and 6 n. If you think for a moment, you ll realize that 1, 2, 4,, 7, 8 are the numbers a so that a and 9 are relatively prime, while 3 and 6 are not relatively prime to 9. Guided by this, let s look at a table of Mod 9 powers without including the 3-row and 6-row: Mod 9 table of powers, II n 1 2 3 4 6 7 8 9 10 11 12 2 n 2 4 8 7 1 2 4 8 7 1 4 n 4 7 1 4 7 1 4 7 1 4 7 1 n 7 8 4 2 1 7 8 4 2 1 7 n 7 4 1 7 4 1 7 4 1 7 4 1 8 n 8 1 8 1 8 1 8 1 8 1 8 1 Now we can observe that every entry in the 6-column is 1, which means: 1
2 a 6 1 (mod 9) provided that gcd(a, 9) = 1. Now let s look at a table of mod 10 powers. Guided by the example of mod 9 powers, we ll only look at a k (mod 10) when gcd(a, 10) = 1. The mod 10 numbers that are relatively prime to 10 are 1, 3, 7, 9, so we ll only look at a k (mod 10) for these values of a. n 1 2 3 4 6 7 8 9 10 11 12 Mod 10 table of powers 3 n 3 9 7 1 3 9 7 1 3 9 7 1 7 n 7 9 3 1 7 9 3 1 7 9 3 1 9 n 9 1 9 1 9 1 9 1 9 1 9 1 In this case, we see that a 4 1 (mod 10) whenever a is relatively prime to 10, which is another way of saying that the 4-column of the table has all entries equal to 1. 1.2. Euler s theorem and applications. In this section, we ll discuss Euler s theorem and see how to use it to compute powers. As in Unit 10, φ(m) is the Euler φ-function, which counts numbers from 1 to m that are relatively prime to m. Theorem 1.1. Let m be a number. Then if a is a number relatively prime to m, a φ(m) 1 (mod m). Let s consider a few examples. First, we ll take m = 9. Then since 9 = 3 2, φ(9) = 9 2 = 6, using the formula for computing φ(9) from Unit 10, section 1.3. So if we 3 let m = 9 in Euler s theorem, the statement translates as: a 6 1 (mod 9) whenever a and 9 are relatively prime. This is exactly what we saw from the Mod 9 table of powers, so Euler s theorem agrees with what we already knew in this case. Now, let s try this with m = 10 and see if it agrees with what we know. Since 10 = 2, φ(10) = 10 1 2 4 = 4. So when m = 10, Euler s theorem says: a 4 1 (mod 10) when a and 10 are relatively prime. This agrees with the mod 10 table of powers. Finally, let s consider the case where m = p is a prime number. Then φ(p) = p p 1 = p 1, so Euler s theorem asserts that: p a p 1 1 (mod p) whenever a and p are relatively prime, which is the same as saying that p does not divide a. This means that Euler s theorem agrees with Fermat s theorem when m is prime. This is nice, but for you, the main point is to be able to compute using Euler s theorem. EXAMPLE: Compute 7 322 (mod 20). To do this, we use Euler s theorem. The first step is to compute φ(20). Since 20 = 2 2, φ(20) = 20 1 2 4 = 8. So since 7 and 20 are relatively prime, it follows that: 7 8 1 (mod 20).
Now divide 8 into 322, it goes in 40 times with remainder 2, so 322 = 40 8 + 2. It follows that: 7 322 7 8 40+2 (7 8 ) 40 7 2 1 40 7 2 (mod 20), using rules of expondents and Euler s theorem. But But 1 40 7 2 7 2 49 9 (mod 20), so putting this together, we conclude that 7 322 9 (mod 20). Remark 1.2. Another way of writing out the solution is to say that since 322 2 (mod 8), it follows that 7 322 7 2 (mod 20). In other words, the 40 in 322 = 40 8 + 2 is not essential, because it just comes in as a power of 1: 1 40 1 (mod 20). GENERAL RULE: If k r (mod φ(m)), then a k a r (mod m). We can justify this rule, following what we did in the last problem. If k r (mod φ(m)), then k = s φ(m) + r for some number s. But then: a k a s φ(m)+r a s φ(m) a r (mod m), so a k (a φ(m) ) s a r 1 s a r a r (mod m), since a φ(m) 1 (mod m). PROBLEM: Compute 12 268 (mod 3). To solve this, we first check that 12 and 3 are relatively prime, so we can use Euler s theorem. Then we compute φ(3) = 3 4 6 = 24. Now divide 24 into 268, and we 7 find 268 4 (mod 24), since 264 = 11 24 + 4. From this, we can deduce using the GENERAL RULE from the last remark that: 12 268 12 4 (mod 3). It remains to compute 12 4 (mod 3). You can either do that using a calculator, or compute 12 2 144 4 (mod 3), so 12 4 12 2 12 2 4 4 16 (mod 3), so 12 268 16 (mod 3) solves the problem. PROBLEM: Compute 7 1688 (mod 180). To solve this problem, first check that 7 and 180 are relatively prime, which is easy since 180 = 2 2 3 2. Thus, φ(180) = 180 1 2 2 3 4 = 48. Now divide 48 into 1688, to find 1688 = 48 3 + 8, so 1688 8 (mod 48). Using the GENERAL RULE from Remark 1.2, we find: 7 1688 7 8 (mod 180). It s no fun trying to compute 7 8 (mod 180) without a calculator, but with a calculator you can see easily that: 7 8 764801 121 (mod 180). From this, we conclude that 7 1688 121 (mod 180), which solves the problem. PROBLEM: Compute 13 732 (mod 77). Since 77 = 7 11, 77 and 13 are relatively prime, and φ(77) = 60. A quick computation gives 732 12 (mod 60), so 13 732 13 12 (mod 77), so we just need to compute 13 12 (mod 77), which we can do using successive squares. This gives: 3
4 13 2 169 1 (mod 77), so 13 4 13 2 13 2 1 1 22 6 (mod 77) 13 8 13 4 13 4 6 6 36 (mod 77). Then 13 12 13 8+4 13 8 13 4 36 6 216 62 1 (mod 77), i.e., 13 12 1 (mod 77), which solves the problem. PROBLEM: Compute 1 7 (mod 3). This is a trick question. Since gcd(1, 3) =, 1 and 3 are not relatively prime, so we just have to try computing successive squares, as in the beginning of Unit 14. We get: 1 2 22 1 (mod 3). 1 4 1 2 1 2 1 1 1 2 1 (mod 3), which gives: 1 7 1 4+2+1 1 4 1 2 1 1 1 1 1 (mod 3), so 1 7 1 (mod 3) is the solution. 1.3. Justification for Euler s theorem. Euler s theorem is true for essentially the same reason that Fermat s theorem is true. To see this, let s try to justify Euler s theorem in a mod 18 example. Since 18 = 2 3 2, φ(18) = 6, and the numbers from 1 to 18 relatively prime to 18 are 1,, 7, 11, 13, 17. We ll show that 7 6 1 (mod 18), as Euler s theorem predicts, without computing powers. We compute the 7-row for multiplication mod 18 with numbers relatively prime to 18: 7 1 7 (mod 18) 7 17 (mod 18) 7 7 13 (mod 18) 7 11 (mod 18) 7 13 1 (mod 18) 7 17 11 (mod 18) It follows that: EQUATION (*): (7 1) (7 ) (7 7) (7 11) (7 13) (7 17) 7 17 13 1 11 (mod 18) By factoring out the first 7 in each factor in parentheses, the left-hand side of this EQUATION (*) can be written as: 7 6 1 7 11 13 17 7 6 C (mod 18), where C = 1 7 11 13 17. The right-hand side of EQUATION (*) is C (mod 18), since it has the same factors as C, but in different order. This means we can rewrite EQUATION (*) as: EQUATION (**): 7 6 C C (mod 18). Note that C = 1 7 11 13 17 is relatively prime to 18 since it has no factors divisible by 2 or 3. Thus, (**) to get: 7 6 C 1 C C 1 C 1 C 1 (mod 18), so (mod 18) exists, so we can divide by C in EQUATION
7 6 1 1 (mod 18) and finally, 7 6 1 (mod 18). EXERCISES: (1) Do the following computations in mod 22 arithmetic. Does the last step verify Euler s theorem? (a) Compute 2 (mod 22) (b) Compute 4 (mod 22) (c) Compute 8 (mod 22) (d) Compute 10 (mod 22) (2) Do the following computations in modular arithmetic. (a) Compute 7 8 (mod 30) (b) Compute 11 24 (mod 70). (c) Compute 2 24 (mod 70). (d) Compute 37 80 (mod 300). (e) Compute 20 (mod 2). (f) Compute 72 (mod 91). (3) Do the following computations in modular arithmetic. (a) Compute 7 13 (mod 30). (b) Compute 3 387 (mod 221). (c) Compute 367 (mod 2). (d) Compute 7 1021 (mod 6). (e) Compute 7 63 (mod 44). (4) Explain why 6 1 (mod 18) following the method used to show that 7 6 1 (mod 18) in Section 1.3 of this unit.