Lagrange theorem for polynomial congruences says that a nonzero polynomial of degree over a field has at most distinct roots of a polynomial. It follows by repeatedly factoring out at a root. Over the finite field , the only solutions of are and : these are distinct because is odd, and the root bound excludes any others.
Every nonzero element has a unique multiplicative inverse. Pair each element of with its inverse. All pairs of distinct elements contribute to the product; the only unpaired elements are and . Thus Wilson theorem follows:
If Lagrange's theorem is formulated for finite groups, it states that the order of a subgroup divides the order of the group; in particular every element of has order dividing . The inverse-pairing proof above establishes the required congruence directly.
Lagrange theorem for polynomial congruences says that a nonzero polynomial of degree over the finite field has at most roots. To prove it, use mathematical induction on . A constant nonzero polynomial has no roots. If , polynomial division in the field gives with . Every root other than is a root of , so the induction hypothesis gives at most roots.
Every nonzero residue class modulo has a unique multiplicative inverse. In the product , pair each class with its inverse. The unpaired classes satisfy , hence . By the theorem these are exactly and , and therefore
This is Wilson theorem.
Now write . By Fermat's little theorem, every nonzero class is a root of
The second factor has degree and hence at most roots. Since their union contains all nonzero classes, has at least roots; Lagrange's theorem gives at most . Thus has exactly solutions.
The Lagrange theorem for polynomial congruences says that if is prime and has degree with at least one coefficient not divisible by , then
has at most incongruent solutions modulo .
The Chinese remainder theorem states that for pairwise coprime , every system
has exactly one solution modulo . For two moduli, choose with by Bezout identity. Then
is congruent to modulo and to modulo . If are two solutions, both and divide ; coprimality makes divide . This proves existence and uniqueness for two factors, and induction proves the general statement.
Now
and , so is a solution. For , one has , so no such positive integer can satisfy the congruence. Hence the smallest is
Modulo , the roots are respectively
Each list has three elements, and the Chinese remainder theorem combines the choices independently. Therefore the number of solutions with is