(mathematics) The number (n - 1)! + 1 is divisible by n if and only if n is a prime.
| Sci-Tech Dictionary: Wilson's theorem |
(mathematics) The number (n - 1)! + 1 is divisible by n if and only if n is a prime.
| 5min Related Video: Wilson's theorem |
| Wikipedia: Wilson's theorem |
In mathematics, Wilson's theorem states that a natural number n > 1 is a prime number if and only if

(see factorial and modular arithmetic for the notation).
Contents |
The theorem was first discovered by Bhaskara I, and later explained by Ibn al-Haytham (known as Alhazen in Medieval Europe) circa 1000 AD, but it is named after John Wilson (a student of the English mathematician Edward Waring) who stated it in the 18th century.[1] Waring announced the theorem in 1770, although neither he nor Wilson could prove it. Lagrange gave the first proof in 1773.[2] There is evidence that Leibniz was also aware of the result a century earlier, but he never published it.
This proof uses the fact that if p is a prime, then the set of numbers G = (Z/pZ)× = {1, 2, ... p − 1} forms a group under multiplication modulo p. This means that for each element a in G, there is a unique inverse element b in G such that ab ≡ 1 (mod p). If a ≡ b (mod p), then a2 ≡ 1 (mod p), which forces a2 − 1 = (a + 1)(a − 1) ≡ 0 (mod p), and since p is prime, this forces a ≡ 1 or −1 (mod p), i.e. a = 1 or a = p − 1.
In other words, 1 and p − 1 are each their own inverse, but every other element of G has a distinct inverse, and so if we collect the elements of G pairwise in this fashion and multiply them all together, we get the product −1. For example, if p = 11, we have

The commutative and associative properties are used in above procedure. All elements in the above product will be of the form g g −1 ≡ 1 (mod p) except 1 (p − 1) which is left.
If p = 2, the result is trivial to check.
To prove the converse (see below for a more exact converse result), suppose the congruence holds for a composite n, and note that then n has a proper divisor d with 1 < d < n. Clearly, d divides (n − 1)! But by the congruence, d also divides (n − 1)! + 1, so that d divides 1, a contradiction.
Here is another proof of the first direction: Suppose p is prime. Consider the polynomial

From Lagrange's theorem, if f(x) is a nonzero polynomial of degree d over a field F, then f(x) has at most d roots over F. Now, with g(x) as above, consider the polynomial

Since the leading coefficients cancel, we see that f(x) is a polynomial of degree at most p − 2. Reducing mod p, we see that f(x) has at most p − 2 roots mod p. But by Fermat's little theorem, each of the elements 1, 2, ..., p − 1 is a root of f(x). This is impossible, unless f(x) is identically zero mod p, i.e. unless each coefficient of f(x) is divisible by p.
But since p is odd, the constant term of f(x) is just (p − 1)! + 1, and the result follows.
Wilson's theorem is useless as a primality test in practice, since computing (n − 1)! modulo n for large n is hard, and far easier primality tests are known (indeed, even trial division is considerably more efficient).
Using Wilson's Theorem, for any odd prime p = 2m + 1 we can rearrange the left hand side of

to obtain the equality

This becomes

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) mod p. For suppose p = 4k + 1 for some integer k. Then we can take m = 2k above, and we conclude that

Wilson's theorem has been used to construct formulas for primes, but they are too slow to have practical value.
Wilson's theorem can be generalized to the following statement:

From the above proofs we already know that for prime n we have 
We can easily verify the cases n=1 and n=4 by hand. Which leaves us with the case where n is a composite number larger than 5. In this case the above statement claims that n divides (n-1)!. We will now prove this.
Note that by definition

We will show that we can always find two of these n-1 terms such that their product is divisible by n.
In most cases, a composite n > 5 has a divisor a such that 2 ≤ a < (n/a). In such case, the two terms are a and (n/a). The only case when no such a exists is if n is a square of a prime p>2. In this case, the two terms are p and 2p.
The following is a stronger generalization of Wilson's theorem, due to Carl Friedrich Gauss:

where p is an odd prime, and α is a positive integer. This further generalizes to the fact that in any finite abelian group, either the product of all elements is the identity, or there is precisely one element a of order 2. In the latter case, the product of all elements equals a.
This entry is from Wikipedia, the leading user-contributed encyclopedia. It may not have been reviewed by professional editors (see full disclaimer)
| Best of the Web: Wilson's theorem |
Some good "Wilson's theorem" pages on the web:
Math mathworld.wolfram.com |
| Comte Joseph Louis Lagrange | |
| Wilson quotient | |
| Agoh–Giuga conjecture |
| What is the Pythagoran theorem? Read answer... | |
| What is Dini's Theorem? Read answer... | |
| The pythagorean theorem? Read answer... |
Copyrights:
![]() | Sci-Tech Dictionary. McGraw-Hill Dictionary of Scientific and Technical Terms. Copyright © 2003, 1994, 1989, 1984, 1978, 1976, 1974 by McGraw-Hill Companies, Inc. All rights reserved. Read more | |
![]() | Wikipedia. This article is licensed under the Creative Commons Attribution/Share-Alike License. It uses material from the Wikipedia article "Wilson's theorem". Read more |
Mentioned in