CHAPTER 6 Polyomial idetity testig ad global miimum cut I this lecture we will cosider two further problems that ca be solved usig probabilistic algorithms. I the first half, we will cosider the problem Polyomial Idetity Testig (PIT), ad i the secod half we will cosider the problem of fidig a global miimum cut i a graph. 1. Polyomial idetity testig 1.1. Polyomials ad polyomial idetity testig. You will all kow what a polyomial of a sigle variable, X say, is: it is simply a expressio of the form p(x) = c 0 + c 1 X + c 2 X 2 +... + c d X d, (6.1) where the coefficiets are take from some field F. If c d 0, the d is called the degree of the polyomial. A polyomial of more tha oe variable is defied similarly: a moomial i the variables X 1, X 2,..., X is defied as X α 1 1 Xα 2 2... X α, (6. where the α i are oegative itegers. A polyomial (over F) is simply a fiite F-liear combiatio of moomials. There is a obvious way of defiig additio ad multiplicatio of polyomials, ad it ca be show that polyomials i the variables X 1, X 2,..., X over F form a rig uder this multiplicatio ad additio, that is ofte writte F[X 1, X 2,..., X ]. The degree of a moomial X α 1 1 Xα 2 2... X α is just the sum of the expoets, i.e. deg(x α 1 1 Xα 2 2... X α ) = α 1 + α 2 +... + α. (6.3) The degree of a polyomial p(x 1, X 2,..., X ) is simply the maximum degree over its costituet moomials. If p(x 1, X 2,..., X ) is a polyomial i which all coefficiets are equal to 0, the it is called the zero-polyomial. Every polyomial p(x 1, X 2,..., X ) gives rise to a polyomial fuctio p : F F i a obvious way. Remark. Note that the polyomial fuctio p may be the zero-fuctio, eve though the polyomial p(x 1, X 2,..., X ) is ot the zero-polyomial. For example, over the biary field F = GF(, the polyomial p(x) = X 2 + X evaluates to zero for all values of X, but it is ot the zero-polyomial. It ca be show that if the size of the field is larger tha the degree of p, beig the zero-fuctio ad beig the zero-polyomial is actually equivalet. Polyomials are ot always give as a sum of fiitely may moomials. For example, the polyomial p(x 1, X 2 ) = (X 1 +X 2 )(X 1 X 2 ) is equal to the polyomial q(x 1, X 2 ) = X 2 1 X2 2. I geeral, two polyomials p(x 1, X 2,..., X ) ad q(x 1, X 2,..., X ) are said to be equal if their differece is equal to the zero-polyomial (or equivaletly, if the coefficiets after expadig match). Hece, we are iterested i decidig whether a give polyomial is the zero-polyomial or ot. This is the problem Polyomial Idetity Testig (PIT). Problem: Polyomial Idetity Testig (PIT) Iput: Polyomial p(x 1, X 2,..., X ) Output: YES, if p 0; NO otherwise. 33
The problem PIT is ot as trivial as it may appear at first sight. Oe might be tempted to take the polyomial p, expad it, ad the check if all of the coefficiets are equal to 0. However, expadig the polyomial may take expoetial time, as illustrated by the followig example. Example. If A is a -matrix, the its determiat is defied as the polyomial det(a) = σ S sg(σ) A i,σ(i), (6.4) where the sum is over the permutatios of []. The -Vadermode matrix is the matrix 1 X 1 X1 2... X 1 1 V () 1 X 2 X2 2... X 1 2 =..... (6.5) 1 X X 2... X 1 It is kow that the determiat of the Vadermode matrix is give by 1 i<j (X j X i ). Therefore, the polyomial σ S sg(σ) X σ(i) 1 i 1 i<j (X j X i ) (6.6) is the zero-polyomial. Expadig the double product requires a expoetial umber of computatios. No polyomial time algorithm for solvig PIT is kow (ad fidig such a algorithm will have importat cosequeces i complexity theory, see [KI03]). 1.2. Schwartz-Zippel lemma. The followig result, due to Schwartz [Sch80] ad Zippel [Zip79], forms the core of the probabilistic algorithm for solvig PIT. Theorem 6.1 (Schwartz-Zippel lemma). Let p(x 1, X 2,..., X ) be a polyomial over a field F that is ot the zero-polyomial, ad let S F be a fiite set of field elemets. Let R 1, R 2,..., R be chose uiformly ad idepedetly at radom from the elemets i S, the P (p(r 1, R 2,..., R ) = 0) deg(p). (6.7) Proof. We will prove this theorem by iductio o the umber of variables. For the base case, = 1, it is well-kow that a polyomial of degree d has at most d roots, ad the claim follows. Now suppose that the theorem holds for polyomials o at most variables. We will show that it holds for polyomials o + 1 variables as well. So let p be a polyomial o + 1 variables, ad let K be the largest power of X +1 i p. This allows us to write p(x 1, X 2,..., X +1 ) = X K +1 ˆp(X 1, X 2,..., X ) +ˆp(X 1, X 2,..., X +1 ), (6.8) where ˆp is a polyomial of degree at most deg(p) K that does ot deped o X +1, ad is ot the zero-polyomial. Let A be the evet that ˆp(X 1, X 2,..., X ) = 0. The, by the iductio hypothesis, P (A) deg(p) K. (6.9) 34
Coditioig o A, we fid that P (p(r 1, R 2,..., R +1 ) = 0) = P (p(r 1, R 2,..., R +1 ) = 0 A) P (A) + P ( p(r 1, R 2,..., R +1 ) = 0 Ā) P ( Ā ) P (A) + P ( p(r 1, R 2,..., R +1 ) = 0 Ā) deg(p) K + K = deg(p), (6.10) where we use (6.9) to boud P (A), while the secod term ca be bouded by coditioig o R 1, R 2, R as well as Ā, otig that after this coditioig p is a polyomial of degree K i the variable X +1 oly, so that we ca apply the = 1-case. The Schwartz-Zippel lemma immediately gives a probabilistic algorithm for PIT: draw radom elemets R 1, R 2,..., R uiformly at radom from a large set ad compute p(r 1, R 2,..., R ). If the polyomial evaluates to 0, retur YES; otherwise retur NO. Note that the algorithm always returs YES if the polyomial p is the zero-polyomial. If p is ot the zero-polyomial, the the probability that the algorithm mistakely returs YES is at most d. There are two ways of makig the error probability smaller: makig S larger, or repeatig the algorithm a umber of times. 1.3. Two further complexity classes. I this sectio, we itroduce three ew complexity classes: RP (for radomised polyomial time), co-rp, ad ZPP (zero-error probabilistic polyomial time). Defiitio 6.2. A decisio problem is said to be i RP if there exists a polyomial time algorithm such that if the correct aswer is NO, it always returs NO; if the correct aswer is YES, it returs YES with probability at least 1/2. This meas that if the algorithm returs YES, we are sure that this is the right aswer. O the other had, if the algorithm returs NO, it may be the case that the aswer actually should be YES. The class co-rp is similar to RP, but with the roles of YES ad NO reversed. Defiitio 6.3. A decisio problem is said to be i RP if there exists a polyomial time algorithm such that if the correct aswer is YES, it always returs YES; if the correct aswer is NO, it returs NO with probability at least 1/2. Usig the Schwarz-Zippel lemma, it is easy to show that PIT is i co-rp, provided that the uderlyig field is large eough. Defiitio 6.4. A decisio problem is said to be i ZPP if there exists a polyomial time algorithm that returs either YES, NO, or DO NOT KNOW, such that it outputs DO NOT KNOW or the correct aswer; it outputs DO NOT KNOW with probability at most 1/2. It is ot hard to show that ZPP = RP co-rp. 1.4. Applicatio: Perfect matchigs i bipartite graphs. A matchig i a graph G is a subset of the edges, such that o two edges share a ed poit. A matchig is called a perfect matchig or 1-factor if it does ot leave ay vertex umatched, i.e. every vertex is icidet to exactly oe edge i the matchig. I this sectio, we will look at perfect matchigs i bipartite graphs. If G is a bipartite graph with bipartitio classes A ad B, the a ecessary coditio for the existece of a perfect matchig is that A ad B cotai the same umber of elemets (i which case the graph is called equibipartite). Ideed, a perfect matchig ca be see as a bijectio φ : A B, such 35
that each {a, φ(a)}, a A is a edge. The decisio versio of bipartite perfect matchig is the followig. Problem: Iput: Output: Bipartite Perfect Matchig (Decisio) A equibipartite graph G YES, if G cotais a perfect matchig; NO otherwise We will relate the decisio versio of Bipartite Perfect Matchig to Polyomial Idetity Testig. Give a equibipartite graph G with bipartitio classes A ad B, costruct the (square) matrix M i which the rows are idexed by A ad the colums are idexed by B, ad { x i,j if {i, j} E M i,j = (6.11) 0 otherwise The relatioship of bipartite perfect matchig to PIT is cotaied i the followig lemma. Lemma 6.5. A perfect matchig exists if ad oly if det(m) is the zero-polyomial. Hece the radomised algorithm for solvig PIT ca be tured ito a algorithm for solvig the decisio versio of bipartite perfect matchig that always aswers NO if G does ot cotai a perfect matchig, ad icorrectly aswers NO with probability at most 1/2 if G does cotai a perfect matchig. Proof of Lemma 6.5. For coveiece, we will assume that the vertices o both sides are labelled 1, 2,...,. As i (6.4), the determiat of M ca be writte as det(m) = sg(σ) M i,σ(i). (6.1 σ S Note that every permutatio σ S ca be iterpreted as a possible perfect matchig, M(σ) = {(i, σ(i)) : i A} A B, (6.13) which is oly a actual perfect matchig if each of the pairs (i, σ(i)) is i fact a edge i G. If some pair (i, σ(i)) is ot a edge i G, the correspodig M i,σ(i) = 0, ad so all the summads correspodig with permutatios that do ot give perfect matchigs evaluate to 0. It follows that if G does ot cotai ay perfect matchigs, det(m) is the zero-polyomial. O the other had, if a perfect matchig P exists, this gives rise to a summad ± A i,j = ± x i,j, (6.14) (i,j) P so det(m) caot be the zero-polyomial. (i,j) P 2. Global miimum cut Let G = (V, E) be a graph with vertices ad m edges. A cut i G is a partitio of the vertices of G i two o-empty sets S ad V \ S. We will write (S, V \ S) for the set of edges crossig the cut, i.e. the edges with oe ed i S ad the other ed i V \ S (we will ofte refer to the set of edges crossig the cut simply as the cut). The size of a cut is the umber of edges crossig it, i.e. the size of the cut (S, V \ S) is (S, V \ S). A cut is a miimum cut (or mi-cut) if it is of miimum size amog all cuts i G. Note that there is ot ecessarily a uique mi-cut. Problem: Iput: Output: Mi-Cut A graph G A cut of miimum size i G We have see mi-cuts before i the cotext of miimum s, t-cuts. I that variat of the problem, we distiguish two vertices s ad t (ofte called the source ad the sik), ad 36
the objective is to fid a cut (S, V \ S) of miimum size that separates s ad t (i.e. s S ad t V \ S). By replacig each edge i G by two directed edges, the mi-s, t-cut problem ca be solved easily by relatig it to a max-flow problem o the same graph. The global mi-cut problem ca be solved efficietly by fixig some vertex s, varyig t over the remaiig vertices, ad solvig the correspodig mi-s, t-cut problems. Lemma 6.6. Mi-cut ca be solved i polyomial time. I this lecture, we will see a radomised algorithm for solvig Mi-cut, kow as Karger s mi-cut algorithm, which was first published i [Kar93]. 2.1. Cotractios. A multigraph is a graph i which it is possible to have multiple edges betwee ay pair of vertices. Karger s mi-cut algorithm that we will describe below, will iitially take a graph as iput, but o the way might costruct multiple edges. I a multigraph, a edge that starts ad eds at the same vertex is called a self-loop. I our settig, we will oly cosider multigraphs without self-loops. The cetral operatio i Karger s mi-cut algorithm is called cotractio. If G is a multigraph, ad e is a edge with ed poits u ad v the the multigraph G/e obtaied by cotractig e is formed as follows: 1. Replace u ad v by a sigle vertex w; 2. Replace all edges {x, u} ad {x, v} by a ew edge {x, w}; 3. Remove all self-loops at w. Note that the umber of vertices decreases with every cotractio. The followig lemma provides the cetral idea to Karger s mi-cut algorithm. Lemma 6.7. Let e = {u, v} be a edge. There is a oe-to-oe correspodece betwee cuts (S, V \ S) i G avoidig e ad cuts i G/e. 2.2. Karger s mi-cut algorithm. We are ow ready to state the algorithm. Repeat util V = 2: Pick a radom edge e; Replace G G/e. The idea of the algorithm is to cotract radom edges, util two vertices remai. By Lemma 6.7, these two vertices correspod to a cut i the origial graph, which is the output. Hopefully, the output is i fact a mi-cut i the origial graph. The key i the aalysis is that we ca fid a lower boud o the probability that the output i fact is a mi-cut. By repeatig the algorithm a suitable umber of times, ad takig the smallest cut that is retured, we ca make the probability of fidig a mi-cut as large as we wat. Recall that if A 1 ad A 2 are evets, the P (A 1 A 2 ) = P (A 1 ) P (A 2 A 1 ). (6.15) The followig lemma geeralises this equality to itersectio of more tha two evets. Lemma 6.8. Let A 1, A 2,..., A be evets, the ( ) P A i = P (A 1 ) P (A 2 A 1 ) P (A 3 A 1, A 2 )... P (A A 1, A 2,..., A 1 ). (6.16) We ca ow prove the mai result of this sectio. We say that a cut survives the procedure, if oe of its edges is cotracted durig the executio. Theorem 6.9. Let C = (S, V \ S) be a miimum cut i G. The probability that C survives the procedure is at least 1/ (. 37
Proof. Let A i be the evet that the cut C survives the first i cotractios, i = 1, 2,..., 2. Note that A 1 A 2... A 2. We are iterested i the probability that C survives the first 2 cotractios, that is ( 2 ) P (A 2 ) = P A i = P (A 1 ) P (A 2 A 1 )... P (A 2 A 1, A 2,..., A 3 ). (6.17) We boud each of the probabilities o the right-had side from below. To start with ote that C survives the first cotractio if the radomly selected edge is ot oe of the edges crossig C. Let κ = C be the size of the miimum cut. As the edges adjacet to a sigle vertex form a cut, it follows that the degree of every vertex is at least κ. Therefore, the umber of edges i G is at least 1 2κ. It follows that P (A 1 ) 1 κ 1 2 κ = 2. (6.18) Next, ote that coditioal o C survivig the first i cotractios, C is still a miimum cut i the multigraph. As the umber of edges ow is at least 1 2κ( i), it follows that κ i 2 P (A i+1 A 1, A 2,..., A i ) 1 =. (6.19) κ( i) i Upo combiig (6.18) (6.19) with (6.17), we obtai the desired boud P (A 2 ) 2 3 1... 1 3 = 2 ( 1) = ( 1 (6.20). Accordig to the theorem, each ru of the algorithm produces a mi-cut with probability at least 1/ ( (. By repeatig the algorithm l 2 times, ad takig the smallest cut retured, the success probability is improved to at least 1/2, as ( ) l 2( 1 1 ( 1 1 e l 2 = 1 2. (6.21) 1 2 [Kar93] [KI03] [Sch80] [Zip79] Bibliography David R. Karger. Global Mi-cuts i RNC, ad Other Ramificatios of a Simple Mi-Cut Algorithm. I: SODA. Vol. 93. 1993, pp. 21 30. Valetie Kabaets ad Russell Impagliazzo. Deradomizig polyomial idetity tests meas provig circuit lower bouds. I: Proceedigs of the thirty-fifth aual ACM symposium ACM. 2003, pp. 355 364. Jack Schwartz. Fast probabilistic algorithms for verificatio of polyomial idetities. I: Joural of the ACM 27.4 (1980), pp. 701 717. Richard Zippel. Probabilistic algorithms for sparse polyomials. I: Proceedigs of the Iteratioa 1979, pp. 216 226. 38