Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Fermat Little Theorem

Download as pdf or txt
Download as pdf or txt
You are on page 1of 6

Congruences, Powers,

and Fermat’s Little Theorem

Take a number a and consider its powers a. (1. a .


3 modulo in. Is there any
. . .

pattern to these powers? We will start by looking at a Prime modulus in = p


since the pattern is easier to spot. This is a common situation in the theory of
numbers, especially when working with congruences. So whenever you’re faced
with discovering a congruence pattern, it’s usually a good idea to begin with a
prime modulus.
For each of the primes p 3. p = 5, and p 7. ‘e have listed integer
a = 0. 1. 2.... and some of their powers modulo p. Before reading further, you
should stop. examine these tables. and try to formulate some conjectural patterns.
Then test your conjectures by creating a similar table for]) = 11 and seeing if your
patterns are still true.

U
9
(1. a
3 it -1 a
5 a (i Ci
7 (I 8

1) 0 0 0 0 0 0 0
a, 2
a
(3 c11 ,5 ((()
11111111
000000 24124124
(1 a,2 3 (i
111111 32645132
0w0 0 0 243124 42142142
1 1 1 342134 54623154
2 1 414141 61616161
A modulo 3 a inodulo .5 a modulo 7

Many interesting patterns are visible in these tables. The one that we will be

From Chapter 9 of A Friend!)’ Jntrothfttion to Number Theory. Fourth Edition. Joseph H. Silverman.
Copyright © 2013 by Pearson Education, Inc. All rights reserved.
68 Congruences, Powers, and Ferrnat’s Little Theorem

concerned with in this chapter can be seen in the columns


4 and 06 (mod 7)
02 (mod 3). (mod 5).

Every entry in these columns. aside from the top one, is equal to 1. Does this
pattern continue to hold for larger primes? You can check the table YOU made for
p = 11, and you will find that
310
110 1 (mod 11). 210
1 (mod 11), 1 (mod 11)...
910
1 (mod 11). and 1010 1 (mod 11).

This leads us to make the following conjecture:

1 (mod p) for every integer 1 < ci < p.

Of course, we don’t really need to restrict a to be between 1 and p 1. If a


1 —

and a2 differ by a multiple of p. then their powers will be the same modulo p. So
the real condition on a is that it not be a multiple of p. This result was first stated
by PielTe de Fermat in a letter to Frénicle de Bessy dated 1640. but Fermat gave
no indication of his proof. The first known proof appears to be due to Gottfried
Leibnizi

Theorem 1 (Fermat’s Little Theorem). Let p be a prune nianbe,; and let a be ant
number with a 0 (mod p). Then

1 (moclp).

Before giving the proof of Fermat’s Little Theorem we want to indicate its
power and show how it can he used to simplify computations. As a particular
xamp] e. consider the congruence

622 1 (mod 23).

This says that the number 622 1 is a multiple of 2:3. If we wanted to check this

622,
fact without using Fermat’s Little Theorem, we would have to inuhiply out
subtract I, and divide by 23. Here’s what we get:

622 — 1 = 23. 5722682775750745.

Gotifried Leibniz (1646—1716) is best known as one of the discoverers of the calculus. He and
Isaac Newton worked out the main theorems of the calculus independently and at about the same
time. The German and Engtish mathematical communities spent the next two centuries arguing over
who deserved priority. The current consensus is that both Leihniz and Newton should be given joint
credit as the (independent) discoverers of the calculus.
Congruences. Powers, and Fermat’s Little Theorem 69

Similarly, in order to verify directly that 73100 1 (mod 101), we would have to
compute 73100 — 1. Unfortunately, 73100 1 has 187 digits! And notice that this

example only uses p = 101, which is a comparatively small prime. Fermat’s Little
Theorem thus describes a very surprising fact about extremely large numbers.
We can use Fermat’s Little Theorem to simplify computations. For example.
in order to compute (mod 7), we can use the fact that 26 1 (mod 7). So we
write 35 6 5 + 5 and use the law of exponents to compute
= 265±5 = (26)5 . 2 1° 2.
32 4 (mod 7)

Similarly, suppose that we want to solve the congruence 1103 4 (mod 11).
Certainly, .c 0 (mod 11), so Fermat’s Little Theorem tells us that

1 (mod 11).

Raising both sides to the 10


th
power gives 1 (mod 11), and then multiply
33
ing by gives 1103 3 (mod 11). So, to solve the original congruence. we just
x
need to solve x
3 4 (mod 11). This can be solved by trying successively .c = 1,
x = 2, .... Thus,

(mod11) 0123 45 67 89 10
(rnodll)
3 0 1 8 5 94 72 6H 10

So the congruence 4 (maci 11) has the solution i: 5 (mod 11).


We are now ready to prove Fermat’s Little Theorem. In order to illustrate the
method of proof, we will first prove that 36 1 (mod 7). Of course, there is no
need to give a fancy proof of this fact, since 36 1 = 728 = 7 104. Nevertheless,
—.

when attempting to understand a proof or when attempting to construct a proof, it


is often worthwhile using specific numbers. Of course, the idea is to devise a proof
that doesn’t really use the fact that we are considering specific numbers and then
hope that the proof can he made to work in general.
To prove that 36 1 (mod 7), we start with the numbers

1, 2, 3, 4, 5, 6,

multiply each of them by 3. and reduce inodulo 7. The results are listed in the
following table:

•‘ X (mod 7) 1 2 3 4 5 6
3x (mod 7) 3 6 2 5 1 4
Notice that each of the numbers 1, 2,3,4.5,6 reappears exactly once in the second
row. So if we multiply together all the numbers in the second row, we get the same
70 Congruences. Powers, and Fermats Little Theorem

result as multiplying together all the numbers in the first row. Of course, we must
work modulo 7. Thus,

(3.1)(:3.2)(3.3)(3.4)(3.5)(3.6) 1234.56 (mocl7).

numbers in second row numbers in first row


is
To save space, we use the standard symbol n! for the number u factorial, which
the product of 1, 2, . . . n. In other words.
,

Factoring out the six factors of 3 on the left-hand side of our congruence gives
36
. 6! 6! (mccl 7).

Notice that 6! is relatively prime to 7, so we can cancel the 6! from, both sides. This
gives 36 ], (mod 7), which is exactly Fermat’s Little Theorem.
We are now ready to prove Fermat’s Little Theorem in general. The key ob
36 (mod 7) was that multiplication by 3 rearranged the
servation in our proof for
numbers 1.2. 3. -1. 5. 6 (mod 7). So first we are going to verify the following claim:

Lemma 2. Let J) be ci prime number cuid let (I be a number cit/i ci 0 (mod p).
Then the numbers

a. 2u. 3u (p — 1)ii (mod p)

are the same as the nunthers


1,2.3 (p — 1) (mod p).

although they may be in a thf/erent ordei:

PIV0J. The list (I. 2u. 3u. (p 1 )u contains p 1 numbers, and clearly none of

them are divisible by p. Suppose that we take two numbers ju and kct in this list,
anti suppose that they happen to be congruent.

ju l’a (mccl p).

Then p I (.1 k)a. so J) (j /). since we are assuming that p does not divide ci.

Notice that we are using the Prime Divisibility Property, which says that if a prime
divides a product then it divides one of the factors. On the other hand. we know
absolute
that 1 j, k p 1, so Ij kI < p 1. There is only one number with


value less than v —1 that is divisible by p and that number is zero. Hence, j = k.
This shows that different multiples in the list a. 2u, 3a (p flu are distinct —

modulo p.
Congruences, Powers. and Fermat’s Little Theorem 71

So we now know that the list a. 2u. 3a (p 1)u contains i 1 distinct


— —

nonzero values modulo p. But there are only p 1 distinct nonzero values mod

ulop. that is. the numbers 1.2.3 (13—1). Hence, the list a. 2ci. 30 (p— fla
and the list 1.2.3 (p—i) must contain the same numbers rnodulop. although
the numbers may appear in a different order. This finishes the proof of the lemma.
Using the lemma, it is easy to finish the proof of Fermat’s Little Theorem. The
lemma says that the lists of numbers

a. 2o, 3u (p — 1)a (mod p) and 1. 2. 3 (p — 1) (mod p)

are the same, so the product of the numbers in the first list is equal to the product
of the numbers in the second list:

U (2u). (3a). .. ((]) — 1)a) 1 2 3.. (p


. . . — 1) (mod ii)

Next we factor oirp — 1 copies of (1 from the left-hand side to obtain

(L (p — 1)! (p — 1)! (mod p).

Finally, we observe that (p 1)! is relatively prime to p. so we may cancel it from


both sides to obtain Fermat’s Little Theorem,

(JPl 1 (mod p). L

Fermat’s Little Theorem can he used to show that a number is not a prime
without actually factoring it. For example, it turns out that

21231 899557 (mod 123-1.567).

This means that 12:3-1567 cannot be a prime, since if it ere, Fermats Little The—
oiem would tell us that 2 23 156(i niList be congruent tO 1 modulo 12:14567. it turns
out that 1231567 127 9721. so in this case we can actually find a lactor. But
consider the number
in = i0’ + 37.
‘\ hen we compute 2’’ (mod iim), we get

2T1 3626:3uu:3275-I5S61062487760i996335839i0
3687:325:3019151380128320821091 121859463
- 579459059730070231841:397 (mod in).
72 Congruences. Powers. and Fermat’s Little Theorem

Again we deduce from Fermats Little Theorem that 10100 + 37 is not prime, but it
is not at all clear how to find a factor. A quick check on a desktop computer reveals
no prime factors less than 200.000. It is somewhat surprising that we can easily
write down numbers that we know are composite, yet for which we are unable to
find any factors.

Exercises
1. Use Fermat’s Little Theorem to perform the following tasks.
979 (mod 73).
(a) Find a number 0 < a < 73 with (1
(b) Solve am 6 (mod 29).
9 3 (mud 13).
(c) Solve a

2. The quantity (p 1)! (mod p) appeared in our proof of Fermat’s Little Theorem, al

though we didn’t need to know its value.


(a) Compute (p 1)! (mod p) for some small values of p, find a pattern, and make a
conjecture.
(b) Prove that your conjecture is correct. [Try to discover why (p 1)! (mod p) has the

value it does for small values of p. and then generalize your observation to prove the
formula for all values of p.]

3. Exercise 2 asked you to determine the value of (p 1)! (mod p) when p is a prime

number.
(a) Compute the value of (iii — 1)! (mod iii) for some small values of rn that are not
prime. Do you find the same pattern as you found for primes?
(b) If you know the value of (n 1)! (mod ii). how can you use the value to definitely
distinguish whether ii is prime or composite?

4. If p is a prime number and if a 0 (mod p), then Fermat’s Little Theorem tells us that
ai’ 1 (mod p).
(a) The congruence 7h734250 1660565 (mod 1734251) is true. Can you conclude that
17342.51 is a composite number?
(b) The congruence l296b026 15179 (mod 64027) is true. Can you conclude that
61027 is a composite number?
(C) The congruence 2526:12 1 (mod 52633) is true. Can you conclude that 52633 is a
prime number?

You might also like