Docsity

Pseudorandomness Randomized Algorithms and Complexity Classes, Lecture Notes - Computer Science, Study notes of Number Theory

Toggle sidebar
bg1
CS225: Pseudorandomness Prof. Salil Vadhan
Lecture 2: Randomized Algorithms and Complexity Classes
February 3, 2007
Based on scribe notes by Grant Schoenebeck.
1 Polynomial Identity Testing
Before we study the derandomization of randomized algorithms, we will need some algorithms to
derandomize. This section introduces one such algorithm.
The problem is Identity Testing: given two multivariate polynomials, p(x1,...,xn) and q(x1,...,xn),
decide whether p≡q(that is, pis “equivalent” to q).
This definition requires some clarification. Specifically, we need to say what we mean by:
•“polynomials”: A (multivariate) polynomial is an finite sum of the form p(x1,...,xn) =
Pi1,...,inci1,...,inxi1
1xi2
2···xin
n. We need to specify what space the coefficients of the polynomials
will come from; they could be the integers, reals, rationals, etc. In general, we will assume
that the coefficients are chosen from a field (a set with addition and multiplication, where
every nonzero element has a multiplicative inverse) or more generally an (integral) domain
(where the product of two nonzero elements is always nonzero). Examples of fields include Q
(the rationals), R(the reals), Zp(integers modulo p) where pis prime. An integral domain
that is not a field is Z(the integers); every integral domain is contained in its field of fractions,
which is Qin the case of Z.Znfor composite nis not even an integral domain. We remark
that there does exist a finite field Fqof size q=pkfor every prime pand positive integer k,
and in fact this field is unique (up to isomorphism); but Fqis only equal to Zqin case qis
prime (i.e. k= 1).
For a polynomial p(x1,...,xn) = Pi1,...,inci1,...,inxi1
1xi2
2···xin
n, we define its degree to be the
maximum of the sum of the exponents i1+···+inover its monomials with nonzero coefficients
ci1,...,in. Its degree in xjis the maximum of ijover its monomials with nonzero coefficients.
•“p≡q”: What could it mean for two polynomials to be equivalent? There are two natural
choices: the polynomials are the same as functions (they have the same output for every
point in the domain), or the polynomials are the same as formal polynomials (the coefficients
for each monomial are the same).
Notice that although these two definitions coincide when the polynomials have integral coef-
ficients (or more generally over infinite domains), they do not over finite fields. For example,
consider
p(x) = Y
α∈F
(x−α) = x|F|−x
It is easy to see that p(α)6= 0 for all α∈F, but p6≡ 0 as a formal polynomial.
For us, equivalence refers to equivalence as formal polynomials.
1
pf3
pf4
pf5
pf8

Partial preview of the text

Download Pseudorandomness Randomized Algorithms and Complexity Classes, Lecture Notes - Computer Science and more Study notes Number Theory in PDF only on Docsity!

CS225: Pseudorandomness Prof. Salil Vadhan

Lecture 2: Randomized Algorithms and Complexity Classes

February 3, 2007

Based on scribe notes by Grant Schoenebeck.

1 Polynomial Identity Testing

Before we study the derandomization of randomized algorithms, we will need some algorithms to derandomize. This section introduces one such algorithm.

The problem is Identity Testing: given two multivariate polynomials, p(x 1 ,... , xn) and q(x 1 ,... , xn), decide whether p ≡ q (that is, p is “equivalent” to q).

This definition requires some clarification. Specifically, we need to say what we mean by:

  • “polynomials”:∑ A (multivariate) polynomial is an finite sum of the form p(x 1 ,... , xn) = i 1 ,...,in ci 1 ,...,in x

i 1 1 x

