Thursday, 15 January 2026

Exercise (4.2).17

Prove Wilson’s Theorem by using Fermat’s Little Theorem.

Hint: Consider the equation $x^{p−1} − 1 \equiv 0 \pmod p $.


Note: This exercise requires additional knowledge about factorising polynomials (pdf).


If prime $p$ does not divide $x$ then by the FlT, 

$$ x^{p-1} - 1 \equiv 0 \pmod p $$

This means $x \equiv 1, 2, 3, \ldots, p-1 \pmod p$ are solutions of the polynomial congruence $x^{p-1} - 1 \equiv 0 \pmod p$.


Using the factorisation of polynomials (Theorem 4.3 in the linked book), we can factorise the polynomial $x^{p-1} - 1$ modulo $p$ as

$$ x^{p-1} - 1 \equiv (x-1)(x-2)(x-3) \ldots (x-(p-1)) \times Q(x) \pmod p $$

where $Q(x)$ is a polynomial of order 0, that is, a constant. This means $Q(x)=q$, for integer $q$. Comparing coefficients of the left and right hand sides, tells us $q \equiv 1 \pmod p$. And so the factorisation simplifies to

$$ x^{p-1} - 1 \equiv  (x-1)(x-2)(x-3) \ldots (x-(p-1)) \pmod p $$


When $x=0$ we have the following, which makes use of $(-1)^{p-1} \equiv 1 \pmod p$ for $p>2$, and $(-1)^{1} \equiv 1 \pmod p$ for $p=2$.

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

This is Wilson's Theorem.