1.5 Balls, Bins, and Random Graphs

1.5.1 A few things I should have noted about e

We begin with the definition of e and e−1

limn→∞(1+1n)n=e,limn→∞(1−1n)n=1e.

Both f⁢(n)=(1+1/n)n and g⁢(n)=(1−1/n)n are monotone, proven as follows:

  • •

    Let φf⁢(n)=n⁢ln⁡(1+1/n), then the first order derivative

    φf′⁢(n)=ln⁡(1+1n)+n⋅11+1/n⋅(−1n2)=ln⁡(1+1n)−11+n.

    Let t=1+1/n>1, then

    φf′⁢(n)=ln⁡(1+1n)−11+n=ln⁡(1+1n)+n1+n−1=ln⁡t+1t−1.

    As t>1 and by integral,

    ln⁡t=∫1t1x⁢𝑑x>(t−1)⋅1t,

    we have φf′⁢(n)>0, and thus φf⁢(n) is monotone increasing.

  • •

    Similarly, let φg⁢(n)=n⁢ln⁡(1−1/n), then the first order derivative

    φg′⁢(n)=ln⁡(1−1n)+n⋅11−1/n⋅(−−1n2)=ln⁡(1−1n)+1n−1.

    Let t=1−1/n that 0<t<1, then

    φg′⁢(n)=ln⁡(1−1n)+1n−1=ln⁡(1−1n)+nn−1−1=ln⁡t+1t−1.

    As 0<t<1 and by integral again,

    ln⁡t=∫1t1x⁢𝑑x=−∫t11x⁢𝑑x>−(1−t)⋅1t,

    we have φg′⁢(n)>0, and thus φg⁢(n) is monotone increasing.

Moreover, by the Taylor expansion

ex=∑i≥0xii!,

then ex≥1+x for all x. We derive following handy inequality from the Taylor expansion.

Lemma 1.5.1.

For integer x≥0 and n≥0, we have

1x!≤ennx.
Proof.

By Taylor expansion, since

nxx!≤∑m≥0nmm!=en,

therefore

1x!≤ennx.

∎

Exercise 1.5.2 (Exercise 5.7 [MU17]).

Use the Taylor expansion

ln⁡(1+x)=x−x22+x33−x44+⋯

to prove that, for any |x|≤1, ex⁢(1−x2)≤1+x≤ex.

Proof.

We prove the left side ex⁢(1−x2)≤1+x first. Take ln on both sides, we have left side x+ln⁡(1+x)+ln⁡(1−x).

Now by the Taylor expansion, for |x|≤1, we have

x+ln⁡(1+x)+ln⁡(1−x) =x+x−x22+x33−x44⁢⋯−x−x22−x33−x44⁢⋯
=x−2⋅x22−2⋅x44⁢⋯
≤x−x22+x33−x44+⋯=ln⁡(1+x).

The right side holds from the Taylor expansion of ex, and we conclude that for |x|≤1, ex⁢(1−x2)≤1+x≤ex. ∎

Lemma 1.5.3.

For any integer k≥1, by concavity of ln⁡x,

12⁢(ln⁡k+ln⁡(k+1))≤∫kk+1ln⁡x⁢d⁢x.
Lemma 1.5.4 (Lemma 5.8 [MU17]).
n!≤e⁢n⁢(ne)n.
Proof.

Since ln⁡n!=∑i∈[1,n]ln⁡i, and we have the following from lemma 1.5.3

∑i∈[1,n]ln⁡i≤∫1nln⁡x⁢d⁢x+12⁢ln⁡n=n⁢ln⁡n−n+1+12⁢ln⁡n,

which completes the proof by exponenting over e on both sides. ∎

Corollary 1.5.5.

By lemma 1.5.1 and lemma 1.5.4, we have

(ne)n≤n!≤e⁢n⋅(ne)n⁢ and ⁢1e⁢n⋅(en)n≤1n!≤(en)n.

1.5.2 Birthday Paradox and Balls-and-Bins model

Suppose there are n possible birthdays, and there are m people in a room. Then, the probability that all m are having different birthdays is

∏j∈[0,m−1](1−jn)≤∏j∈[0,m−1]exp⁡(−jn)≤exp⁡(−m22⁢n).

Hence, when m=2⁢n⁢ln⁡2, the probability goes to 1/2.

But through union bound, we can also give a loose bound as follows. Consider event Ek being the kth people failed to have distinct birthday from all previous k−1 people. Then Pr⁡[Ek]=(k−1)/n. Through union bound, the probability of the first k people failed to have distinct birthdays is upper bounded by

Pr⁡[⋃i∈[1,k]Ei]≤∑i∈[1,k]Pr⁡[Ei]=k⁢(k−1)2⁢n.

The upper bound indicates that when k=⌈n⌉, the probability of having distinct birthdays is at most 1/2.

Moreover, assuming that first ⌈n⌉ birthdays are distinct, then the next ⌈n⌉ birthdays are different from the first ⌈n⌉ birthdays with probability upper bounded by

(1−⌈n⌉n)⌈n⌉≤1e.

Therefore, once there are 2⁢⌈n⌉ people out there, the probability of having all distinct birthdays is at most 1/e<1/2.

Remark 1.5.6.

The idea of union bound is used throughout the Poisson approximation and balls-and-bins model later on, after introduction of theorem 1.5.15.

Exercise 1.5.7 (Exercise 5.4 [MU17]).

Consider the extended birthday paradox, but with no 3 having same birthdays.

Proof.

Let there be k people, and there be n days in a year.

Suppose there are j pairs of same birthdays, then we first consider the number of pair choices out of k people. We can choose 2 people continuously from k people, then rule out all the duplicate choices, as we don’t care about the ordering, and thus we have number of choices in total

(k2)⁢(k−22)⁢⋯⁢(k−2⁢j+22)⋅1j!=k!2j⁢(k−2⁢j)!⋅1j!=(k2;…;2)⋅1j!.

For each choice, there are k−j days to be distinct, the rest j people should have same birthdays as their pairs, leading to probability

1nj⋅∏i∈[1,k−j](1−i−1n).

Now that the probability pj with j pairs of same birthdays is

pj=k!2j⁢(k−2⁢j)!⋅1j!⋅1nj⋅∏i∈[1,k−j](1−i−1n),

summing over pj over j∈[0,⌊k2⌋] is the exact probability. ∎

Exercise 1.5.8 (Exercise 5.8 [MU17]).

n balls are thrown independently and uniformly at random into n bins.

  • •

    Find the conditional probability that bin 1 has one ball given that exactly one ball fell into the first three bins.

  • •

    Find the conditional expectation of the number of balls in bin 1 under the condition that bin 2 received no balls.

  • •

    Write an expression for the probability that bin 1 receives more balls than bin 2.

