HOME

TheInfoList



OR:

In
algebra Algebra () is one of the broad areas of mathematics. Roughly speaking, algebra is the study of mathematical symbols and the rules for manipulating these symbols in formulas; it is a unifying thread of almost all of mathematics. Elementary a ...
and
number theory Number theory (or arithmetic or higher arithmetic in older usage) is a branch of pure mathematics devoted primarily to the study of the integers and arithmetic function, integer-valued functions. German mathematician Carl Friedrich Gauss (1777â ...
, Wilson's theorem states that a
natural number 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 ...
''n'' > 1 is a
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 ...
if and only if In logic and related fields such as mathematics and philosophy, "if and only if" (shortened as "iff") is a biconditional logical connective between statements, where either both statements are true or both are false. The connective is bicondi ...
the product of all the
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 ...
s less than ''n'' is one less than a multiple of ''n''. That is (using the notations 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 ...
), 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 ...
(n - 1)! = 1 \times 2 \times 3 \times \cdots \times (n - 1) satisfies :(n-1)!\ \equiv\; -1 \pmod n exactly when ''n'' is a prime number. In other words, any number ''n'' is a prime number if, and only if, (''n'' − 1)! + 1 is divisible by ''n''.


History

This theorem was stated by
Ibn al-Haytham Ḥasan Ibn al-Haytham, Latinized as Alhazen (; full name ; ), was a medieval mathematician, astronomer, and physicist of the Islamic Golden Age from present-day Iraq.For the description of his main fields, see e.g. ("He is one of the prin ...
(c. 1000 AD), and, in the 18th century, by John Wilson.
Edward Waring Edward Waring (15 August 1798) was a British mathematician. He entered Magdalene College, Cambridge as a sizar and became Senior wrangler in 1757. He was elected a Fellow of Magdalene and in 1760 Lucasian Professor of Mathematics, holding the ...
announced the theorem in 1770, although neither he nor his student Wilson could prove it. Lagrange gave the first proof in 1771. There is evidence that
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 ...
was also aware of the result a century earlier, but he never published it.


Example

For each of the values of ''n'' from 2 to 30, the following table shows the number (''n'' − 1)! and the remainder when (''n'' − 1)! is divided by ''n''. (In the notation 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 ...
, the remainder when ''m'' is divided by ''n'' is written ''m'' mod ''n''.) The background color is blue for prime values of ''n'', gold for composite values.


Proofs

The proofs (for prime moduli) below use the fact that the residue classes modulo a prime number are a
field Field may refer to: Expanses of open ground * Field (agriculture), an area of land used for agricultural purposes * Airfield, an aerodrome that lacks the infrastructure of an airport * Battlefield * Lawn, an area of mowed grass * Meadow, a grass ...
—see the article
prime field In mathematics, the characteristic of a ring , often denoted , is defined to be the smallest number of times one must use the ring's multiplicative identity (1) in a sum to get the additive identity (0). If this sum never reaches the additive iden ...
for more details. Lagrange's theorem, which states that in any field a
polynomial In mathematics, a polynomial is an expression consisting of indeterminates (also called variables) and coefficients, that involves only the operations of addition, subtraction, multiplication, and positive-integer powers of variables. An exa ...
of
degree Degree may refer to: As a unit of measurement * Degree (angle), a unit of angle measurement ** Degree of geographical latitude ** Degree of geographical longitude * Degree symbol (°), a notation used in science, engineering, and mathematics ...
''n'' has at most ''n''
roots A root is the part of a plant, generally underground, that anchors the plant body, and absorbs and stores water and nutrients. Root or roots may also refer to: Art, entertainment, and media * ''The Root'' (magazine), an online magazine focusing ...
, is needed for all the proofs.


Composite modulus

If ''n'' is composite it is divisible by some prime number ''q'', where . Because q divides n, let n = qk for some integer k. Suppose for the sake of contradiction that were congruent to where n is composite. Then (n-1)! would also be congruent to −1 (mod ''q'') as (n-1)! \equiv -1 \ (\text \ n) implies that (n-1)! = nm - 1 = (qk)m - 1 = q(km) - 1 for some integer m which shows (n-1)! being congruent to -1 (mod q). But (''n'' âˆ’ 1)! â‰¡ 0 (mod ''q'') by the fact that q is a term in (n-1)! making (n-1)! a multiple of q. A contradiction is now reached. In fact, more is true. With the sole exception of 4, where 3! = 6 â‰¡ 2 (mod 4), if ''n'' is composite then (''n'' âˆ’ 1)! is congruent to 0 (mod ''n''). The proof is divided into two cases: First, if ''n'' can be factored as the product of two unequal numbers, , where 2 â‰¤ ''a'' < ''b'' â‰¤ ''n'' âˆ’ 2, then both ''a'' and ''b'' will appear in the product and (''n'' âˆ’ 1)! will be divisible by ''n''. If ''n'' has no such factorization, then it must be the square of some prime ''q'', ''q'' > 2. But then 2''q'' < ''q''2 = ''n'', both ''q'' and 2''q'' will be factors of (''n'' âˆ’ 1)!, and again ''n'' divides (''n'' âˆ’ 1)!.


Prime modulus


Elementary proof

The result is trivial when , so assume ''p'' is an odd prime, . Since the residue classes (mod ''p'') are a field, every non-zero ''a'' has a unique multiplicative inverse, ''a''−1. Lagrange's theorem implies that the only values of ''a'' for which are (because the congruence can have at most two roots (mod ''p'')). Therefore, with the exception of ±1, the factors of can be arranged in disjoint pairs such that product of each pair is congruent to 1 modulo ''p''. This proves Wilson's theorem. For example, for , one has 10! = 1\cdot10)cdot 2\cdot6)(3\cdot4)(5\cdot9)(7\cdot8) \equiv 1cdot \cdot1\cdot1\cdot1 \equiv -1 \pmod.


