Mathematical Toolkit Autum 2018 Lecturer: Madhur Tulsiai Lecture 12: November 13, 2018 1 Radomized polyomial idetity testig We will use our kowledge of coditioal probability to prove the followig lemma, which gives a algorithm for testig if a polyomial f i variables x 1,..., x over a field F is idetically zero. Lemma 1.1 (Schwartz-Zippel lemma) Let f (x 1, x 2,..., x ) be a o-zero polyomial of degree d 0, i.e., f (x 1, x 2,..., x ) = c i1 i 2...i x i 1 1 x i 2 2 x i s.t., i 1 + i 2 +... + i d over a field, F. Let S F, be a fiite subset ad let x 1, x 2,..., x be selected uiformly at radom from S, idepedetly. The, P [ f (x 1, x 2,..., x ) = 0] d. Proof: We will prove this lemma by iductio o. This lemma ca be proved simply by usig coditioal probability. Base Case: = 1 A o zero polyomial, f (x 1 ) ca have at most d roots. Hece, P [ f (x 1 ) = 0] d. Iductio Step Assume that the lemma holds for ay polyomial i 1 variables. We eed to prove that it holds true for f (x 1, x 2,..., x ). We ca write f as: f (x 1, x 2,..., x ) = x k g(x 1,..., x 1 ) + h(x 1, x 2,..., x ) where, k is largest degree of x. Thus we have 0 < k d (if k = 0 the we are already doe). We also have that deg(g(x 1,..., x 1 )) d k. 1
Now let us defie two evets. We ca the write, E { f (x 1, x 2,..., x ) = 0} ad F {g(x 1,..., x 1 ) = 0} P [E] = P [F] P [E F] + P [F c ] P [E F c ]. We ow aalyze each of the terms. By the iductio hypothesis, we have P [F] = P [g(x 1,..., x 1 ) = 0] d k Also, fixig the values of x 1 = a 1,..., x 1 = a 1 such that g(a 1,..., a 1 ) = 0, f (x 1, a 2,..., a ) is a degree-k polyomial i x. Thus, usig the base case, we get that. P [E F c ] k. Boudig the other two probabilities by 1, we get that P [E] d k 1 + 1 k = d as desired. 1.1 A applicatio: bipartite perfect matchig Cosider the followig example which applied the Schwartz-Zippel lemma for testig if a give bipartite graph has a perfect matchig. Give a bipartite graph, G = (U, V, E) with U = V =, we say that the graph has a perfect matchig, if there exists a set E E of edges, with exactly oe edge i E beig icidet o every vertex of G. Let us defie the Tutte matrix A as { xij if (i, j) E A ij = 0 else Note that A is ot ecessarily symmetric. The determiat of A ca be writte as, Det(A) = π:[] [] sig(π) A i,π(i) i=1 where π defies the permutatio from rows to colums. Note that the determiat is a degree- polyomial i the variables x ij. Verify the follwig: 2
Exercise 1.2 G has a perfect matchig if ad oly if Det(A) 0. I this case, computig the determiat is expesive with! terms. But if we are give the values of the variables x ij, we ca simply compute the determiat usig the Gaussia elimiatio method. The degree of the polyomial above is. Thus, if we assig all variables radomly from a set of 2 real values, if Det(A) 0, we will detect it with probability at least 1/2. The radomized algorithm by Schwartz-Zippel Lemma ca be used to parallelize the checkig as well. There is o kow determiistic algorithm for this problem which ca be parallelized efficietly. 2 Radom Variables ad Expectatios We defied expectatios i the previous lecture. Check the followig facts about expectatios: Exercise 2.1 For ay two radom variables X 1, X 2 : Ω R ad c 1, c 2 R, we have E [c 1 X 1 + c 2 X 2 ] = c 1 E [X 1 ] + c 2 E [X 2 ]. Thus, expectatio defies a liear trasformatio o the space of real-valued radom variables (for a give Ω). Exercise 2.2 Let X, Y : Ω R be two idepedet radom variables. The show that E [X Y] = E [X] E [Y]. Also, show that the above is ot a sufficiet coditio for idepedece: give a example of two radom variables X ad Y such that E [X Y] = E [X] E [Y] but X ad Y are ot idepedet. We will ot see some very useful radom variables. Beroulli radom variables A Beroulli(p) radom variable X is defied as takig the value 1 with probability p ad the value 0 with probability 1 p. We ca write this as P [X = x] = p x (1 p) 1 x. Oe may ituitively thik of a Beroulli radom variable as the idicator fuctio of heads i a outcome space Ω = {tails, heads} of a biased coi toss. Alteratively, we simply take the outcome space to be Ω = {0, 1}. More geerally, idicator fuctios of evets are Beroulli radom variables. 3
Fiite Beroulli i.i.d. sequece We ca also thik of a sequece of coi tosses, with { 1 if toss i is heads X i =. 0 if toss i is tails beig Beroulli radom variables i the probability space Ω = {0, 1}, i.e., X i (ω) = ω i. Defie the product probability measure o this fiite space usig: µ (ω) = p ω i (1 p) 1 ω i. i=1 Note that if p = 1 2, we have µ (ω) = 1 2, i.e., P is the uiform distributio over the outcome space, as all outcomes are equally likely. Exercise 2.3 For the outcome space defied above, verify that: For ay fixed i, X i is ideed a Beroulli(p) radom variable, ad If I [] ad J [] are disjoit, the ay fuctio of X I ad ay fuctio of X j are idepedet radom variables. As oted i the previous lecture, whe the latter poit holds, we simply say that X 1,, X are idepedet. Furthermore sice all the X i have the same distributio, we call the sequece i.i.d., meaig idepedet ad idetically distributed. Biomial radom variables Let Z be a radom variable coutig the umber of heads associated with idepedet biased coi tosses. We ca model this i Ω above as Z = X i. Let us calculate the expectatio of Z. By liearity we have E [Z ] = E [X i ]. Sice Z = X i, we have, E [Z ] = E [X i ]. Now, E [X i ] = 1 P [X i = 1] + 0 P [X i = 0] = P [X i = 1] = p Hece E [Z ] = p. Note that we did ot use idepedece i the above calculatios. We just eeded that for each i, E [X i ] = p. We do eed idepedece, ad amely the product probability measure, to calculate P(Z = k) for k [] (this is ofte called the probability mass fuctio. First ote that the shorthad (Z = k) simply meas {ω Ω : Z (ω) = k}. Sice all ω that have the same umber (i this case k) of 1 s have the same probability, we simply eed to cout how may such ω s there are, ad multiply by this idividual probability. Exercise 2.4 Verify that P (Z = k) = ( k )pk (1 p) k. Z is called a Biomial(, p) radom variable. 4
Ifiite Beroulli i.i.d. sequece ad Geometric radom variables We would like to geeralize the Beroulli sequece probability space to a ifiite sequece. We would like to choose Ω = {0, 1} N as our outcome space, but this is ot a coutable set. We will come back to the issue of properly defiig the probability space with this ucoutable Ω. For ow, if we still cosider the metal experimet of ifiite i.i.d. Beroulli(p) sequece of radom variables X 1, X 2,, which we iterpret oce more as coi tosses. We defie Y be the umber of tosses till the first heads. If we are just iterested i Y (the first heads rather tha all outcomes of all tosses), we ca take Ω to be N. Exercise 2.5 Although we caot defie a coutable probability space for the ifiite i.i.d. Beroulli sequece, show that if we just wat defie a space for Y, we ca take Ω = N ad P(i) = (1 p) i 1 p for i 1. Y is kow as a Geometric(p) radom variable. Let us calculate E[Y], i a somewhat creative way. Let E be the evet that the first toss is heads. The by total expectatio we have, E [Y] = E [Y E] P [E] + E [Y E c ] P [E c ] = 1 P [E] + (1 + E [Y]) (1 p) Thus we have, E [Y] = 1 p. The mai observatio that we used here is that, thaks to idepedece, whe the first toss is ot heads, the the problem resets (with the hidsight of oe cosumed toss). 3 Coupo Collectio Cosider the followig problem: There are kids of items/coupos ad at each time step we get oe coupo chose to be from oe of the types at radom. All types are equally likely at each step ad the choices at differet time steps are idepedet. We defie a radom variable, T which is the time whe we first have all the types of coupos. Fid E [T]. We ca make the followig claim: T = X i, i=1 where X i is the time to get from the i 1 to the i types of coupos. Thus we have, E [T] = E [X i ] i 5
Note that X i is a geometric radom variable with parameter i+1, sice if we have i 1 type of coupos, X i represets the time till we receive a coupo belogig to ay oe of the remaiig i + 1 types. Thus, Therefore, E [T] = + E [X i ] = i + 1. 1 + 2 + + 1 = H() where H = 1 + 1 2 + 1 3 + + 1 is the th harmoic umber. It is kow (see Wikipedia for example) that H = l + Θ(1). Thus, we have that E [T] = l + Θ(). 6