Proof.

If conditioned that there are only 1 ball in first 3 bins, then the probability that a ball is in bin 1 is 1/3.

We introduce independent Bernoulli trials {Xi}i∈[1,n] with probability 1/n indicating if the ith ball falls in bin 1. Then the conditional probability of Xi=1 given that the ith ball does not fall into bin 2 is

Pr⁡[Xi=1∣ith⁢ ball does not fall in bin 2]=1n−1.

Therefore, the conditional expectation of X=∑i∈[1,n]Xi under the condition that bin 2 has no balls is

𝔼[X∣bin 2 has no balls] =∑i∈[1,n]𝔼[Xi∣bin 2 has no balls]
=∑i∈[1,n]1⋅Pr⁡[Xi=1∣ith⁢ ball does not fall in bin 2]=nn−1.

There are only 3 cases related to balls in bin 1 and bin 2, one of more, less, or equal. By symmetry, former 2 cases are equal. Therefore, we need only the equal case to derive the exact result.

We choose k∈[0,⌊n2⌋] balls each for bin 1 and bin 2, and the probability is given by

pe,k=(nk;k)⁢(1n)k⁢(1n)k⁢(1−2n)n−2⁢k=(nk;k)⁢(1n)2⁢k⁢(1−2n)n−2⁢k.

Therefore, the exact probability for the equal case is pe=∑kpe,k, and the desired probability is (1−pe)/2. ∎

Lemma 1.5.9 (Lemma 5.1 [MU17]).

When n balls are thrown independently and uniformly at random into n bins, the probability that the maximum load is more than 3⁢ln⁡n/ln⁡ln⁡n is at most 1/n for n sufficiently large.

Proof.

Suppose for the ith bin receives at least M balls, let it be event Ei, then the probability is

Pr⁡[Ei]=(nM)⁢1nM.

If any bins are receiving with at least M balls, by union bound, the probability is upper bounded by

Pr⁡[⋃i∈[1,n]Ei]≤∑i∈[1,n]Pr⁡[Ei]=n⁢(nM)⁢1nM.

Since

(nM)⁢1nM≤1M!≤(eM)M,

where second inequality follows from lemma 1.5.1, the probability is then upper bounded by n⁢(e/M)M.

Choose M=3⁢ln⁡n/ln⁡ln⁡n, then when n is sufficiently large, the probability upper bound is at most 1/n. ∎

Exercise 1.5.10 (Exercise 5.12 [MU17]).

The following problem models a simple distributed system wherein agents contend for resources but “back off” in the face of contention. Balls represent agents, and bins represent resources.

The system evolves over rounds. Every round, balls are thrown independently and uniformly at random into n bins. Any ball that lands in a bin by itself is served and removed from consideration. The remaining balls are thrown again in the next round. We begin with n balls in the first round, and we wish when every ball is served.

  • •

    If there are b balls at the start of a round, what is the expected number of balls at the start of the next round?

  • •

    Suppose that every round the number of balls served was exactly the expected number of balls to be served. Show that all the balls would be served in O⁢(log⁡log⁡n) rounds. (Hint: If xj is the expected number of balls left after j rounds, show and use that xj+1≤xj2/n.)

Proof.

We first consider the expected number of remaining balls. Only the bin with one and only one ball can serve the ball, and thus we can disregard the ball onwards. We introduce n independent 0-1 random variables {Xi}i∈[1,n] for ith bin has one and only one ball to serve. Therefore, the probability for a bin with only one ball is

Pr⁡[Xi=1]=(b1)⁢1n⁢(1−1n)b−1=bn⋅(1−1n)b−1,

where b is the number of balls remaining by now.

Let X=∑i∈[1,n]Xi be the number of bins can serve (or balls to disregard), by linearity of expectation, we have

𝔼[X]=n⋅bn⋅(1−1n)b−1=b⋅(1−1n)b−1.

Therefore, the remaining balls next round is b−b⋅(1−1/n)b−1.

Let b be the remaining balls to serve after round j, then xj+1=b−b⋅(1−1/n)b−1. Since

(1−1n)b−1≥1−b−1n,

we have xj+1≤b⁢(b−1)/n, and therefore xj+1≤xj2/n.

Now we write yj=xj/n, and therefore yj+1≤yj2, and we want to know the number of rounds to reach a y=1/n. Suppose yj=1/2 for some constant number of rounds j, we count the number of additional rounds r until we have

yj2r=(12)2r≤1n.

Therefore r=O⁢(log⁡log⁡n), that all balls will be served in O⁢(log⁡log⁡n) rounds. ∎

1.5.3 Poisson Distribution

Exercise 1.5.11 (Exercise 5.6 [MU17]).

Let X be a Poisson random variable with mean μ, representing the number of a page of this book. Each error is independently a grammatical error with probability p and a spelling error with probability 1−p. If Y and Z are random variables representing the number of grammatical and spelling error (respectively) on a page of this book, prove that Y and Z are Poisson random variables with means μ⁢p and μ⁢(1−p), respectively. Also, prove that Y and Z are independent.

Proof.

The sum of a finite number of independent Poisson random variables is a Poisson random variable, by looking at the MGFs. Now think in a reverse way, that a Poisson random variable can be thinned down to a finite number of independent Poisson random variables, which is the Poisson Thinning (Splitting) Property.

Let a Poisson variable X with mean μ represent the errors of a page, then Y be the random variable represent the grammatical errors with probability p in these errors. The probability of Y=k is the summation of all conditional probability conditioned over X by

Pr⁡[Y=k] =∑x≥kPr⁡[Y=k∩X=x]
=∑x≥kPr⁡[Y=k∣X=x]⋅Pr⁡[X=x]
=∑x≥k(xk)⁢pk⁢(1−p)x−k⋅e−μ⁢μxx!=e−μ⁢pk⁢μkk!⁢∑x≥k(1−p)x−k⋅μx−k(x−k)!
=e−μ⁢pk⁢μkk!⋅e(1−p)⁢μ=e−p⁢μ⁢(p⁢μ)kk!,

which is the probability of a Poisson random variable with mean p⁢μ being k. By symmetry, Z is a Poisson random variable with mean (1−p)⁢μ by substituting p with 1−p.

For Y and Z being independent, we prove by the property of independence as follows:

Pr⁡[Y=y∩Z=z] =Pr⁡[Y=y∩Z=z∣X=y+z]⋅Pr⁡[X=y+z]
=(y+zy)⁢py⁢(1−p)z⋅e−μ⁢μy+z(y+z)!=py⁢(1−p)z⋅e−μ⁢μy+zy!⁢z!
=e−p⁢μ⁢py⁢μyy!⋅e−(1−p)⁢μ⁢(1−p)z⁢μzz!
=Pr⁡[Y=y]⋅Pr⁡[Z=z].