Proof using Fermat's little theorem

Again, the result is trivial for ''p'' = 2, so suppose ''p'' is an odd prime, . Consider the polynomial :g(x)=(x-1)(x-2) \cdots (x-(p-1)). ''g'' has degree , leading term , and constant term . Its roots are 1, 2, ..., . Now consider :h(x)=x^-1. ''h'' also has degree and leading term . Modulo ''p'',
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 = ...
says it also has the same roots, 1, 2, ..., . Finally, consider :f(x)=g(x)-h(x). ''f'' has degree at most ''p'' âˆ’ 2 (since the leading terms cancel), and modulo ''p'' also has the roots 1, 2, ..., . But Lagrange's theorem says it cannot have more than ''p'' âˆ’ 2 roots. Therefore, ''f'' must be identically zero (mod ''p''), so its constant term is . This is Wilson's theorem.


Proof using the Sylow theorems

It is possible to deduce Wilson's theorem from a particular application of the
Sylow theorems In mathematics, specifically in the field of finite group theory, the Sylow theorems are a collection of theorems named after the Norwegian mathematician Peter Ludwig Sylow that give detailed information about the number of subgroups of fixed ...
. Let ''p'' be a prime. It is immediate to deduce that the
symmetric group In abstract algebra, the symmetric group defined over any set is the group whose elements are all the bijections from the set to itself, and whose group operation is the composition of functions. In particular, the finite symmetric group \m ...
S_p has exactly (p-1)! elements of order ''p'', namely the ''p''-cycles C_p . On the other hand, each Sylow ''p''-subgroup in S_p is a copy of C_p . Hence it follows that the number of Sylow ''p''-subgroups is n_p=(p-2)! . The third Sylow theorem implies :(p-2)! \equiv 1 \pmod p. Multiplying both sides by gives :(p-1)! \equiv p-1 \equiv -1 \pmod p, that is, the result.


Applications


Primality tests

In practice, Wilson's theorem is useless as a
primality test A primality test is an algorithm for determining whether an input number is prime. Among other fields of mathematics, it is used for cryptography. Unlike integer factorization, primality tests do not generally give prime factors, only stating whet ...
because computing (''n'' − 1)! modulo ''n'' for large ''n'' is computationally complex, and much faster primality tests are known (indeed, even
trial division Trial division is the most laborious but easiest to understand of the integer factorization algorithms. The essential idea behind trial division tests to see if an integer ''n'', the integer to be factored, can be divided by each number in turn ...
is considerably more efficient). Used in the other direction, to determine the primality of the successors of large factorials, it is indeed a very fast and effective method. This is of limited utility, however.


Quadratic residues

Using Wilson's Theorem, for any odd prime , we can rearrange the left hand side of 1\cdot 2\cdots (p-1)\ \equiv\ -1\ \pmod to obtain the equality 1\cdot(p-1)\cdot 2\cdot (p-2)\cdots m\cdot (p-m)\ \equiv\ 1\cdot (-1)\cdot 2\cdot (-2)\cdots m\cdot (-m)\ \equiv\ -1 \pmod. This becomes \prod_^m\ j^2\ \equiv(-1)^ \pmod or (m!)^2 \equiv(-1)^ \pmod. We can use this fact to prove part of a famous result: for any prime ''p'' such that ''p'' â‰¡ 1 (mod 4), the number (−1) is a square (
quadratic residue In number theory, an integer ''q'' is called a quadratic residue modulo ''n'' if it is congruent to a perfect square modulo ''n''; i.e., if there exists an integer ''x'' such that: :x^2\equiv q \pmod. Otherwise, ''q'' is called a quadratic no ...
) mod ''p''. For suppose ''p'' = 4''k'' + 1 for some integer ''k''. Then we can take ''m'' = 2''k'' above, and we conclude that (''m''!)2 is congruent to (−1).


Formulas for primes

Wilson's theorem has been used to construct
formulas for primes In number theory, a formula for primes is a formula generating the prime numbers, exactly and without exception. No such formula which is efficiently computable is known. A number of constraints are known, showing what such a "formula" can and ca ...
, but they are too slow to have practical value.


p-adic gamma function

Wilson's theorem allows one to define the
p-adic gamma function In mathematics, the -adic number system for any prime number  extends the ordinary arithmetic of the rational numbers in a different way from the extension of the rational number system to the real and complex number systems. The extension ...
.


