Randomness and Computaton or, Randomzed Algorthms Mary Cryan School of Informatcs Unversty of Ednburgh RC 208/9) Lecture 0 slde
Balls n Bns m balls, n bns, and balls thrown unformly at random nto bns usually one at a tme). Magc bns wth no upper lmt on capacty. Common model of random allocatons and ther affect on overall load and load balance, typcal dstrbuton n the system. Classc" queston - what does the dstrbuton look lke for m = n? Max load? wth hgh probablty results are what we want). We have already shown that when m = n same number of balls as bns) and n f suffcently large, the maxmum load s 3 lnn) wth probablty at least n. We wll show an Ω lnn) ) bound today. RC 208/9) Lecture 0 slde 2
Some prelmnary observatons, defntons The probablty s of a specfc bn bn, say) beng empty: n )m e m/n. Expected number of empty bns: ne m/n Probablty p r of a specfc bn havng r balls: ) m r p r = ) m r. r n n Note p r e m/n r! Defnton 5.) A dscrete Posson random varable X wth parameter µ s gven by the followng probablty dstrbuton on j = 0,, 2,...: m n r. Pr[X = j] = e µ µ j j!. RC 208/9) Lecture 0 slde 3
Posson as the lmt of the Bnomal Dstrbuton Theorem 5.5) If X n s a bnomal random varable wth parameters n and p = pn) such that lm n np = λ s a constant ndependent of n), then for any fxed k N 0 lm Pr[X n = k] = e λ λ k n k!. RC 208/9) Lecture 0 slde 4
Posson modellng of balls-n-bns Our balls n bns model has n bns, m for varable m) balls, and the balls are thrown nto bns ndependently and unformly at random. Each bn X m) behaves lke a bnomal r.v Bm, n ). Wrte X m),..., X m) n ) for the jont dstrbuton note the varous X m) s are not ndependent). For the Posson approxmaton we take λ = m n denote a Posson r.v wth parameter λ = m/n., and wrte Y m) We wrte Y m),..., Y m) n ) to denote a jont dstrbuton of ndependent Posson r.vs whch are all ndependent. to RC 208/9) Lecture 0 slde 5
Posson modellng of balls-n-bns Our balls n bns model has n bns, m for varable m) balls, and the balls are thrown nto bns ndependently and unformly at random. Each bn X m) behaves lke a bnomal r.v Bm, n ). Wrte X m),..., X m) n ) for the jont dstrbuton note the varous X m) s are not ndependent). For the Posson approxmaton we take λ = m n denote a Posson r.v wth parameter λ = m/n., and wrte Y m) We wrte Y m),..., Y m) n ) to denote a jont dstrbuton of ndependent Posson r.vs whch are all ndependent. to RC 208/9) Lecture 0 slde 5
Posson modellng of balls-n-bns Our balls n bns model has n bns, m for varable m) balls, and the balls are thrown nto bns ndependently and unformly at random. Each bn X m) behaves lke a bnomal r.v Bm, n ). Wrte X m),..., X m) n ) for the jont dstrbuton note the varous X m) s are not ndependent). For the Posson approxmaton we take λ = m n denote a Posson r.v wth parameter λ = m/n., and wrte Y m) We wrte Y m),..., Y m) n ) to denote a jont dstrbuton of ndependent Posson r.vs whch are all ndependent. to RC 208/9) Lecture 0 slde 5
Posson modellng of balls-n-bns Our balls n bns model has n bns, m for varable m) balls, and the balls are thrown nto bns ndependently and unformly at random. Each bn X m) behaves lke a bnomal r.v Bm, n ). Wrte X m),..., X m) n ) for the jont dstrbuton note the varous X m) s are not ndependent). For the Posson approxmaton we take λ = m n denote a Posson r.v wth parameter λ = m/n., and wrte Y m) We wrte Y m),..., Y m) n ) to denote a jont dstrbuton of ndependent Posson r.vs whch are all ndependent. to RC 208/9) Lecture 0 slde 5
Posson modellng of balls-n-bns Our balls n bns model has n bns, m for varable m) balls, and the balls are thrown nto bns ndependently and unformly at random. Each bn X m) behaves lke a bnomal r.v Bm, n ). Wrte X m),..., X m) n ) for the jont dstrbuton note the varous X m) s are not ndependent). For the Posson approxmaton we take λ = m n denote a Posson r.v wth parameter λ = m/n., and wrte Y m) We wrte Y m),..., Y m) n ) to denote a jont dstrbuton of ndependent Posson r.vs whch are all ndependent. to RC 208/9) Lecture 0 slde 5
Some prelmnares Theorem 5.7) Let f x,..., x n ) be a non-negatve functon. Then E[f X m),..., X m) n )] e m E[f Y m),..., Y m) n )]. Corollary 5.9) Any event that takes place wth probablty p n the Posson case takes place wth probablty at most pe m n the exact balls-n-bns case. RC 208/9) Lecture 0 slde 6
Lower bound for n balls n bns Lemma Let n balls be thrown ndependently and unformly at random nto n bns. Then for n suffcently large) the maxmum load s at least lnn)/ wth probablty at least n. Proof. For the Posson varables, we have λ = n n any bn say), Pr Poss [bn has load M] Pr Poss [bn has load = M] = M e M! = lnn) =. Let M =. For In our Posson model, the bns are ndependent, so the probablty no bn has load M our bad event) s at most ) n e n/). RC 208/9) Lecture 0 slde 7
Lower bound for n balls n bns Lemma Let n balls be thrown ndependently and unformly at random nto n bns. Then for n suffcently large) the maxmum load s at least lnn)/ wth probablty at least n. Proof. For the Posson varables, we have λ = n n any bn say), Pr Poss [bn has load M] Pr Poss [bn has load = M] = M e M! = lnn) =. Let M =. For In our Posson model, the bns are ndependent, so the probablty no bn has load M our bad event) s at most ) n e n/). RC 208/9) Lecture 0 slde 7
Lower bound for n balls n bns Lemma Let n balls be thrown ndependently and unformly at random nto n bns. Then for n suffcently large) the maxmum load s at least lnn)/ wth probablty at least n. Proof. For the Posson varables, we have λ = n n any bn say), Pr Poss [bn has load M] Pr Poss [bn has load = M] = M e M! = lnn) =. Let M =. For In our Posson model, the bns are ndependent, so the probablty no bn has load M our bad event) s at most ) n e n/). RC 208/9) Lecture 0 slde 7
Lower bound for n balls n bns Lemma Let n balls be thrown ndependently and unformly at random nto n bns. Then for n suffcently large) the maxmum load s at least lnn)/ wth probablty at least n. Proof. For the Posson varables, we have λ = n n any bn say), Pr Poss [bn has load M] Pr Poss [bn has load = M] = M e M! = lnn) =. Let M =. For In our Posson model, the bns are ndependent, so the probablty no bn has load M our bad event) s at most ) n e n/). RC 208/9) Lecture 0 slde 7
Lower bound for n balls n bns Lemma Let n balls be thrown ndependently and unformly at random nto n bns. Then for n suffcently large) the maxmum load s at least lnn)/ wth probablty at least n. Proof. For the Posson varables, we have λ = n n any bn say), Pr Poss [bn has load M] Pr Poss [bn has load = M] = M e M! = lnn) =. Let M =. For In our Posson model, the bns are ndependent, so the probablty no bn has load M our bad event) s at most ) n e n/). RC 208/9) Lecture 0 slde 7
Lower bound for n balls n bns Lemma Let n balls be thrown ndependently and unformly at random nto n bns. Then for n suffcently large) the maxmum load s at least lnn)/ wth probablty at least n. Proof. For the Posson varables, we have λ = n n any bn say), Pr Poss [bn has load M] Pr Poss [bn has load = M] = M e M! = lnn) =. Let M =. For In our Posson model, the bns are ndependent, so the probablty no bn has load M our bad event) s at most ) n e n/). RC 208/9) Lecture 0 slde 7
Lower bound for n balls n bns Proof of Lemma 5. cont d. We now relate Pr Poss [bn has load M] to the probablty of the same event n the balls-n-bns model. Corollary 5.9 tells us that when we consder the exact balls-n-bns dstrbuton X n),..., X n) n ), that the probablty of the event no bn has M balls s at most e n e n/). We want ths less than n, e we want e n/) n 3/2. Takng ln ) of both sdes, ths happens f n ) 3 2 lnn) + 3 2 lnn) n. Now M! e M M e )M M M e )M Lemma 5.8), hence n nem. em M+ RC 208/9) Lecture 0 slde 8
Lower bound for n balls n bns Proof of Lemma 5. cont d. We now relate Pr Poss [bn has load M] to the probablty of the same event n the balls-n-bns model. Corollary 5.9 tells us that when we consder the exact balls-n-bns dstrbuton X n),..., X n) n ), that the probablty of the event no bn has M balls s at most e n e n/). We want ths less than n, e we want e n/) n 3/2. Takng ln ) of both sdes, ths happens f n ) 3 2 lnn) + 3 2 lnn) n. Now M! e M M e )M M M e )M Lemma 5.8), hence n nem. em M+ RC 208/9) Lecture 0 slde 8
Lower bound for n balls n bns Proof of Lemma 5. cont d. We now relate Pr Poss [bn has load M] to the probablty of the same event n the balls-n-bns model. Corollary 5.9 tells us that when we consder the exact balls-n-bns dstrbuton X n),..., X n) n ), that the probablty of the event no bn has M balls s at most e n e n/). We want ths less than n, e we want e n/) n 3/2. Takng ln ) of both sdes, ths happens f n ) 3 2 lnn) + 3 2 lnn) n. Now M! e M M e )M M M e )M Lemma 5.8), hence n nem. em M+ RC 208/9) Lecture 0 slde 8
Lower bound for n balls n bns Proof of Lemma 5. cont d. Therefore t wll suffce to show that + 3 2 lnn) suffcently large n), that nem, or for em M+ 2 lnn) nem em M+. Takng the ln of both sdes, ths happens usng M lnn) ) when ln2)+ ) lnn) + lnn) + ) ) lnn) + ln ), e, exactly when +ln2)+ ) lnn) + lnn) lnn) + lnn) ln +ln, e, exactly when + ln2) + 2 lnn) + lnn) ln + ln. RC 208/9) Lecture 0 slde 9
Lower bound for n balls n bns Proof of Lemma 5. cont d. Therefore t wll suffce to show that + 3 2 lnn) suffcently large n), that nem, or for em M+ 2 lnn) nem em M+. Takng the ln of both sdes, ths happens usng M lnn) ) when ln2)+ ) lnn) + lnn) + ) ) lnn) + ln ), e, exactly when +ln2)+ ) lnn) + lnn) lnn) + lnn) ln +ln, e, exactly when + ln2) + 2 lnn) + lnn) ln + ln. RC 208/9) Lecture 0 slde 9
Lower bound for n balls n bns Proof of Lemma 5. cont d. Therefore t wll suffce to show that + 3 2 lnn) suffcently large n), that nem, or for em M+ 2 lnn) nem em M+. Takng the ln of both sdes, ths happens usng M lnn) ) when ln2)+ ) lnn) + lnn) + ) ) lnn) + ln ), e, exactly when +ln2)+ ) lnn) + lnn) lnn) + lnn) ln +ln, e, exactly when + ln2) + 2 lnn) + lnn) ln + ln. RC 208/9) Lecture 0 slde 9
Lower bound for n balls n bns Proof of Lemma 5. cont d. Therefore t wll suffce to show that + 3 2 lnn) suffcently large n), that nem, or for em M+ 2 lnn) nem em M+. Takng the ln of both sdes, ths happens usng M lnn) ) when ln2)+ ) lnn) + lnn) + ) ) lnn) + ln ), e, exactly when +ln2)+ ) lnn) + lnn) lnn) + lnn) ln +ln, e, exactly when + ln2) + 2 lnn) + lnn) ln + ln. RC 208/9) Lecture 0 slde 9
Lower bound for n balls n bns Proof of Lemma 5. cont d. To show that + ln2) + 2 lnn) + lnn) ln + ln we wll multply across by, to verfy the equvalent nequalty +ln2)) +2) 2 lnn)+lnn) ln +ln. At ths pont we notce that we have two terms on the rght lnn) and lnn) ln ) whch are exponentally larger than the two terms on the lhs - both lhs terms only grow wrt. We do not need to check the numbers - as n grows the rhs wll certanly be greater than the lhs. Hence our clam holds. RC 208/9) Lecture 0 slde 0
Lower bound for n balls n bns Proof of Lemma 5. cont d. To show that + ln2) + 2 lnn) + lnn) ln + ln we wll multply across by, to verfy the equvalent nequalty +ln2)) +2) 2 lnn)+lnn) ln +ln. At ths pont we notce that we have two terms on the rght lnn) and lnn) ln ) whch are exponentally larger than the two terms on the lhs - both lhs terms only grow wrt. We do not need to check the numbers - as n grows the rhs wll certanly be greater than the lhs. Hence our clam holds. RC 208/9) Lecture 0 slde 0
Lower bound for n balls n bns Proof of Lemma 5. cont d. To show that + ln2) + 2 lnn) + lnn) ln + ln we wll multply across by, to verfy the equvalent nequalty +ln2)) +2) 2 lnn)+lnn) ln +ln. At ths pont we notce that we have two terms on the rght lnn) and lnn) ln ) whch are exponentally larger than the two terms on the lhs - both lhs terms only grow wrt. We do not need to check the numbers - as n grows the rhs wll certanly be greater than the lhs. Hence our clam holds. RC 208/9) Lecture 0 slde 0
References and Exercses Sectons 5., 5.2 of Probablty and Computng". Sectons 5.3 and 5.4 have all precse detals of our Ω lnn) ) result. Secton 5.5 on Hashng s worth a read and has none of the Posson stuff I m skppng t because of tme lmtatons). Exercses I wll release a tutoral sheet. RC 208/9) Lecture 0 slde