∎

Lemma 1.5.12 (Exercise 5.14 [MU17]).

If Z is a Poisson random variable of mean μ≥1 integer, then Pr⁡[Z≥μ]≥1/2.

  • •

    Show that Pr⁡[Z=μ+h]≥Pr⁡[Z=μ−h−1] for 0≤h≤μ−1.

  • •

    Argue that Pr⁡[Z≥μ]≥1/2.

Proof.

We write Pr⁡[Z=μ+h]=δh⋅Pr⁡[Z=μ−h−1], where h∈[0,μ−1]. Therefore,

δh=∏j∈[μ−h,μ−1]μj⋅∏j∈[μ+1,μ+h]μj=∏k∈[1,h]μ2(μ−k)⁢(μ+k)=∏k∈[1,h]αk.

As αk≥1 for k∈[1,h], therefore δh≥1. Thus Pr⁡[Z≤μ−1]≤Pr⁡[Z≥μ], and Pr⁡[Z≥μ]≥1/2.

Moreover, since δ0=1, therefore Pr⁡[Z=μ−1]=Pr⁡[Z=μ]. ∎

Theorem 1.5.13 (Poisson Median Range Theorem [Cho94]).

Let Z be a Poisson random variable of mean μ>0, and m be the median of Z. Then

μ−ln⁡2≤m≤μ+13.

If μ is an integer such that μ≥1, then μ=m, and thus Pr⁡[Z≥μ]≥1/2 and Pr⁡[Z≤μ]≥1/2.

1.5.4 Poisson Approximation

Theorem 1.5.14 (Theorem 5.6 [MU17]).

Let {Xi(m)}i∈[1,n] be the number of balls in each bin of the m balls and n bins model, and {Yi(m)}i∈[1,n] be independent Poisson random variables of mean m/n. The distribution of (X1(k),…,Xn(k)) is the same as the distribution of (Y1(m),…,Yn(m)) conditioned on Y(m)=∑i∈[1,n]Yi(m)=k, regardless of the value of m.

Theorem 1.5.15 (Theorem 5.7 [MU17]).

Let f⁢(x1,…,xn) be a nonnegative function. Then

𝔼[f⁢(X1(m),…,Xn(m))]≤e⁢m⋅𝔼[f⁢(Y1(m),…,Yn(m))].
Proof.

By conditional expectation and theorem 1.5.14, we have

𝔼[f⁢(Y1(m),…,Yn(m))] =∑k≥0𝔼[f⁢(Y1(m),…,Yn(m))|Y(m)=k]⁢Pr⁡[Y(m)=k]
=∑k≥0𝔼[f⁢(X1(k),…,Xn(k))]⁡Pr⁡[Y(m)=k]
≥𝔼[f⁢(X1(m),…,Xn(m))]⁡Pr⁡[Y(m)=m].

By definition of the Poisson random variable, Y(m) is a Poisson random variable of mean μ=m, thus

Pr⁡[Y(m)=m]=e−m⋅mmm!.

By lemma 1.5.4, Pr⁡[Y(m)=m]≥(e⁢m)−1. Therefore, 𝔼[f⁢(X1(m),…,Xn(m))]≤e⁢m⋅𝔼[f⁢(Y1(m),…,Yn(m))]. ∎

Corollary 1.5.16.

Let E be an event. If E has probability p in the Poisson case, where there are n independent Poisson random variables of mean m/n, then E has probability at most e⁢m⋅p in the exact m balls and n bins case.

Proof.

Immediately from theorem 1.5.15. ∎

Theorem 1.5.17 (Theorem 5.10 [MU17]).

Let f⁢(x1,…,xn) be a nonnegative function such that 𝔼[f⁢(X1(m),…,Xn(m))] is either monotonically increasing or monotonically decreasing in m. Then

𝔼[f⁢(X1(m),…,Xn(m))]≤2⁢𝔼[f⁢(Y1(m),…,Yn(m))].
Exercise 1.5.18 (Exercise 5.15 [MU17]).

Prove that if 𝔼[f⁢(X1(m),…,Xn(m))] is monotonically increasing in m, then

𝔼[f⁢(Y1(m),…,Yn(m))]≥𝔼[f⁢(X1(m),…,Xn(m))]⁡Pr⁡[Y(m)≥m],

again under the condition that f is nonnegative.

Make a similar statement for the case when 𝔼[f⁢(X1(m),…,Xn(m))] is monotonically decreasing in m.

Moreover, prove theorem 1.5.17 for the case that 𝔼[f⁢(X1(m),…,Xn(m))] is monotonically increasing in m.

Proof.

We derive the chain of inequalities as follows

𝔼[f⁢(Y1(m),…,Yn(m))] =∑k≥0𝔼[f⁢(Y1(m),…,Yn(m))|Y(m)=k]⁢Pr⁡[Y(m)=k]
=∑k≥0𝔼[f⁢(X1(k),…,Xn(k))]⁡Pr⁡[Y(m)=k]
≥∑k≥m𝔼[f⁢(X1(k),…,Xn(k))]⁡Pr⁡[Y(m)=k]
≥∑k≥m𝔼[f⁢(X1(m),…,Xn(m))]⁡Pr⁡[Y(m)=k]
=𝔼[f⁢(X1(m),…,Xn(m))]⁡Pr⁡[Y(m)≥m].

The first equality holds from conditional expectation, the second equality holds from theorem 1.5.14, the third holds from nonnegativity of f, the fourth holds from 𝔼[f⁢(X1(m),…,Xn(m))] being monotonically increasing in m.

Similarly, if f is nonnegative and 𝔼[f⁢(X1(m),…,Xn(m))] is monotonically decreasing in m, the following holds

𝔼[f⁢(Y1(m),…,Yn(m))]≥𝔼[f⁢(X1(m),…,Xn(m))]⁡Pr⁡[Y(m)≤m].

By lemma 1.5.12, theorem 1.5.13, and Y(m) being a Poisson random variable of mean μ=m≥1 integer, therefore we prove theorem 1.5.17 for the 𝔼[f⁢(X1(m),…,Xn(m))] being monotonically increasing/decreasing in m. ∎

Corollary 1.5.19 (Corollary 5.11 [MU17]).

Let E be an event whose probability is monotonically increasing or decreasing in the number of balls. If E has probability p in the Poisson case, then E has probability at most 2⁢p in the exact case.

Proof.

Immediately follow from theorem 1.5.17. ∎

Lemma 1.5.20 (Lemma 5.12 [MU17]).

When n balls are thrown independently and uniformly at random into n bins, the max load is at least ln⁡n/ln⁡ln⁡n with probability at least 1−1/n for n sufficiently large.

Proof.

In the Poisson case, there are n independent Poisson random varables {Zi}i∈[1,n] of mean 1.

