# Wilson's theorem proof

1. Dec 12, 2013

### mahler1

The problem statement, all variables and given/known data.
This is an exercise I've taken from Rotman's introductory textbook about groups.
Prove Wilson's theorem: If $p$ is a prime, then $(p-1)!=-1 \text{ mod } p$. He gives the following hint: The nonzero elements of $\mathbb Z_p$ form a multiplicative group.

The attempt at a solution.

I couldn't make use of the hint, until now, all I've deduced is: since $p-1=-1 \text{ mod } p$, then to prove Wilson's theorem would be equivalent to prove that $(p-1)!=p-1 \text{ mod } p$. Could anyone guide me on how could I use the hint?

2. Dec 12, 2013

### jbunniii

If $p=2$ then the theorem is obviously true.

If $p$ is a prime greater than 2, then $p$ is odd. So the multiplicative group $\{1, 2, \ldots p-1\}$ has an even number of elements. Try pairing each element of the group with its inverse. Can you conclude anything interesting?

3. Dec 12, 2013

### mahler1

$p-1=-1 \text { mod } p$. From here, one can deduce that $(p-1)^{-1}=p-1 \text { mod } p$, so we can consider the set $\{2,...,p-2\}$ and pair each element $n_{i}$ of this set with its inverse $n_{i}^{-1}$, which is also in the set $\{2,...,p-2\}$. Then, $(p-1)!=1.(\prod n_i n_{i}^{-1}).(p-1)=1.1.(p-1)=p-1=-1 \text { mod } p$.

My notation is awful, but I didn't know how to write properly your suggestion. Thanks for the help!

4. Dec 12, 2013

### jbunniii

Yes, you have the right idea. The key is that there are exactly two elements which are their own inverses: $1$ and $p-1$. (Proof: $x^2 = 1$ iff $x^2 - 1 = 0$ iff $(x+1)(x-1) = 0$ iff $x=-1$ or $x=1$.) All the other elements cancel each other out in pairs.