Proofs Of Fermat's Little Theorem
   HOME

TheInfoList



OR:

This article collects together a variety of
proofs Proof most often refers to: * Proof (truth), argument or sufficient evidence for the truth of a proposition * Alcohol proof, a measure of an alcoholic drink's strength Proof may also refer to: Mathematics and formal logic * Formal proof, a co ...
of
Fermat's little theorem Fermat's little theorem states that if ''p'' is a prime number, then for any integer ''a'', the number a^p - a is an integer multiple of ''p''. In the notation of modular arithmetic, this is expressed as : a^p \equiv a \pmod p. For example, if = ...
, which states that :a^p \equiv a \pmod p for every
prime number A prime number (or a prime) is a natural number greater than 1 that is not a product of two smaller natural numbers. A natural number greater than 1 that is not prime is called a composite number. For example, 5 is prime because the only ways ...
''p'' and every
integer An integer is the number zero (), a positive natural number (, , , etc.) or a negative integer with a minus sign (−1, −2, −3, etc.). The negative numbers are the additive inverses of the corresponding positive numbers. In the language ...
''a'' (see
modular arithmetic In mathematics, modular arithmetic is a system of arithmetic for integers, where numbers "wrap around" when reaching a certain value, called the modulus. The modern approach to modular arithmetic was developed by Carl Friedrich Gauss in his book ...
).


Simplifications

Some of the proofs of Fermat's little theorem given below depend on two simplifications. The first is that we may assume that is in the range . This is a simple consequence of the laws of
modular arithmetic In mathematics, modular arithmetic is a system of arithmetic for integers, where numbers "wrap around" when reaching a certain value, called the modulus. The modern approach to modular arithmetic was developed by Carl Friedrich Gauss in his book ...
; we are simply saying that we may first reduce modulo . This is consistent with reducing a^p modulo , as one can check. Secondly, it suffices to prove that :a^ \equiv 1 \pmod p for in the range . Indeed, if the previous assertion holds for such , multiplying both sides by yields the original form of the theorem, :a^p \equiv a \pmod p On the other hand, if or , 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 In mathematics, the term ''combinatorial proof'' is often used to mean either of two types of mathematical proof: * A proof by double counting. A combinatorial identity is proven by counting the number of elements of some carefully chosen set in t ...
(a proof that involves counting a collection of objects in two different ways). The proof given here is an adaptation of Golomb's proof. To keep things simple, let us assume that is a
positive integer In mathematics, the natural numbers are those numbers used for counting (as in "there are ''six'' coins on the table") and ordering (as in "this is the ''third'' largest city in the country"). Numbers used for counting are called ''cardinal n ...
. Consider all the possible
strings String or strings may refer to: *String (structure), a long flexible structure made from threads twisted together, which is used to tie, bind, or hang other objects Arts, entertainment, and media Films * ''Strings'' (1991 film), a Canadian anim ...
of symbols, using an
alphabet An alphabet is a standardized set of basic written graphemes (called letters) that represent the phonemes of certain spoken languages. Not all writing systems represent language in this way; in a syllabary, each character represents a syll ...
with different symbols. The total number of such strings is , since there are possibilities for each of positions (see
rule of product In combinatorics, the rule of product or multiplication principle is a basic counting principle (a.k.a. the fundamental principle of counting). Stated simply, it is the intuitive idea that if there are a ways of doing something and b ways of doin ...
). For example, if and , then we can use an alphabet with two symbols (say and ), and there are strings of length 5: : , , , , , , , , : , , , , , , , , : , , , , , , , , : , , , , , , , . We will argue below that if we remove the strings consisting of a single symbol from the list (in our example, and ), the remaining strings can be arranged into groups, each group containing exactly strings. It follows that is divisible by .


Necklaces

Let us think of each such string as representing a
necklace A necklace is an article of jewellery that is worn around the neck. Necklaces may have been one of the earliest types of adornment worn by humans. They often serve Ceremony, ceremonial, Religion, religious, magic (illusion), magical, or Funerary ...
. That is, we connect the two ends of the string together and regard two strings as the same necklace if we can 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: : , , , , . In full, each line of the following list corresponds to a single necklace, and the entire list comprises all 32 strings. : , , , , , : , , , , , : , , , , , : , , , , , : , , , , , : , , , , , : , : . Notice that in the above list, each necklace with more than one symbol is represented by 5 different strings, and the number of necklaces represented by just one string is 2, i.e. is the number of distinct symbols. Thus the list shows very clearly why is divisible by . One can use the following rule to work out how many friends a given string has: : If is built up of several copies of the string , and cannot itself be broken down further into repeating strings, then the number of friends of (including itself) is equal to the ''length'' of . For example, suppose we start with the string , which is built up of several copies of the shorter string . If we rotate it one symbol at a time, we obtain the following 3 strings: : , : , : . There aren't any others, because is exactly 3 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 strings may be split into two categories: * Some strings contain identical symbols. There are exactly of these, one for each symbol in the alphabet. (In our running example, these are the strings and .) * The rest of the strings use at least two distinct symbols from the alphabet. If we can break up into repeating copies of some string , the length of must divide the length of . But, since the length of is the prime , the only possible length for is also . Therefore, the above rule tells us that has exactly friends (including itself). The second category contains strings, and they may be arranged into groups of strings, one group for each necklace. Therefore, must be divisible by , as promised.


Proof using dynamical systems

This proof uses some basic concepts from
dynamical system In mathematics, a dynamical system is a system in which a Function (mathematics), function describes the time dependence of a Point (geometry), point in an ambient space. Examples include the mathematical models that describe the swinging of a ...
s. We start by considering a family of functions ''T''''n''(''x''), where ''n'' ≥ 2 is an
integer An integer is the number zero (), a positive natural number (, , , etc.) or a negative integer with a minus sign (−1, −2, −3, etc.). The negative numbers are the additive inverses of the corresponding positive numbers. In the language ...
, mapping the interval
, 1 The comma is a punctuation mark that appears in several variants in different languages. It has the same shape as an apostrophe or single closing quotation mark () in many typefaces, but it differs from them in being placed on the baseline (t ...
to itself by the formula :T_n(x) = \begin \ & 0 \leq x < 1, \\ 1 & x = 1, \end where denotes the
fractional part The fractional part or decimal part of a non‐negative real number x is the excess beyond that number's integer part. If the latter is defined as the largest integer not greater than , called floor of or \lfloor x\rfloor, its fractional part can ...
of ''y''. For example, the function ''T''3(''x'') is illustrated below: A number ''x''0 is said to be a '' fixed point'' of a function ''f''(''x'') if ''f''(''x''0) = ''x''0; in other words, if ''f'' leaves ''x''0 fixed. The fixed points of a function can be easily found graphically: they are simply the ''x'' coordinates of the points where the
graph Graph may refer to: Mathematics *Graph (discrete mathematics), a structure made of vertices and edges **Graph theory, the study of such graphs and their properties *Graph (topology), a topological space resembling a graph in the sense of discre ...
of ''f''(''x'') intersects the graph of the line ''y'' = ''x''. For example, the fixed points of the function ''T''3(''x'') are 0, 1/2, and 1; they are marked by black circles on the following diagram: We will require the following two lemmas. Lemma 1. For any ''n'' ≥ 2, the function ''T''''n''(''x'') has exactly ''n'' fixed points. Proof. There are 3 fixed points in the illustration above, and the same sort of geometrical argument applies for any ''n'' ≥ 2. Lemma 2. For any positive integers ''n'' and ''m'', and any 0 ≤ x ≤ 1, :T_m(T_n(x)) = T_(x). In other words, ''T''''mn''(''x'') is the
composition Composition or Compositions may refer to: Arts and literature *Composition (dance), practice and teaching of choreography *Composition (language), in literature and rhetoric, producing a work in spoken tradition and written discourse, to include v ...
of ''T''''n''(''x'') and ''T''''m''(''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 :T_m(T_n(1)) = T_m(1) = 1 = T_(1). So let us assume that 0 ≤ ''x'' < 1. In this case, :T_n(x) = \ < 1, so ''T''''m''(''T''''n''(''x'')) is given by :T_m(T_n(x)) = \. Therefore, what we really need to show is that :\ = \. To do this we observe that = ''nx'' − ''k'', where ''k'' is the
integer part In mathematics and computer science, the floor function is the function that takes as input a real number , and gives as output the greatest integer less than or equal to , denoted or . Similarly, the ceiling function maps to the least inte ...
of ''nx''; then :\ = \ = \, since ''mk'' is an integer. Now let us properly begin the proof of Fermat's little theorem, by studying the function ''T''''a''''p''(''x''). We will assume that ''a'' ≥ 2. From Lemma 1, we know that it has ''a''''p'' fixed points. By Lemma 2 we know that :T_(x) = \underbrace_, so any fixed point of ''T''''a''(''x'') is automatically a fixed point of ''T''''a''''p''(''x''). We are interested in the fixed points of ''T''''a''''p''(''x'') that are ''not'' fixed points of ''T''''a''(''x''). Let us call the set of such points ''S''. There are ''a''''p'' − ''a'' points in ''S'', because by Lemma 1 again, ''T''''a''(''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 32 − 3 = 6. The main idea of the proof is now to split the set ''S'' up into its
orbits In celestial mechanics, an orbit is the curved trajectory of an object such as the trajectory of a planet around a star, or of a natural satellite around a planet, or of an artificial satellite around an object or position in space such as a p ...
under ''T''''a''. What this means is that we pick a point ''x''0 in ''S'', and repeatedly apply ''T''''a''(x) to it, to obtain the sequence of points : x_0, T_a(x_0), T_a(T_a(x_0)), T_a(T_a(T_a(x_0))), \ldots. This sequence is called the orbit of ''x''0 under ''T''''a''. By Lemma 2, this sequence can be rewritten as : x_0, T_a(x_0), T_(x_0), T_(x_0), \ldots. Since we are assuming that ''x''0 is a fixed point of ''T''''a'' ''p''(''x''), after ''p'' steps we hit ''T''''a''''p''(''x''0) = ''x''0, 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''0 is not a fixed point of ''T''''a''. In other words, the orbit contains exactly ''p'' distinct points. This holds for every orbit of ''S''. Therefore, the set ''S'', which contains ''a''''p'' − ''a'' points, can be broken up into orbits, each containing ''p'' points, so ''a''''p'' − ''a'' is divisible by ''p''. (This proof is essentially the same as the necklace-counting proof given above, simply viewed through a different lens: one may think of the interval , 1as 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''''a''''n'' amounts to shifting such a sequence by ''n'' many digits. The fixed points of this will be sequences that are cyclic with period dividing ''n''. In particular, the fixed points of ''T''''a''''p'' can be thought of as the necklaces of length ''p'', with ''T''''a''''n'' corresponding to rotation of such necklaces by ''n'' spots. This proof could also be presented without distinguishing between 0 and 1, simply using the half-open interval
Euler_ Leonhard_Euler_(_,_;_15_April_170718_September_1783)_was_a_Swiss_mathematician,_physicist,_astronomer,_geographer,_logician_and_engineer_who_founded_the_studies_of_graph_theory_and_topology_and_made_pioneering_and_influential_discoveries_in_ma_...
,_uses_mathematical_induction.html" "title="Leonhard_Euler.html" "title=", 1); then ''T''''n'' would only have ''n'' − 1 fixed points, but ''T''''a''''p'' − ''T''''a'' would still work out to ''a''''p'' − ''a'', as needed.)


Multinomial proofs


Proofs using the binomial theorem


Proof 1

This proof, due to Leonhard Euler">Euler Leonhard Euler ( , ; 15 April 170718 September 1783) was a Swiss mathematician, physicist, astronomer, geographer, logician and engineer who founded the studies of graph theory and topology and made pioneering and influential discoveries in ma ...
, uses mathematical induction">induction Induction, Inducible or Inductive may refer to: Biology and medicine * Labor induction (birth/pregnancy) * Induction chemotherapy, in medicine * Induced stem cells, stem cells derived from somatic, reproductive, pluripotent or other cell t ...
to prove the theorem for all integers . The base step, that , is trivial. Next, we must show that if the theorem is true for , then it is also true for . For this inductive step, we need the following lemma. Lemma. For any integers and and for any prime , . The lemma is a case of the freshman's dream. Leaving the proof for later on, we proceed with the induction. Proof. Assume ''k''''p'' ≡ ''k'' (mod ''p''), and consider (''k''+1)''p''. By the lemma we have :(k+1)^p \equiv k^p + 1^p \pmod. Using the induction hypothesis, we have that ''k''''p'' ≡ ''k'' (mod ''p''); and, trivially, 1''p'' = 1. Thus :(k+1)^p \equiv k + 1 \pmod, which is the statement of the theorem for ''a'' = ''k''+1. ∎ In order to prove the lemma, we must introduce the
binomial theorem In elementary algebra, the binomial theorem (or binomial expansion) describes the algebraic expansion of powers of a binomial. According to the theorem, it is possible to expand the polynomial into a sum involving terms of the form , where the ...
, which states that for any positive integer ''n'', :(x+y)^n=\sum_^nx^y^i, where the coefficients are the
binomial coefficients In mathematics, the binomial coefficients are the positive integers that occur as coefficients in the binomial theorem. Commonly, a binomial coefficient is indexed by a pair of integers and is written \tbinom. It is the coefficient of the t ...
, :=\frac, described in terms of the
factorial In mathematics, the factorial of a non-negative denoted is the product of all positive integers less than or equal The factorial also equals the product of n with the next smaller factorial: \begin n! &= n \times (n-1) \times (n-2) \t ...
function, ''n''! = 1×2×3×⋯×''n''. Proof of Lemma. We consider the binomial coefficient when the exponent is a prime ''p'': :=\frac The binomial coefficients are all integers. The numerator contains a factor ''p'' by the definition of factorial. When 0 < ''i'' < ''p'', neither of the terms in the denominator includes a factor of ''p'' (relying on the primality of ''p''), leaving the coefficient itself to possess a prime factor of ''p'' from the numerator, implying that : \equiv 0 \pmod,\qquad 0 < i < p. 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 : = 6, which is not divisible by 4.