If Zi≥M for some load M, then

Pr⁡[Zi<M]<1−Pr⁡[Zi=M]=1−1e⁢M!.

Considering all n Poisson random variables, then the probability of all loads being lower than M is

Pr⁡[⋂i∈[1,n]Zi<M]<(1−1e⁢M!)n≤exp⁡(−ne⁢M!).

From corollary 1.5.16 or corollary 1.5.19, we want the probability upper bound to be less than 1/n2, as e⁢n/n2=o⁢(1). By lemma 1.5.4 and relax by sufficiently large n and M by

M!≤e⁢M⁢(Me)M≤M⁢(Me)M,

therefore let M=ln⁡n/ln⁡ln⁡n, with less than 1/n probability in exact case the max load is no greater than M. ∎

Remark 1.5.21.

For n balls and n bins, the maximum load is Θ⁢(log⁡n/log⁡log⁡n) from lemma 1.5.9 and lemma 1.5.20 with probability approaches 1 as n→∞.

Exercise 1.5.22 (Exercise 5.13 [MU17]).

Suppose that we vary the balls-and-bins process as follows. For convenience let the bins be numbered from 0 to n−1. There are log2⁡n players. Each player choose a starting position ℓ←r[0,n−1], then places one ball in each of the bins numbered ℓmodn to ℓ+n/log2⁡n−1modn. Argue that the maximum load in this case is only O⁢(log⁡log⁡n/log⁡log⁡log⁡n) with probability that approaches 1 as n→∞.

Proof.

For the jth player and the ith bin, we introduce an independent 0-1 random variable Xi,j, indicating if the jth player puts ball in the ith bin. Pr⁡[Xi,j=1]=1/log2⁡n, as the jth player starts at most n/log2⁡n bins before the ith bin. Therefore, Xi=∑j∈[1,log2⁡n]Xi,j is the load of the ith bin, and by linearity of expectation, 𝔼[Xi]=∑j𝔼[Xi,j]=1. We can apply Chernoff’s tail bound to upper bound the probability for Xi≥1+δ by

Pr⁡[Xi≥1+δ]≤eδ(1+δ)1+δ.

By union bound, if there exists bins with load exceeding 1+δ, the probability is upper bounded by n⋅eδ/(1+δ)1+δ.

Let t=1+δ be the load bound, then the probability upper bound is n/e⋅(e/t)t. We want to have

limn→∞ne⋅(et)t=0

to bound all of the bin loads. Taking ln on both sides, t⁢ln⁡t−t=ω⁢(ln⁡n), giving only t=O⁢(log⁡n/log⁡log⁡n).

But there are at most log2⁡n players and n balls, such result follow from vanilla remark 1.5.21. The problem lies in that we did not utilize the structure of the player model, giving a loose bound.

Looking at the balls-and-bins structure, we can divide the circle into log2⁡n intervals, each has length n/log2⁡n. Let {Yi}i∈[1,log2⁡n] be independent random variables for number of players in the ith interval, following log2⁡n balls and log2⁡n bins model. An observation is that, for a bin in the ith interval, its load is at most Yi+Yi−1, relaxed by

Yi+Yi−1≤2⁢max⁡(Yi,Yi−1).

Therefore, the max load of a bin is O⁢(Yi).

We continue with Chernoff tail bound for Yi, then union bound over log2⁡n intervals, rather than over all n bins. Since 𝔼[Yi]=1, the probability for existing Yi≥1+δ is log2⁡n⋅eδ/(1+δ)1+δ.

Again we write t=1+δ to be the number of players in an interval, and we want

limn→∞log2⁡ne⋅(et)t=0,

and therefore t⁢ln⁡t−t=ω⁢(log⁡log⁡n). We conclude that t=O⁢(log⁡log⁡n/log⁡log⁡log⁡n), and the load is O⁢(t).

This log⁡n balls and log⁡n bins max load result matches remark 1.5.21. ∎

1.5.5 Recap on Coupon Collector’s Problem

Theorem 1.5.23 (Theorem 5.13 [MU17]).

Let X be the number of coupons observed before obtaining one of each of n types of coupons. Then, for a constant c,

limn→∞Pr⁡[X>n⁢ln⁡n+c⁢n]=1−e−e−c.
Proof.

We can view this problem in balls-and-bins model: If balls are thrown independently and uniformly at random into bins, how many balls are thrown until all bins have at least one ball? We begin with a Poisson approximation, and later demonstrate that the Poisson approximation gives the right answer in the limit.

We begin by Poisson approximation, supposing {Xi}i∈[1,n] independent Poisson random variable of mean ln⁡n+c, then the expected number of balls is m=n⁢ln⁡n+c⁢n. Let E be the event that no bin is empty, and let X=∑i∈[1,n]Xi be the number of balls in bin. Since Pr⁡[Xi=0]=(n⁢ec)−1, then

limn→∞Pr⁡[E]=limn→∞(1−1n⁢ec)n=e−e−c.

Let b=2⁢m⁢ln⁡m. By conditional probability, we have

Pr⁡[E] =Pr⁡[E||X−m|>b]⁢Pr⁡[|X−m|>b]
+Pr⁡[E||X−m|≤b]⁢Pr⁡[|X−m|≤b].
Lemma 1.5.24.

Pr⁡[|X−m|>b]=o⁢(1).

Proof.

We can use the Chernoff bound such that Pr⁡[|X−m|>b]<2⁢exp⁡(−2⁢ln⁡m/3)=2⁢m−2/3=o⁢(1). ∎

Lemma 1.5.25.

|Pr⁡[E||X−m|≤b]−Pr⁡[E|X=m]|=o⁢(1).

Proof.

Since Pr⁡[E∣X=k] is monotonically increasing in k, by conditional probability

Pr⁡[E||X−m|≤b] =∑k∈[−b,b]Pr⁡[E∣X=m+k]⋅Pr⁡[X=m+k∣|X−m|≤b]
≤∑k∈[−b,b]Pr⁡[E∣X=m+b]⋅Pr⁡[X=m+k∣|X−m|≤b]
=Pr⁡[E∣X=m+b].

Therefore, we relax the term by

|Pr⁡[E||X−m|≤b]−Pr⁡[E|X=m]|≤Pr⁡[E∣X=m+b]−Pr⁡[E∣X=m−b],

which is interpreted as: when m−b balls are thrown, there exists empty bins; after m+b balls, all bins are filled.

Let A be the event that m−b balls thrown with empty bins, S be the set for all possible empty bins B⊆[1,n] after m−b initial throws, and FB be the event that B empty bins are filled after another 2⁢b balls. The exact term follows

