# Proof of Wilson's theorem using polynomials

I came across a proof of Wilson's theorem as shown below.

I understand why the degree of $$f(X)$$ has to be strictly less than $$p - 1$$, and why there are $$p - 1$$ solutions to $$f(a) \equiv 0$$ (mod $$p)$$ in {$$1,2,...p-1$$}. However, it is not clear to me why, from these two statements, it can be concluded that all coefficients of $$f(X)$$ are divisible from $$p$$ [the highlighted statement]. I feel like it has something to do with the fact that $$f(X)$$ has (at most) $$p-2$$ terms i.e. there are $$p - 2$$ coefficients, and that reducing the coefficients mod $$p$$ will result in at least two coefficients being equal to each other. From there, it is clear to me how to conclude that $$f(0) \equiv 0$$ (mod $$p$$), and how this can be used to prove Wilson's theorem.

## 1 Answer

If $$f$$ is not the zero polynomial when reduced modulo $$p$$, then its reduction to $$\mathbf{F}_p[X]$$ must have strictly less than $$p-1$$ roots in $$\mathbf{F}_p$$ (this is because its degree is already strictly less than $$p-1$$; any nonzero polynomial of degree $$d$$ over a field $$F$$ has at most $$d$$ roots in $$F$$). This contradicts the fact that $$1, \ldots, p-1$$ are all roots of the reduction of $$f$$ to $$\mathbf{F}_p[X]$$. As a result, $$f$$ must be identically zero when reduced modulo $$p$$, i.e. all of its coefficients are divisible by $$p$$.

• Is reducing to $F_p [X]$ just taking the coefficients and reducing them mod $p$? Jun 12, 2019 at 6:54
• @1123581321 That is right! The "projection" $\mathbf{Z}[X] \to \mathbf{F}_p[X]$ is just given by reducing all the coefficients mod $p$. Jun 12, 2019 at 23:10