1.6 Mass point geometry
2.1.6 Fermat’s and Euler’s theorems
We start with a potentially surprising observation. Namely we consider integers a not divisible by 7 and consider powers a6, reduced modulo 7. Note that we may, by the division algorithm, write a = 7q + r, where since a is not divisible by 7, then 1 ≤ r ≤ 6. Therefore, using the binomial theorem, we get
16This is Problem #2 on the 20th USA Mathematical Olympiad, April 23, 1991. It’s really not
a6 = 6 X k=0 Ñ 6 k é (7q)kr6−k ≡r6(mod 7).
This reduces matters to only six easily verifiable calculations: 16 ≡1(mod 7), 26 ≡ 1(mod 7), 36 ≡ 1(mod 7),
46 ≡ (−3)6 ≡ 1(mod 7), 56 ≡(−2)6 ≡ 1(mod 7), 66 ≡(−1)6 ≡ 1(mod 7).
In other words, for any integer a not divisible by 7, we have ap−1 ≡ 1(mod 7).
In order to generalize the above result, we shall first make the fol- lowing observation, namely that if x and y are arbitrary integers, and if p is a prime number, then using exercise 9 on page 62 we get
(x+y)p ≡ p X k=0 Ñ p k é xkyp−k ≡ xp+yp(mod p).
That is to say, for any integers x and y and any prime number p, we have
(x+y)p ≡ xp+yp(mod p).
Theorem. (Fermat’s Little Theorem) Let p be a prime number. Then for all integers a not divisible by p we have
ap−1 ≡ 1(mod p).
Proof. There are a number of proofs of this fact;17 perhaps the most
straightforward is based on the Binomial Theorem together with the
17It is interesting to note that while Fermat first observed this result in a letter in 1640, the first
SECTION 2.1 Elementary Number Theory 87 above observation. Note first that it suffices to assume that a ≥ 1; we shall argue by induction on a. Note that if a = 1 the result is clearly valid. Next, assuming that a > 1, then by induction we may assume that (a−1)p ≡ (a−1)(mod p). From this we proceed:
ap ≡ ((a−1) + 1)p
≡ (a−1)p+ 1p (by the above result) ≡ a−1 + 1 (by induction)
≡ a(mod p),
which completes the proof.
There is a striking generalization of Fermat’s Little Theorem, as follows. I won’t prove this here as the most natural proof of this is within the context of group theory. Anyway, recall the Euler φ-function (see Exercise 16 on page 63), defined by setting
φ(n) = # of integers m, 1 ≤ m < n which are relatively prime with n.
This obviously says, in particular that if p is prime then φ(p) = p−1. Theorem. (Euler’s Theorem) Let n be any positive integer. Then for any integer a with gcd(a, n) = 1 we have
aφ(n) ≡1(mod n).
Note that Euler’s Theorem obviously contains Fermat’s Little Theorem as a corollary.
Exercises
1. Compute the units digit of (23)987
2. Compute the least positive integer solution of n≡ 123139(mod 7). 3. Compute the least positive integer solution of n≡ 506106(mod 11).
4. Let p be a prime number. The integers a and b are said to be
multiplicative inverses modulo p if ab ≡ 1(mod p). Using the Euclidean trick, prove that if p doesn’t divide a, then a has a multiplicative inverse modulo p.
5. Find the multiplicative inverse of 2 modulo 29. 6. Find the multiplicative inverse of 3 modulo 113. 7. Prove Wilson’s Theorem:
(p−1)!≡ −1(mod p),
where p is a prime. (Hint; pair each divisor of (p −1)! with its inverse modulo p; of course, this requires the result of exercise 4, above.)
8. The order of the integera modulo the prime p is the least positive integer n such that an ≡ 1(mod p). Show that n|p− 1. (Hint: show that if d = gcd(n, p−1), then ad ≡ 1(mod p).)
9. As we saw from Fermat’s little theorem, if p is prime and if a
is an integer not divisible by p, then ap−1 ≡ 1 (modp). What about the converse? That is, suppose that n is a positive integer and that for every integer a relatively prime to n we have an−1 ≡ 1 (modn). Must n then be prime? Looking for a counter example takes some time, leading one to (almost) believe this converse. However, suppose that we were to find a candidate integer n and found that for every prime divisor p of n, that p −1|n−1. Show that n satisfies the above.18
10. Here’s a very surprising application of Euler’s Theorem, above.19 Define the sequence a1, a2, . . . , by setting a1 = 2, a2 = 2a1, a3 = 2a2, . . .. Then for any integer n, the sequence a
1, a2, . . . , even- tually becomes constant (mod n). The proof proof proceeds by induction on n and can be carried out along the following lines.
18Such an integer is called a Carmichael number, the first such being n= 561, which is why
the converse to Fermat’s little theorem can appear true! It is known that there are, in fact, infinitely many Carmichael numbers, which means that there are infinitely many counter examples to the converse of Fermat’s little theorem.
19I’m indebted to my student, Nelson Zhang, for pointing out this exercise, commenting also that
this is Problem #3 on the 1991 USA Olympiad contest. The hints given above are the result of our discussion.
SECTION 2.1 Elementary Number Theory 89 (a) Since φ(n) < n for all n, we see that the sequence a1, a2, . . . ,
eventually becomes constant modulo φ(n).
(b) Write n = 2rk, where k is an odd integer. Since a1, a2, . . . , eventually becomes constant modulo φ(n), it also eventually becomes constant modulo φ(k).
(c) Conclude from Euler’s Theorem (87) that a1, a2, . . . , eventu- ally becomes constant modulo k.
(d) Argue that a1, a2, . . . , eventually becomes constant modulo 2r and hence eventually becomes constant modulo n.