Pr⁡[E∣X=m+b]−Pr⁡[E∣X=m−b] =Pr⁡[A]⋅∑B∈S(Pr⁡[empty bins ⁢B⊆[1,n]∣A]⋅Pr⁡[FB])
≤∑B∈S(Pr⁡[empty bins ⁢B⊆[1,n]∣A]⋅Pr⁡[FB])
≤maxB∈S⁡Pr⁡[FB].

Since Pr⁡[FB]≤Pr⁡[Fr] for some r∈B by FB⊆Fr, the probability for all empty bins being filled is upper bounded by the probability of one of the empty bins in B being filled, we upper bound Pr⁡[Fr]≤2⁢b/n=o⁢(1) by union bound.

Therefore, we conclude the resulting difference by o⁢(1). ∎

By lemma 1.5.24 and lemma 1.5.25, we conclude that

limn→∞Pr⁡[E] =limn→∞o⁢(1)+(Pr⁡[E∣X=m]+o⁢(1))⋅(1−o⁢(1))
=limn→∞Pr⁡[E∣X=m],

indicating as n→∞, for m balls n bins exact case, all n bins are filled with probability e−e−c. ∎

1.5.6 Hashing and Random Graphs

Exercise 1.5.26 (Exercise 5.16 [MU17]).

We consider another way to obtain Chernoff-like bounds in the settings of balls and bins without using theorem 1.5.15. Consider n balls and n bins model. Let Xi=1 iff the ith bin is empty, and X=∑iXi. Let {Yi}i∈[1,n] be independent Bernoulli random variables with probability (1−1/n)n, and Y=∑iYi.

  • •

    Show that 𝔼[∏i∈[1,k]Xi]≤𝔼[∏i∈[1,k]Yi] for any k≥1.

  • •

    Show that 𝔼[exp⁡(t⁢X)]≤𝔼[exp⁡(t⁢Y)] for any t≥0.

  • •

    Derive a Chernoff bound for Pr⁡[X≥(1+δ)⁢𝔼[X]].

Proof.

Considering the event that first k bins are empty in n balls and n bins model, the probability is (n−k)n/nn. On the other hand, since each Yi are independent, then ∏i∈[1,k]Yi=1 has probability (1−1/n)n⁢k.

Since (1−1/n)k≥1−k/n, then 𝔼[∏i∈[1,k]Xi]≤𝔼[∏i∈[1,k]Yi] for any k≥1.

Expanding the prior claim, for any subsets of indices S⊆[1,n], Pr⁡[∏i∈SXi=1]≤Pr⁡[∏i∈SYi=1]. We expand MGF function in its Taylor expansion, then we derive the following

𝔼[exp⁡(t⁢X)] =𝔼[∑k≥0(t⁢X)kk!]=∑k≥0tkk!⋅𝔼[Xk]=∑k≥0tkk!⋅𝔼[(∑i∈[1,n]Xi)k]
=∑k≥0tkk!⋅∑S⊆[1,n],|S|≤kPr⁡[∏i∈SXi=1]
≤∑k≥0tkk!⋅∑S⊆[1,n],|S|≤kPr⁡[∏i∈SYi=1]=𝔼[exp⁡(t⁢Y)].

Since each Yi are independent, let p=(1−1/n)n, and therefore

𝔼[exp⁡(t⁢Y)]=∏i∈[1,n]𝔼[exp⁡(t⁢Yi)]=(p⋅(et−1)+1)n.

By linearity of expectation, we have 𝔼[X]=∑i∈[1,n]𝔼[Xi]=n⁢p. Therefore, the Chernoff bound is derived as follows

Pr⁡[X≥(1+δ)⁢n⁢p]≤𝔼[exp⁡(t⁢X)]exp⁡((1+δ)⁢n⁢p⁢t)≤𝔼[exp⁡(t⁢Y)]exp⁡((1+δ)⁢n⁢p⁢t)≤(eδ(1+δ)1+δ)n⁢p.

∎

Remark 1.5.27.

This trick in balls-and-bins model is analogous to the Poisson approximation. The spirit is the same: both are replacing dependent counts with independent random variables whose marginal behaviors matches that of the exact model. Poisson approximation captures more than just the expected load per bin, it captures the correct distributional shape and small-count probabilities, and approximate the joint distribution via independence, giving a limit theorem for the exact case. The Bernoulli trick preserves the expected emptiness per bin via independent random variables, allowing Chernoff to be applied, but it is more of a bounding device than a limit theorem.

Remark 1.5.28.

This trick can be extended to m balls and n bins, and be used in Bloom Filter analysis on the number of zeroes (k hash functions, m disallowed passwords, and n bits to store, yielding k⁢m balls and n bins model).

Exercise 1.5.29 (Exercise 5.23 [MU17]).

Bloom filter can be used to estimate set differences. Suppose there are sets X and Y both with n elements. Create Bloom filters for X and Y, using the same number of bits m and the same k hash functions. Determine the expected number of bits where Bloom filters differ as a function of m,n,k, and |X∩Y|.

Proof.

Let A=X∖Z, B=Y∖Z, Z=X∩Y, and |Z|=c. We want to know the probability of some bit being set by only one of A or B, and not by Z. Therefore, we define following events

  • •

    Ei,0 be the event that ith bit set by A not by B,

  • •

    Ei,1 be the event that ith bit set by B not by A,

  • •

    Ei,2 be the event that ith bit not set by Z,

and let {Wi}i∈[1,m] be 0-1 random variables such that Wi=1 if and only if (Ei,0∪Ei,1)∩Ei,2, and W=∑iWi.

Since Ei,0 and Ei,1 are symmetric, WLOG we analyze Ei,0. Assuming hash function set a random bit to 1, then

Pr⁡[Ei,0]=(1−1m)k⁢(n−c)⋅(1−(1−1m)k⁢(n−c)).

On the other hand, not being set by Z for ith bit is event Ei,2, which follow Pr⁡[Ei,2]=(1−1/m)k⁢c.

Therefore, Pr⁡[Wi=1]=2⁢Pr⁡[Ei,0]⁢Pr⁡[Ei,2], and by linearity of expectation,

𝔼[W=∑i∈[1,m]Wi]=2⁢m⁢(1−1m)k⁢n⋅(1−(1−1m)k⁢(n−c)).

∎

Definition 1.5.30.

In Gn,p model we consider all undirected graphs on n distinct vertices, an edge is connected between 2 distinct vertices with probability p, thus a graph with a given set of m edges has probability pm⁢(1−p)(n2)−m. The expected number of edges in the graph is p⁢(n2), and each vertex has expected degree (n−1)⁢p.

In Gn,N model we consider all undirected graphs on n distinct vertices with exact N edges. There are ((n2)N) distinct graphs to select with equal probability.

Remark 1.5.31.

The relation between Gn,p and Gn,N has following properties: Let p=N/(n2), the number of edges in G←rGn,p is concentrated around N. Conditioned on G←rGn,p having N edges, then G is uniform over Gn,N.

Such relation is similar to the one between Poisson approximation and the balls-and-bins model.

Lemma 1.5.32.

The distribution of Gn,p conditioned on the graph sampled has N edges is the same as Gn,N regardless of N.

Lemma 1.5.33.

Let E be an event. If Pr⁡[E]=t in the Gn,p model, then Pr⁡[E]=O⁢(N⁢t) in the Gn,N model where N=p⁢(n2).

Proof.

By the probability lower bounding from conditional probability (trick used in theorem 1.5.15), we have

Pr⁡[E⁢ in ⁢Gn,p] =∑k≥0Pr⁡[E⁢ in ⁢Gn,p∣graph sampled in ⁢Gn,p⁢ has ⁢k⁢ edges]⋅Pr⁡[graph sampled in ⁢Gn,p⁢ has ⁢k⁢ edges]
≥Pr⁡[E⁢ in ⁢Gn,N]⋅Pr⁡[graph sampled in ⁢Gn,p⁢ has ⁢N⁢ edges].

Let M=(1−p)⁢(n2). To lower bound the probability of graph sampled in Gn,p with N edges, the probability follows

Pr⁡[graph sampled in ⁢Gn,p⁢ has ⁢N⁢ edges]=((n2)N)⋅pN⁢(1−p)M=(N+M)!⋅pNN!⋅(1−p)MM!.

By result from corollary 1.5.5, we can lower bound components as follows:

(N+M)! ≥(N+Me)N+M
pNN! ≥pNe⁢N⋅(eN)N =eNe⁢N⋅(N+M)−N
(1−p)MM! ≥(1−p)Me⁢M⋅(eM)M =eMe⁢M⋅(N+M)−M,

The probability is lower bounded by O⁢(N−1), therefore the probability for the event happening in Gn,N is O⁢(N⁢t). ∎

Remark 1.5.34.

Using Stirling bound, then the probability for the event to happen in Gn,N can be improved to O⁢(n⁢t).

Definition 1.5.35.

A graph property is a property that holds for a graph, and all the isomorphisms of the graph. We say a graph property is monotone increasing if whenever the property holds for G=(V,E), it holds for any graph G′=(V′,E′) with E⊆E′. Monotone decreasing property is defined similarly, that whenever the property holds for G=(V,E), it holds for any graph G′=(V′,E′) with E′⊆E.

Lemma 1.5.36 (Lemma 5.14 [MU17]).

For a given monotone increasing graph property, let Pn,N be the probability that the property holds for a graph in Gn,N and Pn,p be the probability that the property holds for a graph in Gn,p. Let p+=(1+ε)⁢N/(n2) and p−=(1−ε)⁢N/(n2) for a constant ε∈(0,1). Then

Pn,p−−e−O⁢(N)≤Pn,N≤Pn,p++e−O⁢(N).
Proof.

The main theme of the proof is by relaxation from conditional probability, then apply Chernoff bound.

Let X be the random variable for the number of edges of a graph that is sampled from Gn,p−. We relax Pn,p− by

Pn,p− =∑k≤NPn,k⋅Pr⁡[X=k]+∑k>NPn,k⋅Pr⁡[X=k]
≤Pn,N⋅Pr⁡[X≤N]+∑k>NPn,k⋅Pr⁡[X=k]
≤Pn,N+Pr⁡[X>N]

The first equality follow from conditional probability, the second inequality holds from monotone increasing property has Pn,N≥Pn,k for all k≤N, and the last inequality holds from bounding valid probability by 1.

Now we bound Pr⁡[X>N] by Chernoff bound, as X is the sum of (n2) independent Bernoulli random variables with probability p−, then

Pr⁡[X>N]=Pr⁡[X>11−ε⁢p−⁢(n2)]<Pr⁡[X>(1+ε)⁢p−⁢(n2)]≤exp⁡(−13⁢ε2⁢p−⁢(n2))=exp⁡(−ε2⁢(1−ε)3⁢N),

as 1/(1−ε)>1+ε for 0<ε<1, which proves the Pn,N≥Pn,p−−e−O⁢(N).

Similarly, let X be the random variable for the number of edges of a graph that is sampled from Gn,p+. Then

Pn,p+ =∑k<NPn,k⋅Pr⁡[X=k]+∑k≥NPn,k⋅Pr⁡[X=k]
≥Pn,N⋅Pr⁡[X≥N]
≥Pn,N−Pr⁡[X<N].

Again by Chernoff bound,

Pr⁡[X<N]=Pr⁡[X<11+ε⁢p+⁢(n2)]<Pr⁡[X<(1−ε2)⁢p+⁢(n2)]≤exp⁡(−ε28⁢p+⁢(n2))=exp⁡(−ε2⁢(1−ε)8⁢N),

as 1/(1+ε)<1−ε/2 for 0<ε<1, which proves the Pn,N≤Pn,p++e−O⁢(N), and we complete the proof. ∎

Remark 1.5.37.

The spirit is similar to the Poisson approximation theorem 1.5.17. In the n balls m bins model, we replace dependent bins with independent m Poisson random variables of mean n/m. In the random graph case, we replace dependent N edges among all possible (n2) edges with each lined up with probability N/(n2) independently.

Lemma 1.5.38.

For a given monotone increasing graph property, let Pn,N and Pn,p be notions follow from lemma 1.5.36. Let N=p⁢(n2), N+=(1+ε)⁢N, and N−=(1−ε)⁢N for a constant ε∈(0,1). Then

Pn,N−−e−O⁢(N)≤Pn,p≤Pn,N++e−O⁢(N).
Proof.

We prove with a similar strategy to lemma 1.5.36.

Let X be the random variable for the number of edges of a graph sampled from Gn,p. X can be seen as the sum of (n2) independent Bernoulli random variables with probability p. By conditional probability,

Pn,p =∑k≤N+Pn,k⋅Pr⁡[X=k]+∑k>N+Pn,k⋅Pr⁡[X=k]
≤Pn,N+⋅Pr⁡[X≤N+]+∑k>N+Pn,k⋅Pr⁡[X=k]
≤Pn,N++Pr⁡[X>N+].

By Chernoff bound, the upper tail of X can be bounded as follows

Pr⁡[X>N+]≤exp⁡(−13⁢ε2⁢N)=exp⁡(−O⁢(N)).

Similarly, again by conditional probability,

Pn,p =∑k<N−Pn,k⋅Pr⁡[X=k]+∑k≥N−Pn,k⋅Pr⁡[X=k]
≥Pn,N−⋅Pr⁡[X≥N−]
≥Pn,N−−Pr⁡[X<N−].

By Chernoff bound, the lower tail bound of X can be bounded as follows

