Tuesday, March 6, 2012

my proof of Wilson's theorem

The Wilson's theorem says that (n-1)! + 1 is divisible by n iff n is prime.

The only if direction is easy. If (n-1)! = -1, then (n-2)! = 1 mod n, so each of 1,2,...,n-2 are relatively prime to n. Clearly n-1 is relatively prime to n,  then 1,2,...,n-1 are all relatively prime to n, but this can only happen if n is a prime.
The if direction is harder.


When n is prime, let 1 < a < n, then a, a^2, ..., a^n-1 will hit 1, 2, ..., n-1, so

a * a^2 * ... ^ a^(n-1) = (n-1)! all arithmetic under mod n

then a^(n(n-1)/2) = (n-1)!

From Fermat's little theorem we have a^(n-1)=1
so ((n-1)!)^2 = a^n(n-1) = 1

Because n is prime, then (n-1)! can have only trivial roots, which are +1 and -1.

If (n-1)! = -1 we are done, so we now argue that (n-1)! not equal to 1.

Suppose for contradiction that (n-1)! = 1 for some prime n.
then n-1 + (n-1)! = 0
(n-1) (1 + (n-2)!) = 0
since n-1 neq 0
we have 1+(n-2)! = 0
therefore (n-2)!=-1
so (n-1)=1 // this is false. no idea how to fix it.
but this can only be true when n=2. QED.

1 comment: