Breadth-first search: Difference between revisions

From formulasearchengine
Jump to navigation Jump to search
en>Patmorin
Added link to book section
en>Nikkimaria
m Reverted edits by 173.35.27.126 (talk) to last version by 76.170.180.167
Line 1: Line 1:
{{refimprove|date=July 2011}}
I'm Sherrill (26) from Upton, United Kingdom. <br>I'm learning Danish literature at a local high school and I'm just about to graduate.<br>I have a part time job in a backery.<br><br>Here is my blog post :: [http://www.sangroupindia.co.in/activity/p/198244/ Fifa 15 Coin Generator]
This article collects together a variety of [[mathematical proof|proofs]] of [[Fermat's little theorem]], which states that
:<math>a^p \equiv a \pmod p \,\!</math>
for every [[prime number]] ''p'' and every [[integer]] ''a'' (see [[modular arithmetic]]).
 
==Simplifications==
Some of the '''proofs of Fermat's little theorem''' given below depend on two simplifications.
 
The first is that we may assume that ''a'' is in the range 0 ≤ ''a'' ≤ ''p'' − 1. This is a simple consequence of the laws of [[modular arithmetic]]; we are simply saying that we may first reduce ''a'' modulo ''p''.
 
Secondly, it suffices to prove that
:<math>a^{p-1} \equiv 1 \pmod p \quad \quad (X)</math>
for ''a'' in the range 1 ≤ ''a'' ≤ ''p'' − 1. Indeed, if (X) holds for such ''a'', multiplying both sides by ''a'' yields the original form of the theorem,
:<math>a^p \equiv a \pmod p, \,\!</math>
On the other hand, if ''a'' equals zero, the theorem holds trivially.
 
==Combinatorial proofs==
 
===Proof by counting necklaces===
This is perhaps the simplest known proof, requiring the least mathematical background. It is an attractive example of a [[combinatorial proof]] (a proof that involves [[Double counting (proof technique)|counting a collection of objects in two different ways]]).
 
The proof given here is an adaptation of [[Solomon W. Golomb|Golomb]]'s proof.<ref>Golomb, Solomon W. [http://www.cimat.mx/~mmoreno/teaching/spring08/Fermats_Little_Thm.pdf Combinatorial proof of Fermat's "Little" Theorem]. The American Mathematical Monthly, Vol. 63, No. 10 (Dec., 1956), p. 718</ref>
 
To keep things simple, let us assume that ''a'' is a [[positive integer]]. Consider all the possible [[string (computer science)|strings]] of ''p'' symbols, using an [[alphabet]] with ''a'' different symbols. The total number of such strings is ''a<sup> p''</sup>, since there are ''a'' possibilities for each of ''p'' positions (see [[rule of product]]).
 
For example, if ''p'' = 5 and ''a'' = 2, then we can use an alphabet with two symbols (say ''A'' and ''B''), and there are 2<sup>5</sup> = 32 strings of length five:
: AAAAA, AAAAB, AAABA, AAABB, AABAA, AABAB, AABBA, AABBB,
: ABAAA, ABAAB, ABABA, ABABB, ABBAA, ABBAB, ABBBA, ABBBB,
: BAAAA, BAAAB, BAABA, BAABB, BABAA, BABAB, BABBA, BABBB,
: BBAAA, BBAAB, BBABA, BBABB, BBBAA, BBBAB, BBBBA, BBBBB.
 
We will argue below that if we remove the strings consisting of a single symbol from the list (in our example, AAAAA and BBBBB), the remaining ''a''<sup> ''p''</sup> − ''a'' strings can be arranged into groups, each group containing exactly ''p'' strings. It follows that ''a''<sup> ''p''</sup> − ''a'' is divisible by ''p''.
 
====Necklaces====
[[Image:Proofs-of-Fermats-Little-Theorem-bracelet1.svg|frame|right|Necklace representing seven different strings (ABCBAAC, BCBAACA, CBAACAB, BAACABC, AACABCB, ACABCBA, CABCBAA)]]
[[Image:Proofs-of-Fermats-Little-Theorem-bracelet2.svg|frame|right|Necklace representing only one string (AAAAAAA)]]
 
Let us think of each such string as representing a [[necklace (combinatorics)|necklace]]. That is, we connect the two ends of the string together, and regard two strings as the same necklace if we can [[circular shift|rotate]] one string to obtain the second string; in this case we will say that the two strings are '''friends'''. In our example, the following strings are all friends:
: AAAAB, AAABA, AABAA, ABAAA, BAAAA.
Similarly, each line of the following list corresponds to a single necklace.
: AAABB, AABBA, ABBAA, BBAAA, BAAAB,
: AABAB, ABABA, BABAA, ABAAB, BAABA,
: AABBB, ABBBA, BBBAA, BBAAB, BAABB,
: ABABB, BABBA, ABBAB, BBABA, BABAB,
: ABBBB, BBBBA, BBBAB, BBABB, BABBB,
: AAAAA,
: BBBBB.
Notice that in the above list, some necklaces are represented by five different strings, and some only by a single string, so the list shows very clearly why 32 − 2 is divisible by 5.
 
One can use the following rule to work out how many friends a given string ''S'' has:
: ''If S is built up of several copies of the string T, and T cannot itself be broken down further into repeating strings, then the number of friends of S (including S itself) is equal to the ''length'' of T.''
 
For example, suppose we start with the string ''S'' = "ABBABBABBABB", which is built up of several copies of the shorter string ''T'' = "ABB". If we rotate it one symbol at a time, we obtain the following three strings:
: ABBABBABBABB,
: BBABBABBABBA,
: BABBABBABBAB.
There aren't any others, because ABB is exactly three symbols long, and cannot be broken down into further repeating strings.
 
====Completing the proof====
Using the above rule, we can complete the proof of Fermat's little theorem quite easily, as follows. Our starting pool of ''a''<sup>''p''</sup> strings may be split into two categories:
* Some strings contain ''p'' identical symbols. There are exactly ''a'' of these, one for each symbol in the alphabet. (In our running example, these are the strings AAAAA and BBBBB.)
* The rest of the strings use at least two distinct symbols from the alphabet. If we try to break up such a string ''S'' into repeating copies of a string ''T'', we find that, because ''p'' is prime, the only possibility is that ''T'' is already the whole string ''S''. Therefore, the above rule tells us that ''S'' has exactly ''p'' friends (including ''S'' itself).
 
The second category contains ''a''<sup> ''p''</sup> − ''a'' strings, and they may be arranged into groups of ''p'' strings, one group for each necklace. Therefore ''a''<sup> ''p''</sup> − ''a'' must be divisible by ''p'', as promised.
 
===Proof using dynamical systems===
This proof uses some basic concepts from [[dynamical system]]s.
 
We start by considering a family of [[function (mathematics)|functions]], ''T''<sub>''n''</sub>(''x''), where ''n'' ≥ 2 is an [[integer]], mapping the [[interval (mathematics)|interval]] [0, 1] to itself by the formula
:<math>T_n(x) = \begin{cases} \{ nx \} & 0 \leq x < 1, \\ 1 & x = 1,\end{cases}</math>
where {''y''} denotes the [[fractional part]] of ''y''. For example, the function ''T''<sub>3</sub>(''x'') is illustrated below:
 
[[Image:Proofs-of-Fermats-Little-Theorem-dynamic1.png|200px|center|An example of a ''T''<sub>''n''</sub> function]]
 
A number ''x''<sub>0</sub> is said to be a '''[[fixed point (mathematics)|fixed point]]''' of a function ''f''(''x'') if ''f''(''x''<sub>0</sub>) = ''x''<sub>0</sub>; in other words, if ''f'' leaves ''x''<sub>0</sub> fixed. The fixed points of a function can be easily found graphically: they are simply the ''x''-coordinates of the points where the [[Graph of a function|graph]] of ''f''(''x'') intersects the graph of the line ''y'' = ''x''. For example, the fixed points of the function ''T''<sub>3</sub>(''x'') are 0, 1/2, and 1; they are marked by black circles on the following diagram.
 
[[Image:Proofs-of-Fermats-Little-Theorem-dynamic2.png|180px|center|Fixed points of a ''T''<sub>''n''</sub> function]]
 
We will require the following two lemmas.
 
'''Lemma 1.''' For any ''n'' ≥ 2, the function ''T''<sub>''n''</sub>(''x'') has exactly ''n'' fixed points.
 
'''Proof.''' There are three fixed points in the illustration above, and the same sort geometrical argument applies for any ''n'' ≥ 2.
 
'''Lemma 2.''' For any positive integers ''n'' and ''m'', and any 0 ≤ x ≤ 1,
:<math>T_m(T_n(x)) = T_{mn}(x).\,</math>
In other words, ''T''<sub>''mn''</sub>(''x'') is the [[function composition|composition]] of ''T''<sub>''n''</sub>(''x'') and ''T''<sub>''m''</sub>(''x'').
 
'''Proof.''' The proof of this lemma is not difficult, but we need to be slightly careful with the endpoint ''x'' = 1. For this point the lemma is clearly true since
:<math>T_m(T_n(1)) = T_m(1) = 1 = T_{mn}(1).\,\!</math>
So let us assume that 0 ≤ ''x'' < 1. In this case,
:<math>T_n(x) = \{nx\} < 1, \,\!</math>
so ''T''<sub>''m''</sub>(''T''<sub>''n''</sub>(''x'')) is given by
:<math>T_m(T_n(x)) = \{m\{nx\}\}.\,\!</math>
Therefore, what we really need to show is that
:<math>\{m\{nx\}\} = \{mnx\}.\,\!</math>
To do this we observe that {''nx''} = ''nx'' − ''k'', where ''k'' is the [[integer part]] of ''nx''; then
:<math>\{m\{nx\}\} = \{mnx - mk\} = \{mnx\} \,\!</math>
since ''mk'' is an integer.
 
Now let us properly begin the proof of Fermat's little theorem, by studying the function ''T''<sub>''a''<sup> ''p''</sup></sub>(''x''). We will assume that ''a'' is ≥ 2. From Lemma 1, we know that it has ''a''<sup> ''p''</sup> fixed points. By Lemma 2 we know that
:<math>
\begin{matrix}
T_{a^p}(x) = & \underbrace{T_a(T_a( \cdots T_a(x) \cdots ))}, \\
& p \, \textrm{ times} \\
\end{matrix}
</math>
so any fixed point of ''T''<sub>''a''</sub>(''x'') is automatically a fixed point of ''T''<sub>''a''<sup> ''p''</sup></sub>(''x'').
 
We are interested in the fixed points of ''T''<sub>''a''<sup> ''p''</sup></sub>(''x'') that are ''not'' fixed points of ''T''<sub>''a''</sub>(''x''). Let us call the set of such points ''S''. There are ''a''<sup> ''p''</sup> − ''a'' points in ''S'', because by Lemma 1 again, ''T''<sub>''a''</sub>(''x'') has exactly ''a'' fixed points. The following diagram illustrates the situation for ''a'' = 3 and ''p'' = 2. The black circles are the points of ''S'', of which there are 3<sup>2</sup> − 3 = 6.
 
[[Image:Proofs-of-Fermats-Little-Theorem-dynamic3.png|250px|center|Fixed points in the set ''S'']]
 
The main idea of the proof is now to split the set ''S'' up into its '''[[orbit (dynamics)|orbits]]''' under ''T''<sub>''a''</sub>. What this means is that we pick a point ''x''<sub>0</sub> in ''S'', and repeatedly apply ''T''<sub>''a''</sub>(x) to it, to obtain the sequence of points
:<math> x_0, T_a(x_0), T_a(T_a(x_0)), T_a(T_a(T_a(x_0))), \ldots. \,\!</math>
This sequence is called the orbit of ''x''<sub>0</sub> under ''T''<sub>''a''</sub>. By Lemma 2, this sequence can be rewritten as
:<math> x_0, T_a(x_0), T_{a^2}(x_0), T_{a^3}(x_0), \ldots. </math>
Since we are assuming that ''x''<sub>0</sub> is a fixed point of ''T''<sub>''a''<sup> ''p''</sup></sub>(''x''), after ''p'' steps we hit ''T''<sub>''a''<sup> ''p''</sup></sub>(''x''<sub>0</sub>) = ''x''<sub>0</sub>, and from that point onwards the sequence repeats itself.
 
However, the sequence ''cannot'' begin repeating itself any earlier than that. If it did, the length of the repeating section would have to be a divisor of ''p'', so it would have to be 1 (since ''p'' is prime). But this contradicts our assumption that ''x''<sub>0</sub> is not a fixed point of ''T''<sub>''a''</sub>.
 
In other words, the orbit contains exactly ''p'' distinct points. This holds for every orbit of ''S''. Therefore, the set ''S'', which contains ''a''<sup>&nbsp;''p''</sup>&nbsp;−&nbsp;''a'' points, can be broken up into orbits, each containing ''p'' points, so ''a''<sup>&nbsp;''p''</sup>&nbsp;−&nbsp;''a'' is divisible by ''p''.
 
(This proof is essentially the same as the [[Proofs_of_Fermat%27s_little_theorem#Proof_by_counting_necklaces|necklace-counting proof]] given above, simply viewed through a different lens: one may think of the interval [0, 1] as given by sequences of digits in base ''a'' (our distinction between 0 and 1 corresponding to the familiar distinction between representing integers as ending in ".0000..." and ".9999..."). ''T''<sub>''a''<sup>''n''</sup></sub> amounts to shifting such a sequence by ''n'' many digits. The fixed points of this will be those sequences which are cyclic with period dividing ''n''. In particular, the fixed points of ''T''<sub>''a''<sup>''p''</sup></sub> can be thought of as the necklaces of length ''p'', with ''T''<sub>''a''<sup>''n''</sup></sub> corresponding to rotation of such necklaces by ''n'' many spots.
 
This proof could also be presented without distinguishing between 0 and 1, simply using the half-open interval [0, 1); then ''T''<sub>n</sub> would only have ''n'' - 1 many fixed points, but ''T''<sub>''a''<sup>''p''</sup></sub> - ''T''<sub>''a''</sub> would still work out to ''a''<sup>''p''</sup> - ''a'', as needed.)
 
===Multinomial proofs===
 
====Proof using the binomial theorem====
This proof uses [[mathematical induction|induction]] to prove the theorem for all integers ''a'' ≥ 0.
 
The base step, that 0<sup> ''p''</sup> ≡ 0 (mod ''p''), is true for modular arithmetic because it is true for integers. Next, we must show that if the theorem is true for ''a'' = ''k'', then it is also true for ''a'' = ''k''+1. For this inductive step, we need the following lemma.
 
'''Lemma'''. For any prime ''p'',
 
:<math>(x+y)^p \equiv x^p+y^p \pmod{p}.\,</math>
 
An alternative way of viewing this lemma is that it states that
:<math>(x+y)^p = x^p + y^p\,\!</math>
for any ''x'' and ''y'' in the [[finite field]] '''GF'''(''p'').
 
Postponing the proof of the lemma for now, we proceed with the induction.
 
'''Proof'''. Assume ''k''<sup>''p''</sup> ≡ ''k'' (mod ''p''), and consider (''k''+1)<sup>''p''</sup>. By the lemma we have
 
:<math>(k+1)^p \equiv k^p + 1^p \pmod{p}.\,</math>
 
Using the induction hypothesis, we have that ''k''<sup>''p''</sup> ≡ ''k'' (mod ''p''); and, trivially, 1<sup>''p''</sup> = 1. Thus
 
:<math>(k+1)^p \equiv k + 1 \pmod{p},\,</math>
 
which is the statement of the theorem for ''a'' = ''k''+1. ∎
 
In order to prove the lemma, we must introduce the [[binomial theorem]], which states that for any positive integer ''n'',
 
:<math>(x+y)^n=\sum_{i=0}^n{n \choose i}x^{n-i}y^i,</math>
 
where the coefficients are the [[binomial coefficients]],
 
:<math>{n \choose i}=\frac{n!}{i!(n-i)!},</math>
 
described in terms of the [[factorial]] function, ''n''! = 1×2×3×⋯×''n''.
 
'''Proof''' of lemma. The binomial coefficients are all integers and when 0 < ''i'' < ''p'', neither of the terms in the denominator includes a factor of ''p'', leaving the coefficient itself to possess a prime factor of ''p'' which must exist in the numerator, implying that
 
:<math>{p \choose i} \equiv 0 \pmod{p},\qquad 0 < i < p.</math>
 
Modulo ''p'', this eliminates all but the first and last terms of the sum on the right-hand side of the binomial theorem for prime ''p''. ∎
 
The primality of ''p'' is essential to the lemma; otherwise, we have examples like
 
:<math>{4 \choose 2} = 6,</math>
 
which is not divisible by 4.
 
====Proof using the multinomial expansion====
The proof is a very simple application of the [[multinomial theorem]] which is brought here for the sake of simplicity.
 
:<math>(x_1 + x_2 + \cdots + x_m)^n
= \sum_{k_1,k_2,\ldots,k_m} {n \choose k_1, k_2, \ldots, k_m}
x_1^{k_1} x_2^{k_2} \cdots x_m^{k_m}. </math>
 
The summation is taken over all sequences of nonnegative integer indices ''k''<sub>1</sub> through ''k''<sub>m</sub> such the sum of all ''k''<sub>i</sub> is n.
 
Thus if we express ''a'' as a sum of 1s (ones), we obtain
 
:<math>a^p
= \sum_{k_1,k_2,\ldots,k_a} {p \choose k_1, k_2, \ldots, k_a} </math>
 
Clearly, if ''p'' is prime, and if k<sub>j</sub> not equal to ''p'' for any ''j'', we have
 
:<math>{p \choose k_1, k_2, \ldots, k_a} \equiv 0 \pmod p \,\!</math>
 
and
 
:<math>{p \choose k_1, k_2, \ldots, k_a} \equiv 1 \pmod p \,\!</math>
 
if k<sub>j</sub> equal to ''p'' for some ''j''
 
Since there are exactly ''a'' elements such that <math> k_j = p </math> the theorem follows.
 
(This proof is essentially a coarser-grained variant of the [[Proofs_of_Fermat%27s_little_theorem#Proof_by_counting_necklaces|necklace-counting proof]] given earlier; the multinomial coefficients count the number of ways a string can be permuted into arbitrary anagrams, while the necklace argument counts the number of ways a string can be rotated into cyclic anagrams. That is to say, that the nontrivial multinomial coefficients here are divisible by ''p'' can be seen as a consequence of the fact that each nontrivial necklace of length ''p'' can be unwrapped into a string in ''p'' many ways.
 
This multinomial expansion is also, of course, what essentially underlies the [[Proofs_of_Fermat%27s_little_theorem#Proof using the binomial theorem|binomial theorem-based proof]] above)
 
===Proof using power product expansions===
 
An additive-combinatorial proof based on formal power product expansions was given by Alkauskas.<ref>Alkauskas, Giedrius. [http://arxiv.org/pdf/0801.0805v3.pdf A Curious Proof of Fermat’s Little Theorem]. The American Mathematical Monthly, Vol. 116, No. 4 (Apr., 2009), p. 362-364</ref> This proof uses neither [[euclidean algorithm]] nor [[binomial theorem]], but rather employs the interplay between an additive and multiplicative structures of integers.
 
==Proofs using modular arithmetic==
These proofs require some background in [[modular arithmetic]].
 
Let us assume that ''a'' is positive and not divisible by ''p''.
<!--
NOTE:
Of course this proof also works for negative ''a''. However, I'm really just trying to strip it down to the simplest possible version, that people only marginally familiar with modular arithmetic will understand. I didn't want to get stuck with stuff like "replace ka by its representative in the set {1, 2, ... p-1}. (Dmharvey)
 
What if a is divisible by p?
-->
The idea is that if we write down the sequence of numbers
:<math>a, 2a, 3a, \ldots, (p-1)a \quad\quad (A) </math>
and reduce each one modulo ''p'', the resulting sequence turns out to be a rearrangement of
:<math>1, 2, 3, \ldots, p-1. \quad\quad\quad (B) </math>
Therefore, if we multiply together the numbers in each sequence, the results must be identical modulo ''p'':
:<math>a \times 2a \times 3a \times \cdots \times (p-1)a \equiv 1 \times 2 \times 3 \times \cdots \times (p-1) \pmod p.</math>
Collecting together the ''a'' terms yields
:<math>a^{p-1} (p-1)! \equiv (p-1)! \pmod p.</math>
Finally, we may "cancel out" the numbers 1, 2, ..., ''p'' − 1 from both sides of this equation, obtaining
:<math>a^{p-1} \equiv 1 \pmod p.\,\!</math>
 
There are two steps in the above proof that we need to justify:
* Why (A) is a rearrangement of (B), and
* Why it is valid to "cancel" in the setting of modular arithmetic.
We will prove these things below; let us first see an example of this proof in action.
 
===An example===
 
If ''a'' = 3 and ''p'' = 7, then the sequence in question is
:<math>3, 6, 9, 12, 15, 18;\,\!</math>
reducing modulo&nbsp;7 gives
:<math>3, 6, 2, 5, 1, 4,\,\!</math>
which is just a rearrangement of
:<math>1, 2, 3, 4, 5, 6.\,\!</math>
Multiplying them together gives
:<math>3 \times 6 \times 9 \times 12 \times 15 \times 18 \equiv 3 \times 6 \times 2 \times 5 \times 1 \times 4 \equiv 1 \times 2 \times 3 \times 4 \times 5 \times 6 \pmod 7;\,\!</math>
that is,
:<math>3^6 (1 \times 2 \times 3 \times 4 \times 5 \times 6) \equiv (1 \times 2 \times 3 \times 4 \times 5 \times 6) \pmod 7.\,\!</math>
Canceling out 1&nbsp;×&nbsp;2&nbsp;×&nbsp;3&nbsp;×&nbsp;4&nbsp;×&nbsp;5&nbsp;×&nbsp;6 yields
:<math>3^6 \equiv 1 \pmod 7, \,\!</math>
which is Fermat's little theorem for the case ''a''&nbsp;=&nbsp;3 and&nbsp;''p''&nbsp;=&nbsp;7.
 
===The cancellation law===
 
Let us first explain why it is valid, in certain situations, to "cancel". The exact statement is as follows. If ''u'', ''x'', and ''y'' are integers, and ''u'' is not divisible by a prime number ''p'', and if
:<math>ux \equiv uy \pmod p, \,\!</math>
then we may "cancel" ''u'' to obtain
:<math>x \equiv y \pmod p. \,\!</math>
Our use of this '''cancellation law''' in the above proof of Fermat's little theorem was valid, because the numbers 1, 2, ..., ''p'' − 1 are certainly not divisible by ''p'' (indeed they are ''smaller'' than ''p'').
 
We can prove the cancellation law easily using [[Euclid's lemma]], which generally states that if an integer ''b'' divides a product ''rs'' (where ''r'' and ''s'' are integers), and ''b'' is relatively prime to ''r'', then ''b'' must divide ''s''. Indeed, the equation
:<math>ux \equiv uy \pmod p, \,\!</math>
simply means that ''p'' divides ''ux'' − ''uy'' = ''u''(''x'' − ''y''). If ''p'' does not divide ''u'' and is a prime, Euclid's lemma tells us that it must divide ''x'' − ''y'' instead; that is,
:<math>x \equiv y \pmod p. \,\!</math>
 
(Note that the conditions under which the cancellation law holds are quite strict, and this explains why Fermat's little theorem demands that ''p'' be a prime in order to make a general case for all ''n''. For example, 2 × 2 ≡ 2 × 5 (mod 6), but we cannot conclude that 2 ≡ 5 (mod 6), since 6 is not prime. See below for a more extensive proof for all ''p'')
 
===The rearrangement property===
 
Finally, we must explain why the sequence
:<math>a, 2a, 3a, \ldots, (p-1)a, \,\!</math>
when reduced modulo ''p'', becomes a rearrangement of the sequence
:<math>1, 2, 3, \ldots, p-1.\,\!</math>
To start with, none of the terms ''a'', 2''a'', ..., (''p'' − 1)''a'' can be congruent to zero modulo ''p'', since if ''k'' is one of the numbers 1,&nbsp;2,&nbsp;...,&nbsp;''p''&nbsp;−&nbsp;1, then ''k'' is relatively prime with ''p'', and so is ''a'', so [[Euclid's lemma]] tells us that ''ka'' shares no factor with ''p''. Therefore, at least we know that the numbers ''a'', 2''a'', ..., (''p''&nbsp;−&nbsp;1)''a'', when reduced modulo ''p'', must be found among the numbers 1,&nbsp;2,&nbsp;3,&nbsp;...,&nbsp;''p''&nbsp;−&nbsp;1.
 
Furthermore, the numbers ''a'',&nbsp;2''a'',&nbsp;...,&nbsp;(''p''&nbsp;−&nbsp;1)''a'' must all be ''distinct'' after reducing them modulo ''p'', because if
:<math>ka \equiv ma \pmod p, \,\!</math>
where ''k'' and ''m'' are one of 1,&nbsp;2,&nbsp;...,&nbsp;''p''&nbsp;−&nbsp;1, then the cancellation law tells us that
:<math>k \equiv m \pmod p. \,\!</math>
Since both ''k'' and ''m'' are both between 1 and ''p-1'', they must be equal. Therefore the terms ''a'', 2''a'', ..., (''p'' − 1)''a'' when reduced modulo ''p'' must be distinct.
To summarise: when we reduce the ''p''&nbsp;−&nbsp;1 numbers ''a'',&nbsp;2''a'',&nbsp;...,&nbsp;(''p''&nbsp;−&nbsp;1)''a'' modulo ''p'', we obtain distinct members of the sequence 1,&nbsp;2,&nbsp;...,&nbsp;''p''&nbsp;−&nbsp;1. Since there are exactly ''p''&nbsp;−&nbsp;1 of these, the only possibility is that the former are a rearrangement of the latter.
 
===Applications to Euler's theorem===
 
This method can also be used to prove [[Euler's theorem]], with a slight alteration in that 1 to (p-1) is substituted for the numbers less than and relatively prime to some base m (instead of p). Both the rearrangement property and the cancellation law are still satisfied and can be utilized.
 
For example:
:<math>a \times 3a \times 7a \times 9a \equiv 1 \times 3 \times 7 \times 9 \pmod {10}. \,\!</math>
 
Therefore,
:<math>{a^{\varphi(10)}} \equiv 1 \pmod {10}. \,\!</math>
 
==Proof using group theory==
This proof requires the most basic elements of [[group theory]].
 
The idea is to recognise that the set ''G'' = {1, 2, …, ''p'' − 1}, with the operation of multiplication (taken modulo ''p''), forms a [[group (mathematics)|group]]. The only group axiom that requires some effort to verify is that each element of ''G'' is invertible. Taking this on faith for the moment, let us assume that ''a'' is in the range 1 ≤ ''a'' ≤ ''p'' − 1, that is, ''a'' is an element of ''G''. Let ''k'' be the [[order (group theory)|order]] of ''a'', so that ''k'' is the smallest positive integer such that
:<math>a^k \equiv 1 \pmod p. \,\!</math>
By [[Lagrange's theorem (group theory)|Lagrange's theorem]], ''k'' divides the order of ''G'', which is ''p'' − 1, so ''p'' − 1 = ''km'' for some positive integer ''m''. Then
:<math>a^{p-1} \equiv a^{km} \equiv (a^k)^m \equiv 1^m \equiv 1 \pmod p. \,\!</math>
 
===The invertibility property===
To prove that every element ''b'' of ''G'' is invertible, we may proceed as follows. First, ''b'' is [[relatively prime]] to ''p''. Then [[Bézout's identity]] assures us that there are integers ''x'' and ''y'' such that
:<math>bx + py = 1. \,\!</math>
Reading this equation modulo ''p'', we see that ''x'' is an inverse for ''b'', since
:<math>bx \equiv 1 \pmod p. \,\!</math>
Therefore every element of ''G'' is invertible, so as remarked earlier, ''G'' is a group.
 
For example, when ''p'' = 11, the inverses of each element are given as follows:
:{| border="1" cellspacing="0" cellpadding="8"
| align="center" | ''a''
| 1 || 2 || 3 || 4 || 5 || 6 || 7 || 8 || 9 || 10
|-
| align="center" | ''a''<sup> −1</sup>
| 1 || 6 || 4 || 3 || 9 || 2 || 8 || 7 || 5 || 10
|}
 
==Notes==
<references />
 
{{DEFAULTSORT:Fermat's Little Theorem, Proofs Of}}
[[Category:Modular arithmetic]]
[[Category:Number theory]]
[[Category:Article proofs]]

Revision as of 05:00, 18 February 2014

I'm Sherrill (26) from Upton, United Kingdom.
I'm learning Danish literature at a local high school and I'm just about to graduate.
I have a part time job in a backery.

Here is my blog post :: Fifa 15 Coin Generator