Pr⁡[X<N−]≤exp⁡(−12⁢ε2⁢N)=exp⁡(−O⁢(N)).

Therefore, we complete the proof on both sides. ∎

Exercise 1.5.39 (Exercise 5.19 [MU17]).

An undirected graph on n vertices is disconnected if there exists a set of k<n vertices such that there is no edge between this set and the rest of the graph. Otherwise, the graph is connected. Show that there exists a constant c such that if N≥c⁢n⁢log⁡n then, with probability 1−o⁢(1), G←rGn,N is connected.

Proof.

Let Pn,N be the probability of G←rGn,N being connected, Pn,p be the probability of G←rGn,p being connected, where p=N/(n2). The proof strategy follows: Since connectedness is a monotone increasing graph property, we apply lemma 1.5.36 such that we bound Pn,N by

Pn,p−−exp⁡(−O⁢(N))≤Pn,N≤Pn,p++exp⁡(−O⁢(N)),

where p+=(1+ε)⁢p and p−=(1−ε)⁢p. Suppose Pn,p+ and Pn,p− are both 1−o⁢(1), then we complete the proof.

We continue by analyzing Gn,p model. For disconnected subset, the vertex size ranges in [1,⌊n2⌋] by symmetry. Let E be the event that G←rGn,p being disconnected. Then Pr⁡[E] is union bounded by

Pr⁡[E]≤∑k∈[1,⌊n2⌋](nk)⁢(1−p)k⁢(n−k)=∑k∈[1,⌊n2⌋]ak.

We want to show that Pr⁡[E]=o⁢(1) as n→∞. Observing that

ak+1ak=n−kk+1⋅(1−p)n−2⁢k−1,

then for a fixed k, as n→∞, ak+1/ak→0. Suppose for some K, we have n2⋅(1−p)n−2⁢K−1<1, then {ak}k∈[1,K] are monotone decreasing. We thus separate into 2 cases:

  • •

    ∑k≤Kak≤K⁢a1=K⁢n⁢(1−p)n−1, and the upper bound approaches K⁢n⁢exp⁡(−p⁢(n−1)) as n→∞.

  • •

    ∑k>Kak<2n⁢(1−p)α⁢n2 by binomial coefficients for some α, and the upper bound approaches 0 when n→∞.

Let p=O⁢(log⁡n/n) with a sufficiently large constant, then the former bound approaches 0 when n→∞.

The rest follow from both Pn,p+=Pn,p−=1−o⁢(1) when ε is sufficiently small. Bounding by lemma 1.5.36, then when N≥c⁢n⁢log⁡n we complete the proof. ∎

Theorem 1.5.40 (Theorem 5.15 [MU17]).

Let N=12⁢(n⁢ln⁡n+c⁢n). Then the probability that there are no isolated vertices (vertices with degree 0) in Gn,N converges to e−e−c as n→∞.

Proof.

The main idea is utilizing the balls-and-bins model to model adding edges in the Gn,N model.

We introduce edges to the graph G=(V,E), with |V|=n and E=∅ on initialization.

Repeat ℓ=N+n times, each time toss 2 balls into n bins at random.

  • •

    If they gets into the ith and jth bin, with i≠j, edge (i,j)∉E, and |E|≤N, introduce the edge.

  • •

    Otherwise, take back the 2 balls from the bins.

Conditioning on having N edges, the distribution of the resulting G is equivalent to sampling from Gn,N.

Lemma 1.5.41.

After repeating ℓ times, as n→∞, Pr⁡[|E|=N]=1−o⁢(1).

Proof.

There are 2 mutually exclusive cases that an edge introduction trial get rejected: Either the 2 balls are tossed into the same bin, with probability r0=n/(n+(n2)); or rejected by prior introduction, upper bounded by r1=N/(n2).

Let {Xi}i∈[1,ℓ] be independent 0-1 random variables of probability r=r0+r1, and X=∑iXi. Then X is a random variable upwards relaxing the number of rejections in the edge introduction trials.

Since by linearity of expectation 𝔼[X]=ℓ⁢r=O⁢(log2⁡n), then by Markov/Chernoff concentration inequality, we have Pr⁡[X>n]=o⁢(1), which completes the proof. ∎

Let Ei be the event that G has no isolated vertices after the ith edge introduction trial. Next corollary is immediate.

Corollary 1.5.42.

As n→∞, Pr⁡[Eℓ]=Pr⁡[Eℓ∣|E|=N].

Let Mn,m be the event that n balls and m bins model having no empty bin.

On one hand, Pr⁡[Eℓ] is upper bounded by the 2⁢ℓ balls and n bins model without empty bins, as:

  • •

    Repeated edge introduction does not matter in bin emptiness.

  • •

    2 balls into the same bin means bin filled in the balls-bins model, rather than being rejected in the Gn,N model.

A direct application of theorem 1.5.23 implies that as n→∞, Pr⁡[Eℓ]≤Pr⁡[M2⁢ℓ,n]=e−e−c.

On the other hand, Pr⁡[Eℓ∣|E|=N] is lower bounded by the 2⁢N balls and n bins model with no empty bin, as

  • •

    Repeated edge introduction is allowed in the balls-and-bins model.

  • •

    2 balls tossed into the same bin fills 1 bin rather than 2.

A direct application of corollary 1.5.42 and theorem 1.5.23 implies that as n→∞, Pr⁡[Eℓ]≥Pr⁡[M2⁢N,n]=e−e−c.

Since we have sandwiched Pr⁡[Eℓ]=e−e−c as n→∞, therefore we conclude the proof 111 The proof is inspired by the math stackexchange link. More specifically, I was thinking of sandwiching by Gn,p, but this solution suggested a way of sampling Gn,N graph from the balls-and-bins model, and inspired me sandwiching by different number of balls. . ∎

Theorem 1.5.43.

Let p=(ln⁡n+c)/n. The probability that there is no isolated vertices in Gn,p converges to e−e−c as n→∞.

Proof.

This is immediate after theorem 1.5.40 and lemma 1.5.38. ∎

1.5.7 Hamiltonian Cycles in Random Graphs

Definition 1.5.44.

Let G be an undirected graph. Suppose that a path P=v1,…,vk is a simple path in G, and that (vk,vi) is an edge in G. Then

P=v1,…,vi,vk,vk−1,…,vi+1

is also a simple path, which we refer to as the rotation of P with the rotation edge (vk,vi).