Proof 2

Using the Lemma, we have: :k^p \equiv ((k-1)+1)^p \equiv (k-1)^p + 1 \equiv ((k-2)+1)^p + 1 \equiv (k-2)^p + 2 \equiv \dots \equiv k \pmod.


Proof using the multinomial expansion

The proof, which was first discovered by
Leibniz Gottfried Wilhelm (von) Leibniz . ( – 14 November 1716) was a German polymath active as a mathematician, philosopher, scientist and diplomat. He is one of the most prominent figures in both the history of philosophy and the history of mathema ...
(who did not publish it) and later rediscovered by
Euler Leonhard Euler ( , ; 15 April 170718 September 1783) was a Swiss mathematician, physicist, astronomer, geographer, logician and engineer who founded the studies of graph theory and topology and made pioneering and influential discoveries in ma ...
, is a very simple application of the
multinomial theorem In mathematics, the multinomial theorem describes how to expand a power of a sum in terms of powers of the terms in that sum. It is the generalization of the binomial theorem from binomials to multinomials. Theorem For any positive integer ...
, which states :(x_1 + x_2 + \cdots + x_m)^n = \sum_ x_1^ x_2^ \cdots x_m^ where : = \frac and the summation is taken over all sequences of nonnegative integer indices such the sum of all is . Thus if we express as a sum of 1s (ones), we obtain :a^p = (1 + 1 + ... + 1)^p = \sum_ Clearly, if is prime, and if is not equal to for any , we have : \equiv 0 \pmod p, and if is equal to for some then : = 1. Since there are exactly elements such that for some , the theorem follows. (This proof is essentially a coarser-grained variant of the 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 can be seen as a consequence of the fact that each nontrivial necklace of length can be unwrapped into a string in many ways. This multinomial expansion is also, of course, what essentially underlies the binomial theorem-based proof above)


Proof using power product expansions

