The Schwartz-Zippel Lemma
We will now look at a generalization of the above technique. The key idea is that the equation (as considered in the previous section) is a polynomial of degree one, and the problem we are solving is to check whether this polynomial is the zero polynomial or not.
In this section, we look at a generalization of this problem. Let us consider a polynomial of any degree , e.g.,
Each term of the sum is called a monomial. The degree of a monomial is the sum of all the exponents in that monomial, and the degree of a polynomial is the maximum over all the monomial's degrees. For instance, the above polynomial is of degree (from the monomial ). The following theorem is known as the Schwartz-Zippel Lemma.
Let be a non-zero polynomial of degree . Let be a set of numbers. If we pick at random, uniformly and independently, then we have that
We will prove this theorem later. Now let us see some applications. A direct application of this theorem is to solve the Polynomial Identity Testing (PIT) problem: Given a polynomial , our task is to decide whether is the zero polynomial (i.e. all coefficients are zero). This might sound like an easy problem since we can just look at the coefficients and check them one by one, but we are not always given the polynomial's coefficients explicitly. For instance, if an input polynomial is , expanding all monomials might be computationally too expensive.
With the Schwartz-Zippel lemma, we can solve PIT by a simple randomized algorithm: Given a polynomial of degree , pick and check whether .
- If is a zero polynomial, the algorithm will always answer correctly.
- Otherwise, if is non-zero, using the Schwartz-Zippel lemma, the probability that (algorithm fails) is at most .
PIT is one of the most well-studied problems in the area of computational complexity, where we know an efficient randomized algorithm but not an efficient deterministic algorithm. If we know the input is a univariate polynomial, PIT is in fact easy (i.e., we can reconstruct the polynomial of degree by evaluating it at points).