On input a graph G=(V,E) with associated “used/unused-edges” lists for each vertex, the modified Hamiltonian cycle finding algorithm follows:

  • •

    Start with a random vertex as the head of the path.

  • •

    Repeat the following until a Hamiltonian cycle is closed, or the “unused-edges” of the head vertex is empty.

    • –

      Let the current path be P=v1,…,vk with vk being the head.

    • –

      Execute one of the following 3 cases with probabilities specified as follows.

      • *

        With probability 1/n, reverse the path and make v1 the new head.

      • *

        With probability |used-edges⁢(vk)|/n, sample (vk,vi)←rused-edges⁢(vk), rotate P with edge (vk,vi), and let vi+1 be new head (if the edge is (vk,vk−1), take no action).

      • *

        Otherwise, sample (vk,u)←runused-edges⁢(vk). If u is not on the path, make u the new head by vk+1=u; or u=vi, then rotate P by (vk,vi) and make vi+1 the new head (if the edge is (vk,vk−1), take no action).

    • –

      Update “unused-edges” and “used-edges” list accordingly.

We construct a special random graph model similar to Gn,p. Assuming each of the n−1 possible edges connected to a vertex v is initially on the “unused-edges” list for vertex v independently with probability q. We also assume the order of these edges are in random order.

Remark 1.5.45.

One way of looking at it is, before beginning the Hamiltonian cycle finding algorithm, we create the “unused-edges” list for each vertex v by inserting each possible edge (u,v) with probability q. The corresponding graph G is the graph including all edges that were inserted into some “unused-edges” list. But notice that an edge (u,v) could initially be on the “unused-edges” list for v but not for u. The independence among each “unused-edges” list is helpful for analysis onwards.

The following lemma says, regardless of the viewed vertices, the next vertex to view is still uniformly random, if the “unused-edges” list is not empty in the head vertex.

Lemma 1.5.46.

Suppose the modified Hamiltonian cycle algorithm runs on the random graph model as described. Let Vi be the head vertex after the ith time step. Suppose for any vertex u, as long as the ith time step the unused edges list is not empty for the head vertex,

Pr⁡[Vi+1=u∣Vi=vi,Vi−1=vi−1,…,V1=v1]=1n.
Proof.

The first 2 cases are both with probability 1/n to make u new head of path.

For the last case, there are at most p=n−|used-edges⁢(vi)|−1 options for vi’s unused edges, at the ith time step. To make u the new head, u has to be in the previously sampled unused-edges⁢(vk), and the probability follows

Pr⁡[Vi+1=u|⋂j∈[1,i]Vj=vj∩third case]=q⋅∑k∈[0,p−1]((p−1k)⁢qk⁢(1−q)p−1−k⋅1k+1)−(1−q)p−1=1n.

(or actually we can prove by symmetry, that for any possible option, the probability is the same, and it splits up the whole sample space.) Thus we complete the proof. ∎

Now the problem looks exactly like the coupon collector’s problem, that the probability of finding a new vertex to add to the path, when there are k vertices are left to be added, is k/n.

Theorem 1.5.47.

Suppose the input to the modified Hamiltonian cycle algorithm initially has the probability of adding edges to the unused edges list q≥20⁢ln⁡n/n. Then the algorithm managed to find a Hamiltonian cycle in O⁢(n⁢ln⁡n) time steps with probability 1−O⁢(n−1).

Proof.

We start by upper bounding the event ℰ that the algorithm failed to find such cycle, splitting by:

  • •

    The algorithm ran for 3⁢n⁢ln⁡n steps with no empty unused edges list, and failed to close a Hamiltonian cycle.

  • •

    The algorithm drained some unused edges list in the first 3⁢n⁢ln⁡n steps, and failed to close a Hamiltonian cycle.

Let the first event be ℰ1. We relax the second event by lifting the constraint of “failed to close a Hamiltonian cycle”, and we let the relaxed event be ℰ2. We thus have Pr⁡[ℰ]≤Pr⁡[ℰ1]+Pr⁡[ℰ2].

We start with ℰ1 bounding first. Failing to close a Hamiltonian cycle can be considered as either failing to traverse all vertices, or failing to close by traversing back to starting vertex. We model the vertices traversal conditioned on no unused edges list empty by balls-and-bins model in coupon collector’s problem, and let ℰ1,a be the event that all coupons are collected before 2⁢n⁢ln⁡n time steps. By conditional probability, we have

Pr⁡[ℰ1] =Pr⁡[ℰ1∣ℰ1,a]⁢Pr⁡[ℰ1,a]+Pr⁡[ℰ1∣¬ℰ1,a]⁢Pr⁡[¬ℰ1,a]
≤Pr⁡[ℰ1∣ℰ1,a]+Pr⁡[¬ℰ1,a],

where the first term means not closing the Hamiltonian cycle in at least n⁢ln⁡n steps after traversing all vertices, and the second term means the coupon collector’s problem does not stop before 2⁢n⁢ln⁡n steps.

The first term is upper bounded by

Pr⁡[ℰ1∣ℰ1,a]≤(1−1n)n⁢ln⁡n≤1n.

The second term is upper bounded by union bounding over all n vertices not being picked after 2⁢n⁢ln⁡n trials

Pr⁡[¬ℰ1,a]≤n⁢(1−1n)2⁢n⁢ln⁡n≤1n.

Therefore, Pr⁡[ℰ1]≤2/n=O⁢(n−1).

Now we bound Pr⁡[ℰ2]. In this case, either all vertices have at least 10⁢ln⁡n unused edges initially, but some gets hit hard; or some vertices have too few unused edges on initialization. Let ℰ2,a be the event that some vertices have too few unused edges. By conditional probability

Pr⁡[ℰ2] =Pr⁡[ℰ2∣ℰ2,a]⁢Pr⁡[ℰ2,a]+Pr⁡[ℰ2∣¬ℰ2,a]⁢Pr⁡[¬ℰ2,a]
≤Pr⁡[ℰ2∣¬ℰ2,a]+Pr⁡[ℰ2,a].

The first term can be upper bounded by some vertex being visited too often. An unused edges list can be emptied after at least 10⁢ln⁡n visits. Let X be the number of visits, which is upper bounded by a sum of 3⁢n⁢ln⁡n independent Bernoulli trials of probability 1/n. By Chernoff bound,

Pr⁡[X≥10⁢ln⁡n]≤1n2.

By union bounding over all n vertices, the Pr⁡[ℰ2∣¬ℰ2,a]≤1/n.

The second term can be bounded similarly. Let Y be the initial number of unused edges. Then

𝔼[Y]=(n−1)⁢q≥19⁢ln⁡n

for a sufficiently large n. By Chernoff bound for Pr⁡[Y≤10⁢ln⁡n], then union bounding over n vertices, Pr⁡[ℰ2,a]≤1/n.

Therefore, Pr⁡[ℰ]≤4/n=O⁢(n−1), and we complete the proof. ∎

Remark 1.5.48.

The operation of rotating in definition 1.5.44 is derived from [Pós76], which is often referred to as the Pósa’s rotation-extension technique.