An additive-combinatorial proof based on formal power product expansions was given by Giedrius Alkauskas. This proof uses neither the
Euclidean algorithm In mathematics, the Euclidean algorithm,Some widely used textbooks, such as I. N. Herstein's ''Topics in Algebra'' and Serge Lang's ''Algebra'', use the term "Euclidean algorithm" to refer to Euclidean division or Euclid's algorithm, is an effi ...
nor the
binomial theorem In elementary algebra, the binomial theorem (or binomial expansion) describes the algebraic expansion of powers of a binomial. According to the theorem, it is possible to expand the polynomial into a sum involving terms of the form , where the ...
, but rather it employs
formal power series In mathematics, a formal series is an infinite sum that is considered independently from any notion of convergence, and can be manipulated with the usual algebraic operations on series (addition, subtraction, multiplication, division, partial sum ...
with
rational Rationality is the quality of being guided by or based on reasons. In this regard, a person acts rationally if they have a good reason for what they do or a belief is rational if it is based on strong evidence. This quality can apply to an abili ...
coefficients.


Proof as a particular case of Euler's theorem

This proof, discovered by
James Ivory James Francis Ivory (born June 7, 1928) is an American film director, producer, and screenwriter. For many years, he worked extensively with Indian-born film producer Ismail Merchant, his domestic as well as professional partner, and with screen ...
and rediscovered by
Dirichlet Johann Peter Gustav Lejeune Dirichlet (; 13 February 1805 – 5 May 1859) was a German mathematician who made deep contributions to number theory (including creating the field of analytic number theory), and to the theory of Fourier series and ...
requires some background in
modular arithmetic In mathematics, modular arithmetic is a system of arithmetic for integers, where numbers "wrap around" when reaching a certain value, called the modulus. The modern approach to modular arithmetic was developed by Carl Friedrich Gauss in his book ...
. Let us assume that is positive and not divisible by . The idea is that if we write down the sequence of numbers and reduce each one modulo , the resulting sequence turns out to be a rearrangement of Therefore, if we multiply together the numbers in each sequence, the results must be identical modulo : :a \times 2a \times 3a \times \cdots \times (p-1)a \equiv 1 \times 2 \times 3 \times \cdots \times (p-1) \pmod p. Collecting together the terms yields :a^ (p-1)! \equiv (p-1)! \pmod p. Finally, we may “cancel out” the numbers from both sides of this equation, obtaining :a^ \equiv 1 \pmod p. There are two steps in the above proof that we need to justify: * Why the elements of the sequence (), reduced modulo , are a rearrangement of (), 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 and , then the sequence in question is :3, 6, 9, 12, 15, 18; reducing modulo 7 gives :3, 6, 2, 5, 1, 4, which is just a rearrangement of :1, 2, 3, 4, 5, 6. Multiplying them together gives :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; that is, :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. Canceling out 1 × 2 × 3 × 4 × 5 × 6 yields :3^6 \equiv 1 \pmod 7, which is Fermat's little theorem for the case and .


The cancellation law

Let us first explain why it is valid, in certain situations, to “cancel”. The exact statement is as follows. If , , and  are integers, and is not divisible by a prime number , and if then we may “cancel” to obtain Our use of this cancellation law in the above proof of Fermat's little theorem was valid, because the numbers are certainly not divisible by (indeed they are ''smaller'' than ). We can prove the cancellation law easily using
Euclid's lemma In algebra and number theory, Euclid's lemma is a lemma that captures a fundamental property of prime numbers, namely: For example, if , , , then , and since this is divisible by 19, the lemma implies that one or both of 133 or 143 must be as w ...
, which generally states that if a prime divides a product (where and are integers), then must divide or . Indeed, the assertion () simply means that divides . Since is a prime which does not divide , Euclid's lemma tells us that it must divide instead; that is, () holds. Note that the conditions under which the cancellation law holds are quite strict, and this explains why Fermat's little theorem demands that is a prime. For example, , but it is not true that . However, the following generalization of the cancellation law holds: if , , , and are integers, if and are
relatively prime In mathematics, two integers and are coprime, relatively prime or mutually prime if the only positive integer that is a divisor of both of them is 1. Consequently, any prime number that divides does not divide , and vice versa. This is equivale ...
, and if :ux \equiv uy \pmod z, then we may “cancel” to obtain :x \equiv y \pmod z. This follows from a generalization of Euclid's lemma.


The rearrangement property

Finally, we must explain why the sequence :a, 2a, 3a, \ldots, (p-1)a, when reduced modulo ''p'', becomes a rearrangement of the sequence :1, 2, 3, \ldots, p-1. To start with, none of the terms , , ..., can be congruent to zero modulo , since if is one of the numbers , then is relatively prime with , and so is , so
Euclid's lemma In algebra and number theory, Euclid's lemma is a lemma that captures a fundamental property of prime numbers, namely: For example, if , , , then , and since this is divisible by 19, the lemma implies that one or both of 133 or 143 must be as w ...
tells us that shares no factor with . Therefore, at least we know that the numbers , , ..., , when reduced modulo , must be found among the numbers . Furthermore, the numbers , , ..., must all be ''distinct'' after reducing them modulo , because if :ka \equiv ma \pmod p, where and are one of , then the cancellation law tells us that :k \equiv m \pmod p. Since both and are between and , they must be equal. Therefore, the terms , , ..., when reduced modulo must be distinct. To summarise: when we reduce the numbers , , ..., modulo , we obtain distinct members of the sequence , , ..., . Since there are exactly 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 In number theory, Euler's theorem (also known as the Fermat–Euler theorem or Euler's totient theorem) states that, if and are coprime positive integers, and \varphi(n) is Euler's totient function, then raised to the power \varphi(n) is congru ...
, with a slight alteration in that the numbers from to are substituted by the numbers less than and coprime with some number (not necessarily prime). Both the rearrangement property and the cancellation law (under the generalized form mentioned above) are still satisfied and can be utilized. For example, if , then the numbers less than  and coprime with are , , , and . Thus we have: :a \times 3a \times 7a \times 9a \equiv 1 \times 3 \times 7 \times 9 \pmod . Therefore, : \equiv 1 \pmod .


