Let f(x) and g(x) be polynomials, and let
where it is not necessarily assumed that an ≠ 0 and bn ≠ 0. If f(x) = g(x) for all values of x, then an = bn, an−1 = bn−1,…, a1 = b1, a0 = b0.
The above is true by definition of the equality of polynomials. Note that, for a prime p, the polynomials xp and x take the same values for all x mod p (as a consequence of Fermat’s Little Theorem). However xp and x are distinct polynomials, having different coefficients.