In number theory, Lagrange's theorem is a statement named after Joseph-Louis Lagrange about how frequently a polynomial over the integers may evaluate to a multiple of a fixed prime p. More precisely, it states that for all integer polynomials , either:
where deg f is the degree of f.
This can be stated with congruence classes as follows: for all polynomials with p prime, either:
If p is not prime, then there can potentially be more than deg f(x) solutions. Consider for example p=8 and the polynomial f(x)=x2-1, where 1, 3, 5, 7 are all solutions.