Proof as a corollary of Euler's criterion


Proofs using group theory


Standard proof

This proof requires the most basic elements of
group theory In abstract algebra, group theory studies the algebraic structures known as group (mathematics), groups. The concept of a group is central to abstract algebra: other well-known algebraic structures, such as ring (mathematics), rings, field ...
. The idea is to recognise that the set , with the operation of multiplication (taken modulo ), forms a
group A group is a number of persons or things that are located, gathered, or classed together. Groups of people * Cultural group, a group whose members share the same cultural identity * Ethnic group, a group whose members share the same ethnic ide ...
. The only group axiom that requires some effort to verify is that each element of is invertible. Taking this on faith for the moment, let us assume that is in the range , that is, is an element of . Let be the order of , that is, is the smallest positive integer such that . Then the numbers reduced modulo  form a
subgroup In group theory, a branch of mathematics, given a group ''G'' under a binary operation ∗, a subset ''H'' of ''G'' is called a subgroup of ''G'' if ''H'' also forms a group under the operation ∗. More precisely, ''H'' is a subgroup ...
of  whose order is  and therefore, by Lagrange's theorem, divides the order of , which is . So for some positive integer and then :a^ \equiv a^ \equiv (a^k)^m \equiv 1^m \equiv 1 \pmod p. To prove that every element of is invertible, we may proceed as follows. First, is
coprime In mathematics, two integers and are coprime, relatively prime or mutually prime if the only positive integer that is a divisor of both of them is 1. Consequently, any prime number that divides does not divide , and vice versa. This is equivale ...
to . Thus
Bézout's identity In mathematics, Bézout's identity (also called Bézout's lemma), named after Étienne Bézout, is the following theorem: Here the greatest common divisor of and is taken to be . The integers and are called Bézout coefficients for ; they a ...
assures us that there are integers and such that . Reading this equality modulo , we see that is an inverse for , since . Therefore, every element of is invertible. So, as remarked earlier, is a group. For example, when , the inverses of each element are given as follows: :


Euler's proof

If we take the previous proof and, instead of using Lagrange's theorem, we try to prove it in this specific situation, then we get Euler's third proof, which is the one that he found more natural. Let be the set whose elements are the numbers reduced modulo . If , then and therefore divides . Otherwise, there is some . Let be the set whose elements are the numbers reduced modulo . Then has distinct elements, because otherwise there would be two distinct numbers such that , which is impossible, since it would follow that . On the other hand, no element of can be an element of , because otherwise there would be numbers such that , and then , which is impossible, since . So, the set has elements. If it turns out to be equal to ''G'', then and therefore divides . Otherwise, there is some and we can start all over again, defining as the set whose elements are the numbers reduced modulo . Since is finite, this process must stop at some point and this proves that divides . For instance, if and , then, since * , * , * , we have and . Clearly, . Let be an element of ; for instance, take . Then, since * , * , * , * , we have . Clearly, . Let be an element of ; for instance, take . Then, since * , * , * , * , we have . And now . Note that the sets , , and so on are in fact the
coset In mathematics, specifically group theory, a subgroup of a group may be used to decompose the underlying set of into disjoint, equal-size subsets called cosets. There are ''left cosets'' and ''right cosets''. Cosets (both left and right) ...
s of in .


Notes

{{DEFAULTSORT:Fermat's Little Theorem, Proofs Of Modular arithmetic Number theory Article proofs