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 ...
satisfies
:
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
divides
, let
for some integer
. 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
implies that
for some integer
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
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'' has degree , leading term , and constant term . Its roots are 1, 2, ..., .
Now consider
:
''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'' 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 ...
has exactly
elements of order ''p'', namely the ''p''-cycles
. On the other hand, each Sylow ''p''-subgroup in
is a copy of
. Hence it follows that the number of Sylow ''p''-subgroups is
. The third Sylow theorem implies
:
Multiplying both sides by gives
:
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
to obtain the equality
This becomes
or
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
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
. It goes further to say that otherwise, the same product subtract one is divisible by
.
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
, which is defined as the number of positive integers less than or equal to
which are also relatively prime with
. Let's call such numbers
, where
.
Gauss proved given an odd prime
and some integer
, then
:
.
First, let's us note this is the proof for cases
, since the results are trivial for
.
For all
, we know there exist some
, where
and
, such that
. This allows us to pair each of the elements together with its inverse. We are left now with
being its own inverse. So in other words
is a root of
in
, and
, in the polynomial ring
. If
is a root, it follows that
is also a root. Our objective is to show that the number of roots is divisible by four, unless
, or
.
Let's consider
. Then we notice we have one root since
.
Consider
. Then, it is clear there are two roots, specifically,
and
.
Say
. It is again clear there are two solutions.
We now consider
. If one of the factors of
is divisible by 2, so is the other. Take the factor
to be divisible by
. Then, it follows that there are 4 distinct roots of
, namely
,
,
, and
, when
.
Finally, let's look at the general case where
. We find 2 roots of
over each
and
, except when
. 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
is not divisible by 2, we have a total of
solutions of
. Assuming
, in
, we have one root, so we still have a total of
solutions. When
, we have 4 roots in
, so there are a total of
roots of
. For all cases where
, there are 4 roots in
with a total of
solutions. This shows that the number of roots are divisible by 4, unless
, or
.
Say
is a root of
in
. Then
. So, if the number of roots of
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
.
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