Wilson's theorem

From Academic Kids

In mathematics, Wilson's Theorem states that for a prime number p > 1,

<math>(p-1)!\ \equiv\ -1\ (\mbox{mod}\ p)<math>

(see factorial and modular arithmetic for the notation). There is a converse result.



The theorem was first discovered by Ibn al-Haytham (also known as Alhazen), but it is named after John Wilson (a student of the English mathematician Edward Waring) who rediscovered it more than 700 years later. Waring announced the theorem in 1770, although neither he nor Wilson could prove it. Lagrange gave the first proof in 1773. There is evidence that Leibniz was also aware of the result a century earlier, but he never published it.


First proof

This proof uses the fact that if p is an odd 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 i in G, there is a unique inverse element j in G such that ij ≡ 1 (mod p). If ij (mod p), then i2 ≡ 1 (mod p), which forces i2 − 1 = (i + 1)(i − 1) ≡ 0 (mod p), and since p is prime, this forces i ≡ 1 or −1 (mod p), i.e. i = 1 or i = 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

<math>10! = 1(10)(2 \cdot 6)(3 \cdot 4)(5 \cdot 9)(7 \cdot 8) \ \equiv\ -1\ (\mbox{mod}\ 11)<math>

If p = 2, the result is trivial to check.

For a converse (but 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.

Second proof

Here is another proof of the first direction: Suppose p is an odd prime. Consider the polynomial

<math>g(x)=(x-1)(x-2) \cdots (x-(p-1))<math>

Recall that 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 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, since computing (n − 1)! is difficult for large n.

Using Wilson's Theorem, we have for any prime p:

<math>1\cdot 2\cdots (p-1)\ \equiv\ -1\ (\mbox{mod}\ p)<math>
<math>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\ (\mbox{mod}\ p)<math>

where p = 2m + 1. This becomes:

<math>\prod_{j=1}^m\ j^2\ \equiv(-1)^{m+1}\ (\mbox{mod}\ p)<math>

And so primality is determined by the quadratic residues of p. We can use this fact to prove part of a famous result: −1 is a square (quadratic residue) mod p if p ≡ 1 (mod 4). For suppose p = 4k + 1 for some integer k. Then we can take m = 2k above, and we conclude that

<math>\left( \prod_{j=1}^{2k}\ j \right)^{2} = \prod_{j=1}^{2k}\ j^2\ \equiv (-1)^{2k+1}\ = -1(\mbox{mod}\ p)<math>


There is also a generalization of Wilson's theorem, due to Carl Friedrich Gauss:

<math>\prod_{\begin{matrix} 1 \le a < m \\ (a,m)=1 \end{matrix}} a \ \equiv \ \left \{ \begin{matrix} -1\ (\mbox{mod }m) & \mbox{if } m=4,\;p^\alpha,\;2p^\alpha \\ \ \ 1\ (\mbox{mod }m) & \mbox{otherwise} \end{matrix} \right. <math>

where p is an odd prime.


The converse to Wilson's theorem states that for a composite number n > 5,

n divides (n − 1)!.

This leaves the case n = 4, for which 3! is congruent to 2 modulo 4.

In fact if q is a prime factor of n, so that n = qa, the numbers

1, 2, ..., n − 1

include a − 1 multiples of q. Therefore the power of q dividing the factorial is at least n/q − 1; and the power dividing n at most

log n/log q.

The required inequality

log n/log qn/q − 1

does hold in general, except for the case q = 2 and n = 4.bg:Теорема на Уилсън de:Satz von Wilson fr:Thorme de Wilson ko:윌슨의 정리 sv:Wilsons sats th:ทฤษฎีบทของวิลสัน zh:威尔逊定理


Academic Kids Menu

  • Art and Cultures
    • Art (http://www.academickids.com/encyclopedia/index.php/Art)
    • Architecture (http://www.academickids.com/encyclopedia/index.php/Architecture)
    • Cultures (http://www.academickids.com/encyclopedia/index.php/Cultures)
    • Music (http://www.academickids.com/encyclopedia/index.php/Music)
    • Musical Instruments (http://academickids.com/encyclopedia/index.php/List_of_musical_instruments)
  • Biographies (http://www.academickids.com/encyclopedia/index.php/Biographies)
  • Clipart (http://www.academickids.com/encyclopedia/index.php/Clipart)
  • Geography (http://www.academickids.com/encyclopedia/index.php/Geography)
    • Countries of the World (http://www.academickids.com/encyclopedia/index.php/Countries)
    • Maps (http://www.academickids.com/encyclopedia/index.php/Maps)
    • Flags (http://www.academickids.com/encyclopedia/index.php/Flags)
    • Continents (http://www.academickids.com/encyclopedia/index.php/Continents)
  • History (http://www.academickids.com/encyclopedia/index.php/History)
    • Ancient Civilizations (http://www.academickids.com/encyclopedia/index.php/Ancient_Civilizations)
    • Industrial Revolution (http://www.academickids.com/encyclopedia/index.php/Industrial_Revolution)
    • Middle Ages (http://www.academickids.com/encyclopedia/index.php/Middle_Ages)
    • Prehistory (http://www.academickids.com/encyclopedia/index.php/Prehistory)
    • Renaissance (http://www.academickids.com/encyclopedia/index.php/Renaissance)
    • Timelines (http://www.academickids.com/encyclopedia/index.php/Timelines)
    • United States (http://www.academickids.com/encyclopedia/index.php/United_States)
    • Wars (http://www.academickids.com/encyclopedia/index.php/Wars)
    • World History (http://www.academickids.com/encyclopedia/index.php/History_of_the_world)
  • Human Body (http://www.academickids.com/encyclopedia/index.php/Human_Body)
  • Mathematics (http://www.academickids.com/encyclopedia/index.php/Mathematics)
  • Reference (http://www.academickids.com/encyclopedia/index.php/Reference)
  • Science (http://www.academickids.com/encyclopedia/index.php/Science)
    • Animals (http://www.academickids.com/encyclopedia/index.php/Animals)
    • Aviation (http://www.academickids.com/encyclopedia/index.php/Aviation)
    • Dinosaurs (http://www.academickids.com/encyclopedia/index.php/Dinosaurs)
    • Earth (http://www.academickids.com/encyclopedia/index.php/Earth)
    • Inventions (http://www.academickids.com/encyclopedia/index.php/Inventions)
    • Physical Science (http://www.academickids.com/encyclopedia/index.php/Physical_Science)
    • Plants (http://www.academickids.com/encyclopedia/index.php/Plants)
    • Scientists (http://www.academickids.com/encyclopedia/index.php/Scientists)
  • Social Studies (http://www.academickids.com/encyclopedia/index.php/Social_Studies)
    • Anthropology (http://www.academickids.com/encyclopedia/index.php/Anthropology)
    • Economics (http://www.academickids.com/encyclopedia/index.php/Economics)
    • Government (http://www.academickids.com/encyclopedia/index.php/Government)
    • Religion (http://www.academickids.com/encyclopedia/index.php/Religion)
    • Holidays (http://www.academickids.com/encyclopedia/index.php/Holidays)
  • Space and Astronomy
    • Solar System (http://www.academickids.com/encyclopedia/index.php/Solar_System)
    • Planets (http://www.academickids.com/encyclopedia/index.php/Planets)
  • Sports (http://www.academickids.com/encyclopedia/index.php/Sports)
  • Timelines (http://www.academickids.com/encyclopedia/index.php/Timelines)
  • Weather (http://www.academickids.com/encyclopedia/index.php/Weather)
  • US States (http://www.academickids.com/encyclopedia/index.php/US_States)


  • Home Page (http://academickids.com/encyclopedia/index.php)
  • Contact Us (http://www.academickids.com/encyclopedia/index.php/Contactus)

  • Clip Art (http://classroomclipart.com)
Personal tools