Fermat - gfsmaths.com

advertisement
Pierre de Fermat (b. 1601)
Pierre de Fermat was perhaps the greatest French mathematician of the Renaissance
period, which is no mean feat considering the competition. He made many
discoveries in number theory, laid the foundations of probability theory along with
Pascal, is credited with inventing co-ordinate geometry before Descartes and
invented methods for finding tangents and areas under curves that were later
developed by Newton and Leibniz in the calculus. And all this by an ‘amateur’
mathematician!
In this section, we will explore some of Fermat’s discoveries for ourselves.
In these activities we are going to use modular arithmetic (sometimes called clock
arithmetic), which put simply is the study of remainders. We say a number is
congruent to x modulo (mod) n if that number has remainder x when divided by n.
So the number 13 is congruent to 1 modulo 12; we use this idea everyday when
telling the time! This can be written as: 13 ≡ 1(𝑚𝑜𝑑 12)
Power sequences
We can reveal patterns in many sequences using modular arithmetic. For example,
the square number sequence 1, 4, 9, 16, 25, … becomes 1, 0, 1, 0, 1, … modulo 2.
Do other ‘power sequences’ have similar patterns modulo 2? How about modulo n
for other n?
Powers of ten
Investigate the powers of ten modulo n for various n. What has this got to do with
recurring decimals?
Primes
Where are the primes in this grid?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
What has this got to do with modular arithmetic? Investigate the prime numbers
modulo n for various n.
All the primes in the top row of this grid can be written as the sum of two squares
(such as 5 = 12 + 22 ). Can you write other primes in this grid as the sum of two
squares?
Notes on power sequences
Here is a table of the integers, squares and cubes modulo 2.
Integers
Squares
Cubes
1
1
1
0
0
0
1
1
1
0
0
0
1
1
1
0
0
0
…
…
…
All power sequences become 1, 0, 1, 0, ... modulo 2. Will all power sequences be the
same for other modulo n? Here are the integers, squares and cubes modulo 3:
Integers
Squares
Cubes
1
1
1
2
1
2
0
0
0
1
1
1
2
1
2
0
0
0
…
…
…
This table throws up a few questions:
1. Will the square numbers always becomes 1s and 0s modulo n?
2. The integers and squares are the same modulo 2, and the integers and cubes
are the same modulo 3. Will the integers and power n be the same modulo n?
We can quickly answer question 1 in the negative; consider the square numbers
modulo 5, which starts 1, 4, … This is clearly not just 1s and 0s. However, if we carry
on the square number sequence modulo 5 we do get an interesting pattern: 1, 4, 4,
1, 0, 1, 4, … This is something we will come back to later (in the section on Gauss).
Question 2 is a bit more complicated. Let’s investigate a bit further and see what
happens:
a
𝑎2 (𝑚𝑜𝑑 2)
𝑎3 (𝑚𝑜𝑑 3)
𝑎4 (𝑚𝑜𝑑 4)
𝑎5 (𝑚𝑜𝑑 5)
1
1
1
1
1
2
0
2
0
2
3
1
0
1
3
4
0
1
0
4
5
1
2
1
0
6
0
0
0
1
…
…
…
…
…
If our conjecture is true, we would have expected that 𝑎4 (𝑚𝑜𝑑 4) would be 1, 2, 3,
0, 1, 2, 3 … but this is not the case. However, it is true for 𝑎5 (𝑚𝑜𝑑 5). This leads us
to investigate a little bit further and we find that it’s also true for modulo 7 and 11:
7
𝑎 (𝑚𝑜𝑑 7)
𝑎11 (𝑚𝑜𝑑 11)
1
1
1
2
2
2
3
3
3
4
4
4
5
5
5
6
6
6
7
0
7
8
1
8
…
…
…
It appears to be true if n is a prime number. It turns out that this is the case: this
result is known as Fermat’s Little Theorem and is often written
𝑎 ≡ 𝑎𝑝 (𝑚𝑜𝑑 𝑝)
Can we can ‘divide’ this equation by a like this?
1 ≡ 𝑎𝑝−1 (𝑚𝑜𝑑 𝑝)
Is this allowed? Let’s look at 𝑎𝑝−1 (𝑚𝑜𝑑 𝑝) to see if it is true:
a
𝑎 (𝑚𝑜𝑑 2)
𝑎2 (𝑚𝑜𝑑 3)
𝑎4 (𝑚𝑜𝑑 5)
𝑎6 (𝑚𝑜𝑑 7)
1
1
1
1
1
2
0
1
1
1
3
1
0
1
1
4
0
1
1
1
5
1
1
0
1
6
0
0
1
1
7
1
1
1
0
…
…
…
…
…
Well, yes it is true apart from when a is a multiple of p, so we would need to put this
in our rule and say 1 ≡ 𝑎𝑝−1 (𝑚𝑜𝑑 𝑝) if a and p are relatively prime.
Fermat’s Little Theorem is quite exciting; it gives us a rule for prime numbers, which
of course are few and far between.
So we have that 1 ≡ 𝑎𝑝−1 (𝑚𝑜𝑑 𝑝) if p is prime (and a and p
are relatively prime).. but is it the converse true? That is, is it
true that n is prime if 1 ≡ 𝑎𝑛−1 (𝑚𝑜𝑑 𝑛)?
If this is true, it will give us a way of finding primes!
For ease of calculation, let’s look at powers of 2 (let a = 2) in
the table on the right.
It would appear that it is true… the only 𝑎𝑛−1 that are
congruent to 1 are when n is prime. So we have found a way
of finding primes! And this is what mathematicians thought in
the 17th century.
Unfortunately, if we keep going a bit further we find that 2340
is congruent to 1 mod 341, but 341 is not a prime (= 11 x 31).
𝟐𝒏−𝟏
22
23
24
25
26
27
28
29
210
211
212
213
mod n
1
0
1
2
1
0
4
2
1
8
1
4
And if we go even further, when n = 561 we find a composite n that is congruent to 1
for any a (not just 2).
So Fermat’s Little Theorem is not true both ways; all we can say is that 1 ≡
𝑎𝑝−1 (𝑚𝑜𝑑 𝑝) for p prime (with a and p relatively prime).
Notes on powers of ten
Following on from looking at powers of 2, we now investigate powers of 10 mod n:
2
3
4
5
6
7
8
9
101
0
1
2
0
4
3
2
1
102
0
1
0
0
4
2
4
1
103
0
1
0
0
4
6
0
1
104
0
1
0
0
4
4
0
1
105
0
1
0
0
4
5
0
1
106
0
1
0
0
4
1
0
1
107
0
1
0
0
4
3
0
1
108
0
1
0
0
4
2
0
1
We can notice a few things from this table:

Any power of 10 is congruent to 0 modulo 2 or 5. This is because 2 and 5 are
factors of 10. Some powers of 10 are congruent to 0 modulo 4 or 8.

If n and 10 are relatively prime then no power of ten will be congruent to 0
mod n; this is n = 3, 6, 7 and 9.

The red squares are examples of Fermat’s Little Theorem in action: 1 ≡
10𝑝−1 (𝑚𝑜𝑑 𝑝) for p = 3 and 7.
The most interesting number here modulo is 7. It cycles through all the remainders
modulo 7. I wonder what other numbers have this same property? It turns out the
next one is modulo 17. We say that 10 is a primitive root modulo p in these cases.
What is the relevance of all this? Well, consider the decimal representations of 1/n
for various n.
Clearly the two tables here are strongly connected. To see
how, consider using the division algorithm to find the decimal
expansion of 1/7:
1=0x7+1
10 = 1 x 7 + 3
30 = 4 x 7 + 2
n
2
3
4
5
6
7
8
9
1/n
0.5
0.333…
0.25
0.2
0.166…
0.1428571…
0.125
0.111…
20 = 2 x 7 + 6
60 = 8 x 7 + 4
40 = 5 x 7 + 5
50 = 7 x 7 + 1 ≡ 0 x 7 + 1
We are back to where we started! Let’s take a moment to think about why this has
happened. We start with a remainder of 1, and we get this remainder again after 6
steps. Could we have expected this? Well, yes – this is exactly what Fermat’s Little
Theorem predicts. It is equivalent to the statement 106 ≡ 1(𝑚𝑜𝑑 7).
So we can say that any fraction of the form 1/n, with n relatively prime to 10, will
loop with a loop length of at most n-1. Notice however, that the loop length might
be shorter than n-1; for example, 1/13 = 0.07692307… has loop length 6.
What we can say is that the loop length must be a factor of n-1 because we must get
back to a loop after length n-1 (for 1/13 we have loop length of 6 which divides 13 –
1 = 12).
So we have a recurring decimal of loop length at most n-1 if n is relatively prime to
10.
Notes on primes
The primes are coloured in red in the table:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
Of course, they only appear in rows 1 and 3 in the table (apart from 2), which is
equivalent to saying all (odd) primes are congruent to 1 or 3 (mod 4).
We also find that primes are all congruent to 1 or 5 (mod 6) apart from 2 and 3
(why?).
All the 1 mod 4 primes can be written as the sum of two square numbers in exactly
one way and that we can’t write any of the 3 mod 4 primes as the sum of two
squares. It is thought that although Fermat was not the first to notice this fact, he
was the first to claim a proof it (although there is no record of his proof as he did not
write them down).
To see why we can’t write any of the 3 mod 4 primes as the sum of two squares,
consider all the possibilities:
𝑛 (𝑚𝑜𝑑 4) 𝑛2 (𝑚𝑜𝑑 4)
0
0
1
1
2
0
3
1
So square numbers are all of the form 0 or 1 (mod 4). Therefore adding any two
square numbers can only be of the form 0, 1 or 2 (mod 4).
The proof that all 1 mod 4 primes can be written as the (unique) sum of two squares
is quite long and complicated so I have not included it here.
Download