posted 18 Jan 2024

Schwartz-Zippel Lemma


In one of the motivating problems for this course, we discussed utilizing a nondeterministic algorithm to check whether two polynomials are identical.

Schwartz-Zippel Lemma

Suppose PP is a degree dd polynomial in x1,x2,,xn.x_1, x_2, \dots, x_n.

Let r1,r2,,rnr_1, r_2, \dots, r_n be randomly drawn from {1,2,,q}.\{1, 2, \dots, q\}.

Then,

Pr[P(r1,r2,,rn)=0]dq. \Pr\left[P(r_1, r_2, \dots, r_n) = 0\right] \leq \frac{d}{q}.

(sketch)

We prove the lemma via induction.

Let n=1n=1 be the base case, a degree dd polynomial has at most dd real roots, so the probability that r1r_1 hits a root is at most d/q.d/q.

Otherwise, write

P(x1,x2,,xn)=i=0dx1iFi(x2,,xn).P(x_1, x_2, \dots, x_n) = \sum_{i=0}^{d} x_1^i \cdot F_i(x_2, \dots, x_n).

Since the above is nonzero, there exists a nonzero Fi()F_i(\cdot) with degree di.d-i. Take the largest i.i.

By induction,

Pr[Fi(r2,,rn)=0]diq.\Pr\left[F_i(r_2, \dots, r_n) = 0\right] \leq \frac{d-i}{q}.

Then, P(x1,r2,,rn)P(x_1, r_2, \dots, r_n) is a polynomial with degree ii, we have that

Pr[P(x1,x2,,xn)=0]iq.\Pr[P(x_1, x_2, \dots, x_n) = 0] \leq \frac{i}{q}.

Through union bound, we have that

Pr[P(r1,r2,,rn)=0]dq.\Pr\left[P(r_1, r_2, \dots, r_n) = 0\right] \leq \frac{d}{q}.