proof of Wilson’s theorem

We first show that, if $p$ is a prime, then $(p-1)!\equiv-1\pmod{p}.$ Since $p$ is prime, $\mathbb{Z}_{p}$ is a field and thus, pairing off each element with its inverse in the product $(p-1)!=\prod_{x=1}^{p-1}x,$ we are left with the elements which are their own inverses (i.e. which satisfy the equation $x^{2}\equiv 1\pmod{p}$), $1$ and $-1$, only. Consequently, $(p-1)!\equiv-1\pmod{p}.$

To prove that the condition is necessary, suppose that $(p-1)!\equiv-1\pmod{p}$ and that $p$ is not a prime. The case $p=1$ is trivial. Since $p$ is composite, it has a divisor $k$ such that $1, and we have $(p-1)!\equiv-1\pmod{k}$. However, since $k\leqslant p-1$, it divides $(p-1)!$ and thus $(p-1)!\equiv 0\pmod{k},$ a contradiction.

Title proof of Wilson’s theorem ProofOfWilsonsTheorem 2013-03-22 12:09:09 2013-03-22 12:09:09 CWoo (3771) CWoo (3771) 9 CWoo (3771) Proof msc 11-00