Schwartz-Zippel Lemma

A little mathematical theorem that allows us to assert with high probability whether two polynomials are identical by evaluating both at the same randomly chosen input; this is very efficient!


⚠️ Math: polynomials, probabilities. In the spirit of this “jargon decoder”, we do not look at the lemma directly but instead give informal intuition for why it is useful in ZK arguments

The Schwartz-Zippel lemma is a central component to many arguments of knowledge because it allows us to efficiently check whether two polynomials are identical.

Consider two straight lines (degree 1 polynomials, ): these are either identical or intersect at most once. Similarly, two parabolas (degree 2 polynomials, ) are either identical or will intersect at most twice. Degree 3 polynomials will have at most 3 intersections, etc… The Schwartz-Zippel lemma can be used to show that this pattern is true for polynomials of any degree : their evaluations will only be equal to each other for at most inputs.

With that in mind, imagine that we evaluate two polynomials of degree at most at a single point in some evaluation domain and find that they agree. We know that we are in one of two cases:

  • case 1: our polynomials are identical, all their coefficients are the same.
  • case 2: our polynomials are different and we are at one of the points where they agree. If our evaluation point was chosen at random in , the probability of finding ourselves in this case is (notation: denotes the order of , i.e. the number of values in the set ). For a sufficiently large compared to , this probability will approach 0.

since case 2 is extremely unlikely we can assert with high probability that the two polynomials were identical.

Formalities - only for those who want them: the lemma itself does not compare polynomials but instead is interested in the probability that a polynomial evaluates to 0. Notice that a non-zero polynomial of degree has at most roots (if it had more roots, it would be of higher degree!). Therefore let be a non-zero polynomial of degree , be the evaluation domain of , and an element of chosen uniformly at random, we can write:

When , this probability is negligible. Therefore if for a value uniformly chosen at random we find that , it is overwhelmingly likely that is the zero polynomial. To check whether two polynomials and are identical, we can check whether the polynomial is the zero polynomial.