i 2 2 · · ·^ x in n. We need to specify what space the coefficients of the polynomials will come from; they could be the integers, reals, rationals, etc. In general, we will assume that the coefficients are chosen from a field (a set with addition and multiplication, where every nonzero element has a multiplicative inverse) or more generally an (integral) domain (where the product of two nonzero elements is always nonzero). Examples of fields include Q (the rationals), R (the reals), Zp (integers modulo p) where p is prime. An integral domain that is not a field is Z (the integers); every integral domain is contained in its field of fractions, which is Q in the case of Z. Zn for composite n is not even an integral domain. We remark that there does exist a finite field Fq of size q = pk^ for every prime p and positive integer k, and in fact this field is unique (up to isomorphism); but Fq is only equal to Zq in case q is prime (i.e. k = 1). For a polynomial p(x 1 ,... , xn) =

i 1 ,...,in ci^1 ,...,in^ x

i 1 1 x

i 2 2 · · ·^ x

in n , we define its^ degree^ to be the maximum of the sum of the exponents i 1 +· · ·+in over its monomials with nonzero coefficients ci 1 ,...,in. Its degree in xj is the maximum of ij over its monomials with nonzero coefficients.

  • “p ≡ q”: What could it mean for two polynomials to be equivalent? There are two natural choices: the polynomials are the same as functions (they have the same output for every point in the domain), or the polynomials are the same as formal polynomials (the coefficients for each monomial are the same). Notice that although these two definitions coincide when the polynomials have integral coef- ficients (or more generally over infinite domains), they do not over finite fields. For example, consider p(x) =

α∈F

(x − α) = x|F|^ − x

It is easy to see that p(α) 6 = 0 for all α ∈ F, but p 6 ≡ 0 as a formal polynomial. For us, equivalence refers to equivalence as formal polynomials.

  • “given”: What does it mean to be given two polynomials? There are several possibilities here: 1. Lists of coefficients: this trivializes the problem. 2. As “oracles”: black boxes that, given any point in the domain, gives the value of the polynomial. 3. As an arithmetic formula: a sequence of symbols like (x 1 + x 2 )(x 3 + x 7 + 6x 5 )x 3 (x 5 − x 6 ) + x 2 x 4 (2x 3 + 3x 5 ) that describes the polynomial. Why can’t we solve the problem by just expanding the polynomials? More general than formulas are circuits. An arithmetic circuit consists of a directed acyclic graph, where internal nodes are labelled by operations (+ or ×) specifying how to compute a value given the values at its children. Thus we can specify a computation from the input variables (as well as constants in the field) to a special output node; every such circuit defines a polynomial in its input variables x 1 ,... , xn.

The randomized algorithm that we will use will actually solve a different but equivalent problem.

Identity Testing (reformulation): Given a polynomial p(x 1 ,... , xn), is p ≡ 0?

Algorithm for Identity Testing: Given p(x 1 ,... , xn) over field F of degree at most d,

  1. Let S ⊆ F be any set of size 2d.
  2. Choose α 1 ,... , αn ←R S.
  3. Evaluate p(α 1 ,... , αn). If the result is 0, accept. Otherwise, reject.

It is clear that if p ≡ 0, the algorithm will always accept. The correctness in case p 6 ≡ 0 is based on the following simple but very useful lemma.

Lemma 1 (Schwartz-Zippel) If p is a nonzero polynomial of degree d over a a field (or integral domain) F and S ⊆ F, then

Pr α 1 ,...,αn ←RS

[p(α 1 ,... , αn) = 0] ≤

d |S|

In the univariate case (n = 1), this reduces to the familiar fact that a polynomial with coefficients in a field and degree d has at most d roots. The proof for multivariate polynomials proceeds by induction on n, and we omit it. (It is a good exercise, and you can also find it in Sudan’s algebra notes referenced on the syllabus.)

By the Schwartz-Zippel lemma, the algorithm will err with probability at most 1/2 when p 6 ≡ 0. This error probability can be reduced by repeating the algorithm many times (or by increasing |S|). Note that the error probability is only over the coin tosses of the algorithm, not over the input polynomial p. This is what we mean when we say randomized algorithm; it should work on a worst-case input with high probability over the coin tosses of the algorithm. Algorithms whose

