Saturday, 4 July 2026

Exercise (6.4).20

Prove Wilson’s Theorem (4.4) by using a primitive root of a prime:

If $p$ is prime then 

$$ (p - 1)! \equiv -1 \pmod p $$


Since $p$ is prime, by Proposition (6.22) we know it has a primitive root, which we can call $r$,


We know from Proposition (6.11) that the set

$$ \{ r^1, r^2, r^3, \ldots, r^{p-2}, r^{p-1} \} $$

is congruent modulo $p$ to the set

$$ \{ (p-1), (p-2), (p-3), \ldots, 3, 2, 1 \} $$

And so

$$ (p-1)! \equiv (p-1) \times (p-2) \times (p-3) \times \ldots \times 3 \times  2 \times 1  \pmod p $$

is congruent to

$$ r^1 \times r^2  \times r^3 \times \ldots \times r^{p-2} \times r^{p-1} \pmod p  $$

Which gives us

$$ \begin{align} (p-1) ! & \equiv r^{1 + 2 + 3 \ldots + (p-2) + (p-1) }  \pmod p \\ \\ & \equiv r^{\frac{(p-1)p}{2}} \pmod p  \end{align} $$


Fermat's Little Theorem tells us $r^{p-1} \equiv 1 \pmod p$.  We now consider two cases for $p$, odd and even.

Odd $p$

For odd $p$, we must have $r^{\frac{p-1}{2}} \equiv -1$ since $r$ is a primitive root and no smaller index than $p-1$ of $r$ can be congruent to 1 modulo $p$. Using $p$ is odd, $(-1)^p \equiv -1 \pmod p$, and so

$$ (p-1)!  \equiv r^{\frac{(p-1)p}{2}} \equiv (-1)^p \equiv -1 \pmod p $$

Even $p$

Here $p=2$, and so we have the trivial case of 

$$ (p-1)! \equiv (2-1)! \equiv 1 \equiv -1 \pmod p   $$


Both cases conclude with Wilson's Theorem

$$ (p - 1)! \equiv -1 \pmod p $$