Gauss' generalization

Gauss’ generalization of Wilson’s Theorem states that if n is four, an odd prime power, or twice an odd prime power, then the product of relatively prime integers less than itself add one is divisible by n . It goes further to say that otherwise, the same product subtract one is divisible by n . To state Gauss' Generalization of Wilson's Theorem, we use the
Euler's totient function In number theory, Euler's totient function counts the positive integers up to a given integer that are relatively prime to . It is written using the Greek letter phi as \varphi(n) or \phi(n), and may also be called Euler's phi function. In ot ...
, denoted \varphi(n) , which is defined as the number of positive integers less than or equal to n which are also relatively prime with n . Let's call such numbers a_i , where \gcd(a_i,n)=1 . Gauss proved given an odd prime p and some integer \alpha>0 , then : \prod_^ \!\!a_k \ = \begin -1 \pmod n & \text n=4,\;p^\alpha,\;2p^\alpha \\ \;\;\,1 \pmod n & \text \end . First, let's us note this is the proof for cases n>2 , since the results are trivial for n =\ . For all a_i , we know there exist some a_j , where i\neq j and \gcd(a_j,n)=1 , such that a_ia_j=1 . This allows us to pair each of the elements together with its inverse. We are left now with a_i being its own inverse. So in other words a_i is a root of f(x)=x^2-1 in \Z/n\Z , and f(x)=(x-1)(x+1) , in the polynomial ring \Z/n\Z . If a_i is a root, it follows that n-a_i is also a root. Our objective is to show that the number of roots is divisible by four, unless n=4, n=p^\alpha , or n = 2p^\alpha . Let's consider n=2 . Then we notice we have one root since 1\equiv-1\pmod2 . Consider n=4 . Then, it is clear there are two roots, specifically, x\equiv1\pmod4 and x\equiv-1\pmod4 . Say n=p^\alpha . It is again clear there are two solutions. We now consider n=2^\beta, \beta>2 . If one of the factors of f(x) is divisible by 2, so is the other. Take the factor (x+1) to be divisible by 2^1 . Then, it follows that there are 4 distinct roots of f(x) , namely x\equiv1\pmod n , x\equiv1+2^\pmod n , x\equiv-1\pmod n , and x\equiv-1-2^\pmod n , when n=2^\beta, \beta>2 . Finally, let's look at the general case where n=2^\beta p_1p_2\dots p_k . We find 2 roots of f(x) over each \Z/2^\beta\Z and \Z/p_r^\Z , except when \beta>2 . Using the
Chinese remainder theorem In mathematics, the Chinese remainder theorem states that if one knows the remainders of the Euclidean division of an integer ''n'' by several integers, then one can determine uniquely the remainder of the division of ''n'' by the product of thes ...
, we find that when n is not divisible by 2, we have a total of 2^k solutions of f(x) . Assuming \beta=1 , in \Z/2\Z , we have one root, so we still have a total of 2^k solutions. When \beta=2 , we have 4 roots in \Z/4\Z , so there are a total of 2^ roots of f(x) . For all cases where \beta>2 , there are 4 roots in \Z/2^\beta\Z with a total of 2^ solutions. This shows that the number of roots are divisible by 4, unless n=4, n=p^\alpha , or n=2p^\alpha . Say a_i is a root of f(x) in \Z/n\Z . Then a_i(n-a_i)=-a_i^2=-1 . So, if the number of roots of f(x) is divisible by 4, then we can say the product of the roots if 1. Otherwise, we can say the product is -1. So we can conclude that \prod_^ \!\!a_k \ = \begin -1 \pmod n & \text n=4,\;p^\alpha,\;2p^\alpha \\ \;\;\,1 \pmod n & \text \end .


See also

*
Wilson prime In number theory, a Wilson prime is a prime number p such that p^2 divides (p-1)!+1, where "!" denotes the factorial function; compare this with Wilson's theorem, which states that every prime p divides (p-1)!+1. Both are named for 18th-century E ...
*
Table of congruences In mathematics, a congruence is an equivalence relation on the integers. The following sections list important or interesting prime-related congruences. Table of congruences characterizing special primes Other prime-related congruences There ...


Notes


References

The ''
Disquisitiones Arithmeticae The (Latin for "Arithmetical Investigations") is a textbook of number theory written in Latin by Carl Friedrich Gauss in 1798 when Gauss was 21 and first published in 1801 when he was 24. It is notable for having had a revolutionary impact on th ...
'' has been translated from Gauss's Ciceronian Latin into English and German. The German edition includes all of his papers on number theory: all the proofs of quadratic reciprocity, the determination of the sign of the Gauss sum, the investigations into biquadratic reciprocity, and unpublished notes. *. *. *. *


External links

* * *
Mizar system The Mizar system consists of a formal language for writing mathematical definitions and proofs, a proof assistant, which is able to mechanically check proofs written in this language, and a library of formalized mathematics, which can be used i ...
proof: http://mizar.org/version/current/html/nat_5.html#T22 * {{DEFAULTSORT:Wilson's Theorem Modular arithmetic Factorial and binomial topics Articles containing proofs Theorems about prime numbers Primality tests