bounded by n, and given values αi,j for the xi,j ’s we can evaluate det(A(α)) efficiently in parallel (in polylogarithmic time using a polynomial number of processors) using an efficient parallel algorithm for determinant.

So to test for a perfect matching efficiently in parallel, just run the Identity Testing algorithm with, say, S = { 1 ,... , 2 n} ⊂ Z, to test whether det(A(x)) ≡ 0.

Some remarks:

  • A more sophisticated version of this algorithm (choosing the αi,j ’s from a carefully chosen set S) actually enables finding a perfect matching efficiently in parallel.
  • Identity Testing has been also used to obtain a randomized algorithm for Primality, which was later derandomized to obtain the celebrated deterministic polynomial-time algo- rithm for Primality. You may see this on PS2.

2 Model of Randomized Computation

To develop a rigorous theory of randomized algorithms, we need to use a precise model of com- putation. There are several possible ways to augmenting a standard deterministic computational model (e.g. Turing machine or RAM model), such as:

  1. The algorithm has access to a “black box” that provides it with (unbiased and independent) random bits on request, with each request taking one time step. This is the model we will use.
  2. The algorithm has access to a black box that, given a number n in binary, returns a num- ber chosen uniformly at random from { 1 ,... , n}. This model is often more convenient for describing algorithms. On Problem set 1, you will show that it is equivalent to the Model 1, in the sense that any problem that can be solved in polynomial time on one model can also be solved in polynomial time on the other.
  3. The algorithm is provided with an infinite tape (i.e. sequence of memory locations) that is that is initially filled with random bits. For polynomial-time algorithms, this is equivalent to the Model 1. (Why?) However, for space-bounded algorithms, this model seems stronger, as it provides the algorithm with free storage of its random bits (i.e. not counted towards its working memory). Model 1 is considered to be the “right” model for space-bounded algorithms.

3 Complexity Classes

We will now define complexity classes that capture the power of efficient randomized algorithms. As is common in complexity theory, these classes are defined in terms of decision problems, where the set of inputs where the answer should be ‘yes’ is specified by a language L ⊆ { 0 , 1 }∗.

Recall that we say an algorithm A runs in time t : N → N if A takes at most t(|x|) steps on every input x, and it runs in polynomial time if it runs time t(n) = O(nc) for some constant c. Polynomial

time is a theoretical approximation to feasible computation, with the advantage that it is robust to reasonable changes in the model of computation and representation of the inputs.

Definition 4 P is the class of languages L for which there exists a polynomial-time algorithm A such that

  • x ∈ L ⇒ A(x) accepts.
  • x /∈ L ⇒ A(x) rejects.

For a randomized algorithm A, we say that A runs in time t : N → N if A takes at most t(|x|) steps on every input x and every sequence of random coin tosses.

Definition 5 RP is the class of languages L for which there exists a probabilistic polynomial-time algorithm A such that

  • x ∈ L ⇒ Pr[A(x) accepts] ≥ (^12)
  • x 6 ∈ L ⇒ Pr[A(x) accepts] = 0

Thus RP captures efficient randomized computation with one-sided error. RP stands for “random polynomial time”. Note that the error probability of an RP algorithm can be reduced to 2−p(n) for any polynomial p by running the algorithm p(n) times independently and accepting the input iff at least one of the trials accepts. By the same reasoning, the 12 in the definition is arbitrary, and any constant α ∈ (0, 1) of every α = 1/poly(n) would yield the same class of languages.

A central question in this course is whether randomization enables us to solve more problems in polynomial time (e.g. decide more languages):

Open Problem 6 Does P = RP?

Definition 7 co-RP is the class of languages L whose complement L¯ is in RP. Equivalently, L ∈ co-RP if there exists a probabilistic polynomial-time algorithm A such that

  • x ∈ L ⇒ Pr[A(x) accepts] = 1
  • x 6 ∈ L ⇒ Pr[A(x) accepts] ≤ (^12)

