# Proof of Wilson's theorem using Fermat's little theorem and Vieta's formulas

An exercise in a book I'm working through asks to prove Wilson's theorem (for any prime $$p$$, $$(p−1)!\equiv−1\pmod p$$ ) using Fermat's little theorem and one of Vieta's formulas ($$c_1c_2\cdots c_n=(-1)^n\frac{a_0}{a_n}$$, where $$c_i$$ are the roots of the polynomial, and $$a_0$$ and $$a_n$$ its constant and leading coefficient, respectively). My idea was to do the following: consider the polynomial $$(x-1)(x-2)\cdots (x-(p-1))$$. If we were to expand it, it would look something like $$x^{p-1}-\frac{p(p-1)}{2}x^{p-2}+\cdots +(p-1)!$$ and if we were to consider it reduced $$\pmod p$$, it would hopefully become $$x^{p-1}+(p-1)!$$, because all of the other coefficients would ve congruent to $$0$$, all hopefully being multiples of $$p$$. Then by Fermat's little theorem, $$x^{p-1}+(p-1)!\equiv 1+(p-1)!$$ and if this last expression were congruent to $$0$$, i.e. $$1+(p-1)!\equiv 0$$, then $$(p-1)!\equiv -1$$ and we have our proof.

My question is, how do I fill in the gaps in this, i.e. that all the other coefficients are multiples of $$p$$ and that the final expression is congruent to $$0$$?

• It does seem to be true in small cases, and it also does fail if $p$ is not a prime. Interesting. – Arnaud Mortier Dec 2 '19 at 15:44
• It is claimed here in the introduction but apparently without a proof – Arnaud Mortier Dec 2 '19 at 15:48

## 1 Answer

This is a standard approach. You can find details in Landau's book Number Theory (Part I, Chapter V, Theorem 77, p. 52) or perhaps other standard references.

Proof. Let $$f(X) = \prod_{i=1}^{p-1} (X-i)-X^{p-1}+1$$ over the field $$\mathbb Z/p$$. It is a polynomial of degree $$p-2$$, and it has $$p-1$$ roots, namely $$1,\ldots,p-1$$, so it is identically zero.