Two formulas for the Euler ϕ-function Robert Frieman A multiplication formula for ϕ(n) The first formula we want to prove is the following: Theorem 1. If n 1 an n 2 are relatively prime positive integers, then Thus for example ϕ(n 1 n 2 ) = ϕ(n 1 )ϕ(n 2 ). ϕ(36) = ϕ(4 9) = ϕ(4)ϕ(9) = 2 6 = 12. On the other han, if n 1 an n 2 are not relatively prime, then it is never the case that ϕ(n 1 n 2 ) = ϕ(n 1 )ϕ(n 2 ). For example, ϕ(36) = ϕ(2 18) ϕ(2)ϕ(18) = 1 6 = 6. An easy inuction yiels the following generalization of Theorem 1: Theorem 2. If n 1,..., n 2 are positive integers such that, for all i j, n i an n j are relatively prime, then ϕ(n 1 n 2 n k ) = ϕ(n 1 )ϕ(n 2 ) ϕ(n k ). It is natural to apply Theorem 2 in the following situation: if n is factore as a prouct of istinct primes, say n = p a 1 1 pa 2 2 pa k k, where the p i are prime, a i 1, an, for all i j, p i p j, then ϕ(n) = ϕ(p a 1 1 pa 2 2 pa k k ) = ϕ(p a 1 1 )ϕ(pa 2 2 ) ϕ(pa k k ) = p a 1 1 1 (p 1 1)p a 2 1 2 (p 2 1) p a k 1 k (p k 1), 1
where we have use previous work to evaluate ϕ(p a ) for a prime power a. Using ( p a i 1 p a i ) ( ) ) i i (p i 1) = (p i 1) = p a i pi 1 i = p a i i (1 1pi, p i p i we can write the last prouct in the formula for ϕ(n) as ) ) ) p a 1 1 pa 2 2 pa k k (1 (1 1p1 1p2 (1 1pk. Finally, using n = p a 1 1 pa 2 2 pa k k, this expression takes the form ϕ(n) = n ( 1 1 ), p p n where the prouct is unerstoo to be over all of the primes iviing n. We shall prove Theorem 1 by proving a more conceptual result below. The Chinese Remainer Theorem The following result erives its name from the fact that it was known in Chinese mathematics about 100 AD in the form of a proceure for solving simultaneous ivisibility with remainer problems (although roughly equivalent formulations also turn up in Western mathematical texts aroun the same time): Theorem 3 (Chinese Remainer Theorem). If n 1 an n 2 are relatively prime positive integers an n = n 1 n 2, then, for all integers r 1, r 2, there exists an integer r such that r r 1 (mo n 1 ); r r 2 (mo n 2 ). Moreover, r is unique moulo n = n 1 n 2, in the sense that, if s is another integer such that s r 1 (mo n 1 ) an s r 2 (mo n 2 ), then r s (mo n). Proof. First we shall construct an r satisfying the conclusion; then we shall prove the uniqueness mo n. To fin r, use the fact that, since n 1 an n 2 are relatively prime, there exist integers a an b such that an 1 + bn 2 = 1. Now set r = r 2 an 1 + r 1 bn 2. 2
We claim that r has the esire properties. In fact, clearly r r 1 bn 2 (mo n 1 ). On the other han, multiplying the equation an 1 + bn 2 = 1 by r 1 gives r 1 an 1 + r 1 bn 2 = r 1. In particular, r 1 r 1 bn 2 (mo n 1 ). Using the reflexive an transitive properties of congruences, we see that r 1 bn 2 r 1 (mo n 1 ) an r r 1 bn 2 (mo n 1 ), so that r r 1 (mo n 1 ) as esire. The proof that r r 2 (mo n 2 ) is very similar an we will leave it to you. Now suppose that s is also an integer such that s r 1 (mo n 1 ) an s r 2 (mo n 2 ). Then r s 0 (mo n 1 ) an r s 0 (mo n 2 ). We nee to show that r s 0 (mo n), for then r s (mo n). To see this, note that by efinition, since r s 0 (mo n 1 ), n 1 ivies r s; say r s = n 1 k for some integer k. Since n 2 ivies r s = n 1 k an n 2 is relatively prime to n 1, it follows that n 1 ivies k; say k = n 2 l. Thus r s = n 1 n 2 l = nl, so that r s 0 (mo n). Hence r s (mo n). Note that the metho for fining r in the proof of the Chinese Remainer Theorem is completely constructive, once we know how to fin a, b such that 1 = an 1 + bn 2 (which we can fin using the Eucliean algorithm). Example 4. Let us fin an integer x such that x 3 (mo 13) an x 7 (mo 9). To fin x, first write 1 as a multiple of 13 plus a multiple of 9. We shall just give such an expression: 1 = 7 13 10 9. Here n 1 = 13, n 2 = 9, r 1 = 3, r 2 = 7, an a = 7, b = 10. Following the recipe of the proof of the Chinese Remainer Theorem, we shoul take r = 7(7 13) + 3 ( 10 9) = 637 270 = 367. Thus r = 367 solves the problem. However, we are only concerne with congruence mo 13 9 = 117, an 367 16 (mo 117) since 367 16 = 351 = 3 117. Thus, the smallest positive r which is congruent to 3 mo 13 an 7 mo 9 is 16. It is natural to ask for necessary an sufficient conitions for solving the pairs of congruences r r 1 (mo n 1 ) an r r 2 (mo n 2 ) in case n 1 an n 2 are not relatively prime. We shall iscuss this in the exercises. One way to interpret the Chinese Remainer Theorem is as follows. Given relatively prime positive integers n 1 an n 2 an n = n 1 n 2, if we have prescribe remainers r 1 an r 2 for n 1 an n 2 respectively (0 r 1 n 1 1 an 0 r 2 n 2 1), in other wors we want to fin an integer r with remainer r 1 when ivie by n 1 an remainer r 2 when ivie by n 2, then 3
we can always fin such an integer, an its remainer after long ivision by n is uniquely specifie by this conition. Since there are n 1 possible integers r 1 satisfying 0 r 1 n 1 1 an n 2 possible integers r 2 satisfying 0 r 2 n 2 1, the number of pairs (r 1, r 2 ) of such integers is n 1 n 2 = n, an this is of course the number of possible remainers r, i.e. integers r with 0 r n 1. To use the above iea to get information about the Euler ϕ-function, we recall the following lemma (Corollary 12 in Lecture 4): Lemma 5. Let n be a positive integer. Then a 1 an a 2 are both relatively prime to n if an only if a 1 a 2 is relatively prime to n. Applying this lemma to r, n 1, n 2, we see that r is relatively prime to n 1 an n 2 if an only if r is relatively prime to n = n 1 n 2. It follows that an integer r, 0 r n 1 an relatively prime to n, is uniquely specifie by two integers r 1 an r 2, where 0 r 1 n 1 1, r 1 is relatively prime to n 1, 0 r 2 n 2 1, an r 2 is relatively prime to n 2. Counting up an using the efinition of the ϕ-function, we see that we have prove Theorem 1: If n 1 an n 2 are relatively prime positive integers, then ϕ(n 1 n 2 ) = ϕ(n 1 )ϕ(n 2 ). An example may make this clearer. In the following table, we tabulate the possible pairs of remainers (r 1, r 2 ) mo 2 an 3 respectively, an the corresponing remainer r mo 6. You can then check irectly that r is relatively prime to 6 if an only if r 1 is relatively prime to 2 (r 1 = 1) an r 2 is relative prime to 3 (r 2 = 1, 2). (r 1, r 2 ) (0,0) (1,0) (0,1) (1,1) (0,2) (1,2) r 0 3 4 1 2 5 A secon formula for ϕ(n) The formula in question is the following: Theorem 6. For all positive integers n, n = n ϕ(). 4
The formula means that, if we sum up ϕ() over all of the ivisors of n (incluing 1 an n), then the result is n. For example, 18 = ϕ(1) + ϕ(2) + ϕ(3) + ϕ(6) + ϕ(9) + ϕ(18) = 1 + 1 + 2 + 2 + 6 + 6. As with our first formula, we shall erive Theorem 6 from a more conceptual result. We begin with the following efinition. Definition 7. Let n be a positive integer, an let a be an integer. The orer of a mo n is the smallest positive integer k such that ak 0 (mo n), i.e. such that n ivies ak. Example 8. 1. Since n an for every a, the orer of a is well-efine an is always less than or equal to n. 2. The orer of 0 is 1. 3. The orer of 1 is n. 4. More generally, if the gc of a an n is 1, the orer of a is n. (If a an n are relatively prime an n ak, then n k an hence the orer is a multiple of n. Since the orer of a mo n is also positive an less than or equal to n, it is exactly n.) 5. If a b (mo n), then a an b have the same orer mo n. (The proof is an exercise.) Generalizing (4) above, we have the following: Proposition 9. The orer of a mo n is n/, where is the gc of a an n. Proof. First note that, since a an n, ( n ) ( a a = n, ) which is thus a multiple of n. Hence the orer of a is at most n/. To see that the orer is exactly, recall that a/ an n/ are relatively prime. (There exist integers x, y such that ax + ny =. Diviing through by gives ( a ( n ) 1 = x + y, ) 5
so that a/ an n/ are relatively prime.) Now if k is the orer of a mo n, then k is a positive integer an n ivies ak. Hence n/ ivies (a/)k (if ak = nl, then (a/)k = (n/)l). But since a/ an n/ are relatively prime, if n/ ivies (a/)k, then n/ ivies k, an hence k is at least n/. Since k is also at most n/, it is exactly n/. Corollary 10. The orer of a mo n ivies n. Corollary 11. The orer of a mo n is n if an only if a an n are relatively prime. Proof. Proposition 9 implies that the orer of a mo n is n if an only if the gc of a an n is 1, i.e. if an only if a an n are relatively prime. Following the train of though in Corollary 11, we can ask the following question: Given a positive integer, how many integers a have orer mo n? If oes not ivie n, then there are none, by Corollary 10, so we shall always assume that ivies n. Of course, we are only intereste in a up to congruence mo n (otherwise there are always infinitely many possible a), so we coul ask more precisely how many integers r with 0 r n 1 have orer. For example, r has orer n mo n if an only if r an n are relatively prime, by Corollary 11, so the number of r with 0 r n 1 which have orer n mo n is ϕ(n). Generalizing this, we have: Proposition 12. If n, then there are exactly ϕ() integers r with 0 r n 1 whose orer mo n is. Proof. Let ivie n, an suppose that r has orer mo n, where 0 r n 1. Then n r, an hence n/ ivies r. Write r = b n for some. Since 0 r n 1, 0 b 1. It now clearly suffices to show that b n has orer mo n if an only if b is relatively prime to, since there are exactly ϕ() such integers b with 0 b 1. First note that b n = bn, which is clearly ivisible by n, so that the orer of b n n mo n is at most. Now n ivies k b for some k if an only if nl = k b n for some integer l, if an only if l = kb, if an only if ivies kb. If b an are relatively prime, ivies kb if an only if ivies k, an so the orer of b n is at least if b an are relatively prime. Thus, the orer of 6
b n is exactly if b an are relatively prime. If an b have a common factor e > 1, then ivies e b = b n, an hence the orer of b is at e most /e < e. Thus, b n has orer mo n if an only if b is relatively prime to, an hence there are exactly ϕ() integers r with 0 r n 1 whose orer mo n is. We now show that Theorem 6 is a corollary of Proposition 12. Given r with 0 r n, it has some orer mo n, an n ivies. Moreover, by Proposition 12, there are exactly ϕ() integers r with 0 r n such that r has orer mo n. Hence n ϕ() counts up every r with 0 r n, exactly once, an so n ϕ() = n. Exercises Exercise 1. Calculate ϕ(180); ϕ(900). Exercise 2. What are all positive integers n with ϕ(n) = 1? With ϕ(n) = 2? Exercise 3. How many o numbers are there which are less than one million an whose last igit is not 5? Exercise 4. Fin a number which is congruent to 6 mo 12 an to 1 mo 13. What is the smallest such positive number? Exercise 5. A ban of 13 pirates stole a chest containing a certain number of gol coins. They trie to ivie them up equally, but there were 8 left over. Two pirates ie of smallpox, an they trie to ivie up the coins again. This time there were 3 left over. They then shot three pirates an trie again, but there was a remainer of 5 coins this time. What was the smallest possible number of coins? Exercise 6. What is the orer of 36 mo 45? Of 13 mo 100? Exercise 7. Let k an n be positive integers. Suppose that a b (mo n). Is it always the case that a b (mo k)? Fin an example where this oes not hol for n = 5 an k = 2. However, suppose that in aition k n. Show that, if a b (mo n), then a b (mo k). 7
Exercise 8. Suppose that n 1 an n 2 are two positive integers, not necessarily relatively prime, an that = gc(n 1, n 2 ). Suppose that r 1 an r 2 are two integers an that there exists an integer r such that r r 1 (mo n 1 ) an r r 2 (mo n 2 ). Show that r 1 r 2 (mo ). (One can show the following: Conversely, if n 1, n 2 an are as above, an r 1 an r 2 are two integers such that r 1 r 2 (mo ), then there exists an integer r such that r r 1 (mo n 1 ) an r r 2 (mo n 2 ).) 8