That is, in co-RP we may err on no instances, whereas in RP we may err on yes instances.

Using the Identity Testing algorithm we saw earlier, we have:

Theorem 8 The language

ACITZ = {C : C(x 1 ,... , xn) an arithmetic circuit over Z s.t. C ≡ 0 }

is in co-RP.

One can similarly define randomized complexity classes associated with other complexity measures, not just time, such as space or parallel computation. For example:

Definition 14 RNC is the class of languages L such that exists a probabilistic parallel algorithm A that runs in polylogarithmic time on polynomially many processors, such that

  • x ∈ L ⇒ Pr[A(x) accepts] ≥ (^12)
  • x 6 ∈ L ⇒ Pr[A(x) accepts] = 0

A formal model of a parallel algorithm is beyond the scope of this course, but can be found in standard texts on algorithms or parallel computation. We have seen:

Theorem 15 Perfect Matching, i.e. the language PM = {G : G a bipartite graph with a perfect matching} is in RNC.

4 Tail Inequalities

In the previous section, we claimed that we can reduce the error of a BPP algorithm by taking independent repetitions and ruling by majority vote. The intuition that this should work is based on the Law of Large Numbers: if we repeat the algorithm many times, the fraction of correct answers should approach its expectation, which is greater than 1/2 (and thus majority rule will be correct). For complexity purposes, we need quantitative forms of this fact, which bound how many repetitions are needed to achieve a desired probability of correctness.

First, we recall a basic inequality which says that it is unlikely for (a single instantiation of) a random variable to exceed its expectation by a large factor.

Lemma 16 (Markov’s Inequality) If X is a nonnegative random variable, then for any t > 0 ,

Pr[X ≥ t] ≤

E[X]

t

Markov’s Inequality alone does not give very tight concentration around the expectation; to get even a 50% probability, we need to look at deviations by a factor of 2. To get tight concentration, we need to take independent copies of a random variable. There are a variety of different tail inequalities that apply for this setting; they are collectively referred to as Chernoff Bounds.

Theorem 17 (A Chernoff Bound) Let X 1 ,... , Xt be independent random variables taking val- ues in the interval [0, 1], let X = (

i Xi)/t, and^ μ^ = E[X]. Then Pr[|X − μ| ≥ ε] ≤ 2 exp(−tε^2 /2).

Thus, the probability of the average deviating from the expectation vanishes exponentially with the number of repetitions t. You will prove this Chernoff Bound on Problem Set 1.

Now let’s apply the Chernoff Bound to analyze error-reduction for BPP algorithms.

Proposition 18 The following are equivalent:

  1. L ∈ BPP.
  2. For every polynomial p, L has a probabilistic polynomial-time algorithm with two-sided error at most 2 −p(n).
  3. There exists a polynomial q such that L has a probabilistic polynomial-time algorithm with two-sided error at most 1 / 2 − 1 /q(n).

Proof: Clearly, (2)⇒ (1) ⇒ (3). Thus, we prove (3) ⇒ (2).

Given an algorithm A with error probability at most 1/ 2 − 1 /q(n), consider an algorithm A′, which on an input x of length n, runs A for t(n) independent repetitions and rules according to the majority, where t(n) is a polynomial to be determined later.

We now compute the error probability of A′^ on an input x of length n. Let Xi be an indicator random variable that is 1 iff the i’th execution of A(x) outputs the correct answer, and let X = (

i Xi)/t^ be the average of these indicators, where^ t^ =^ t(n).^ Note that^ A

′(x) is correct when

X > 1 /2. By the error probability of A and linearity of expectations, we have E[X] ≥ 1 /2 + 1/q, where q = q(n). Thus, applying the Chernoff Bound with ε = 1/q, we have:

Pr[X ≤ 1 /2] ≤ 2 · e−t/^2 q 2 < 2 −p(n),

for t(n) = 2p(n)q(n)^2 and sufficiently large n.