The Schwartz-Zippel Lemma and its application to Zero Knowledge Proofs
Nearly all ZK-Proof algorithms rely on the Schwartz-Zippel Lemma to achieve succintness.
The Schwartz-Zippel Lemma states that if we are given two polynomials and with degrees and respectively, and if , then the number of points where and intersect is less than or equal to .
Let’s consider a few examples.
Example polynomials and the Schwartz-Zippel Lemma
A straight line crossing a parabola
Consider the polynomial and . They intersect at and .

They intersect at two points, which is the maximum degree between the polynomials and .
A degree three polynomial and a degree one polynomial
Consider the polynomials and . The polynomials intersect at , , and and nowhere else. The number of intersections is bounded by the maximum degree of the polynomials, which in this case is 3.

Polynomials in finite fields and the Schwartz-Zippel Lemma
The Schwartz-Zippel Lemma holds for polynomials in finite fields (i.e., all computations are done modulo a prime ).
Polynomial equality testing
We can test that two polynomials are equal by checking if all their coefficients are equal, but this takes time, where is the degree of the polynomial.
If instead we can evaluate the polynomials at a random point and compare the evaluations in time.
That is, in a finite field , we pick a random value from . Then we evaluate and . If , then one of two things must be true:
- and we picked one of the points where they intersect where
If , then situation 2 is unlikely to the point of being negligible.
For example, if the field has (a little smaller than a uint256), and if the polynomials are not more than one million degree large, then the probability of picking a point where they intersect is
To put a sense of scale on that, the number of atoms in the universe is about to , so it is extremely unlikely that we will pick a point where the polynomials intersect, if the polynomials are not equal.
Using the Schwartz-Zippel Lemma to test if two vectors are equal
We can combine Lagrange interpolation with the Schwartz-Zippel Lemma to test if two vectors are equal.
Normally, we would test vector equality by comparing if each of the components of the vectors are equal.
Instead, if we use a common set of values (say ) to interpolate the vectors:
- We can interpolate a polynomial for each vector and
- Pick a random point
- Evaluate the polynomials at
- Check if
Although computing the polynomials is more work, the final check is much cheaper.
Here is an example of carrying out this computation in Python:
import galois
import numpy as np
p = 103
GF = galois.GF(p)
xs = GF(np.array([1,2,3]))
# arbitrary vectors
v1 = GF(np.array([4,8,19]))
v2 = GF(np.array([4,8,19]))
def L(v):
return galois.lagrange_poly(xs, v)
p1 = L(v1)
p2 = L(v2)
import random
u = random.randint(0, p)
lhs = p1(u)
rhs = p2(u)
# only one check required
assert lhs == rhs
Using the Schwartz-Zippel Lemma in ZK Proofs
Our end goal is for the prover to send a small string of data to the verifier that the verifier can quickly check.
Most of the time, a ZK proof is essentially a polynomial evaluated at a random point.
The difficulty we have to solve is that we don’t know if the polynomial is evaluated honestly – somehow we have to trust the prover isn’t lying when they evaluate .
But before we get to that, we need to learn how to represent an entire arithmetic circuit as a small set of polynomials evaluated at a random point, which is the motivation for Quadratic Arithmetic Programs.
Ready to Get Started?
Join Thousands of Users Today
Start your free trial now and experience the difference. No credit card required.