1.6 The Probabilistic Method

1.6.1 A few things I should have noted about factorial

We bounded around factorial in corollary 1.5.5. We can derive a tighter lower bound from following lemmas.

Lemma 1.6.1.

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

ln⁡k≥∫k−12k+12ln⁡x⁢d⁢x.
Lemma 1.6.2.
n!≥2⁢n⁢(ne)n.
Proof.

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

∑i∈[1,n]ln⁡i ≥∫12n+12ln⁡x⁢d⁢x=(x⁢ln⁡x−x)|12n+12
=((n+12)⁢ln⁡(n+12)−(n+12))−(12⁢ln⁡12−12)
≥(n+12)⁢ln⁡n−n+12⁢ln⁡2=n⁢ln⁡n−n+12⁢(ln⁡(2⁢n)),

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

Corollary 1.6.3.

By lemma 1.5.4 and lemma 1.6.2, we have

2⁢n⋅(ne)n≤n!≤e⁢n⋅(ne)n⁢ and ⁢1e⁢n⋅(en)n≤1n!≤12⁢n⋅(en)n.
Lemma 1.6.4.

By corollary 1.6.3, we have

(2⁢nn)=Θ⁢(1n⋅22⁢n).
Proof.

Since (2⁢nn)=(2⁢n)!/(n!)2, then we have

(2⁢nn) ≤e⁢2⁢n⋅(2⁢ne)2⁢n⋅(12⁢n⋅(en)n)2=e2⁢n⋅22⁢n
(2⁢nn) ≥2⁢n⋅(2⁢ne)2⁢n⋅(1e⁢n⋅(en)n)2=2e2⁢n⋅22⁢n,

which completes the proof. ∎

Lemma 1.6.5.

For s=O⁢(n), (n−s)!⋅(n+s)!=Θ⁢(1)⋅(n!)2.

Proof.
(n−s)!n!⋅(n+s)!n!=∏i∈[1,s]n−s+in+i=∏i∈[1,s](1−sn+i)=Θ⁢(exp⁡(−s2n))=exp⁡(−Θ⁢(1)).

∎

Corollary 1.6.6.

Immediate from lemma 1.6.5, for s=O⁢(n),

(2⁢nn+s)=Θ⁢(1)⋅(2⁢nn).
Corollary 1.6.7.

Immediate from lemma 1.6.5, for s=O⁢(n),

(2⁢n+sn)⁢(2⁢n−sn)=Θ⁢(1)⋅(2⁢nn)2.
Exercise 1.6.8 (Exercise 6.16.b [MU17]).

Let {Yi}i∈[1,2⁢n] be independent random variables uniform over {0,1}. Show that there exists a positive constant c such that, for sufficiently large n,

Pr⁡[|∑i∈[1,n]Yi−∑i∈[n+1,2⁢n]Yi|>c⁢n]>12.
Proof.

Let Y=∑iYi, A=∑i∈[1,n]Yi, and B=∑i∈[n+1,2⁢n]Yi. Let Et be the event |A−B|>c⁢n when Y=t.

Let k be a positive constant. By conditional probability (similar to lemma 1.5.38),

Pr⁡[|A−B|>c⁢n]≥Pr⁡[|A−B|>c⁢n∣|Y−n|≤k⁢n]−Pr⁡[|Y−n|>k⁢n],

where Pr⁡[|Y−n|>k⁢n]<2⁢exp⁡(−k2/3) by Chernoff bound.

We continue by conditional probability, that

Pr⁡[|A−B|>c⁢n∣|Y−n|≤k⁢n] =∑tPr⁡[Et∣Y=t]⋅Pr⁡[Y=t∣|Y−n|≤k⁢n]
=1−∑tPr⁡[¬Et∣Y=t]⋅Pr⁡[Y=t∣|Y−n|≤k⁢n].

Event ¬Et is equivalent to A∈[(t−c⁢n)/2,(t+c⁢n)/2]=Rt when Y=t. Therefore,

Pr⁡[¬Et∣Y=t] =∑a∈RtPr⁡[A=a∣Y=t]
≤(c⁢n+1)⋅maxa⁡Pr⁡[A=a∣Y=t]
=(c⁢n+1)⋅maxa⁡(na)⁢(nt−a)⁢(2⁢nt)−1=(c⁢n+1)⋅p⁢(a).

By p⁢(a+1)/p⁢(a),

p⁢(a+1)p⁢(a)=(a+1)⁢(n−t+a+1)(n−a)⁢(t−a),

p⁢(a) peaks at a=⌊t2⌋ giving (n⌊t2⌋)2⁢(2⁢nt)−1. On the other hand, by lemma 1.6.4, the following is immediate

p⁢(n2)=(nn2)2⁢(2⁢nn)−1=Θ⁢(1n).

By corollary 1.6.6, for t∈[n−k⁢n,n+k⁢n], we have p⁢(a)=Θ⁢(1n).

Choose c sufficiently small such that Pr⁡[¬Et∣Y=t]≤1/2 for all t∈[n−k⁢n,n+k⁢n], then

∑tPr⁡[¬Et∣Y=t]⋅Pr⁡[Y=t∣|Y−n|≤k⁢n]≤12,

which completes the proof. ∎

Exercise 1.6.9 (Exercise 6.16.c [MU17]).

Let {Yi}i∈[1,2⁢n] be independent random variables uniform over {0,1}, and let {bi}i∈[1,2⁢n] each be either +1 or −1. Show that there exists a positive constant c such that, for sufficiently large n,

Pr⁡[|∑i∈[1,2⁢n]bi⁢Yi|>c⁢n]>12.
Proof.

We claim that either the {bi} are inbalanced, that |B|=|∑ibi|>ℓ⁢n; or they are balanced. WLOG let B>0.

For the inbalanced case, let Z=∑ibi⁢Yi. By linearity of expectation, 𝔼[Z]=B/2. Since {Yi} are independent, by Hoeffding’s bound

Pr⁡[Z≤𝔼[Z]−2⁢n]≤exp⁡(−2⁢(2⁢n)2∑ibi2)=exp⁡(−2),

as ∑ibi2=2⁢n. Since Pr⁡[Z≤𝔼[Z]−2⁢n]≤e−2, then for ℓ≥2⁢(c+2),

Pr⁡[Z≥c⁢n]≥Pr⁡[Z≥𝔼[Z]−2⁢n]>1−e−2>1/2

the inbalanced base is proved.

Now for the balanced case, we reuse the structure and notion in 1.6.8 (the same window argument) that

Pr⁡[¬Et∣Y=t] ≤(c⁢n+1)⋅maxa⁡Pr⁡[A=a∣Y=t]
=(c⁢n+1)⋅maxa⁡(n+B/2a)⁢(n−B/2t−a)⁢(2⁢nt)−1=(c⁢n+1)⋅p⁢(a).

By p⁢(a+1)/p⁢(a),

p⁢(a+1)p⁢(a)=(n+B/2−a)⁢(t−a)(a+1)⁢(n−B/2−t+a+1),

where p⁢(a) peaks at ⌊t⋅2⁢n+B4⁢n⌋.

On the other hand, by corollary 1.6.6 and corollary 1.6.7, the max of p⁢(a) is still Θ⁢(1n), completing the proof. ∎

1.6.2 Basic Counting Argument

Exercise 1.6.10 (Exercise 6.10 [MU17]).

A family of subsets ℱ of [1,n] is called an antichain if there is no pair of sets A and B in ℱ satisfying A⊂B.

  • •

    Let fk be the number of sets in ℱ with size k. Show that

    ∑k∈[0,n]fk⋅(nk)−1≤1.
  • •

    Argue that |ℱ|≤(n⌊n2⌋) for any antichain ℱ.

Proof.

We start choosing a random permutation of [1,n]. Let Xk=1 if the first k numbers in the permutation yield a set in ℱ, and let X=∑i∈[1,n]Xi. Then X is at most 1 by antichain property, as no larger subset containing all prior elements, and X can be 0 as no element in ℱ exists on the random enumeration starting from 0.

Therefore, for a ℱ, when we are iterating over all permutations, if a k sized subset is in ℱ, we will encounter k!⁢(n−k)! permutations containing such subset, and we derive

∑k∈[0,n]fk⋅k!⁢(n−k)!≤n!,

as a permutation can have at most 1 element in ℱ, and the first result is immediate.

Since (nk)≤(n⌊n2⌋) for all k∈[0,n], then

|ℱ|=∑k∈[0,n]fk≤∑k∈[0,n](n⌊n2⌋)⋅fk⋅(nk)−1≤(n⌊n2⌋).

∎

Remark 1.6.11.

This is a result from [Spe28] with a Lubell [Lub66] flavored proof.

Another way of seeing it is, a k sized subset in ℱ appears in a random permutation over [1,n] with probability k!⁢(n−k)!/n!=(nk)−1. By linearity of expectation,

𝔼[X]=∑k∈[0,n]𝔼[Xk]=∑k∈[0,n]fk(nk).

On the other hand, X is a 0-1 random variable, hence 𝔼[X]≤1, which completes the proof.

1.6.3 The Expectation Argument and Derandomization by Conditional Expectation

Lemma 1.6.12 (The Expectation Argument).

For random variable X with 𝔼[X]=μ, Pr⁡[X≥μ]>0 and Pr⁡[X≤μ]>0.

Lemma 1.6.13.

Let {Xi}i∈[1,n] be 0-1 random variables, X=∑iXi with 𝔼[X]=m⋅2−k for some integer m≥1 and k≥0. Then for all X<𝔼[X], X≤𝔼[X]−2−k; for all X>𝔼[X], X≥𝔼[X]+2−k.

Lemma 1.6.14.

Let {Xi}i∈[1,n] be 0-1 random variables, X=∑iXi with 𝔼[X]=m⋅2−k for some integer m≥1 and k≥0. Then

Pr⁡[X≥𝔼[X]] ≥12k⁢(n−𝔼[X])+1,
Pr⁡[X≤𝔼[X]] ≥12k⁢𝔼[X]+1.
Proof.

Let p=Pr⁡[X≥𝔼[X]]. By conditional expectation and lemma 1.6.13,

𝔼[X] =∑i<𝔼[X]i⁢Pr⁡[X=i]+∑i≥𝔼[X]i⁢Pr⁡[X=i]
≤(𝔼[X]−2−k)⁢(1−p)+n⁢p,

yielding p≥1/(2k⁢(n−𝔼[X])+1).

Let p=Pr⁡[X≤𝔼[X]]. By conditional expectation and lemma 1.6.13,

𝔼[X] =∑i≤𝔼[X]i⁢Pr⁡[X=i]+∑i>𝔼[X]i⁢Pr⁡[X=i]
≥(𝔼[X]+2−k)⁢(1−p),

yielding p≥1/(2k⁢𝔼[X]+1). ∎

Exercise 1.6.15 (Exercise 6.1 [MU17]).

Consider an SAT instance with m clauses and each clause has exactly k literals. Give a Las Vegas algorithm that finds an assignment satisfying at least m⁢(1−2−k) clauses, and its expected runtime. Give a derandomization of the randomized algorithm using the method of conditional expectation.

Proof.

For a k-literal SAT clause, it is satisfied with probability 1−2−k. Let Xi be the 0-1 random variable indicating if the ith clause is satisfied, and X=∑iXi be the random number of satisfied clauses. By linearity of expectation, 𝔼[X]=m⁢(1−2−k).

The Las Vegas algorithm searching for assignment satisfying at least m⁢(1−2−k) clauses works by keep sampling assignments in O⁢(k⁢m) time, and checks if the assignment satisfies sufficient number of clauses in O⁢(k⁢m) time.

By lemma 1.6.14, Pr⁡[X≥𝔼[X]]≥(2k⁢(m−𝔼[X])+1)−1.

The expected number of sampling is at most 2k⁢(m−𝔼[X])+1, and the expected runtime is O⁢(k⁢m⁢2k⁢(m−𝔼[X])).

Let there be n=O⁢(k⁢m) variables for the SAT instance, σ be a random permutation of xi, and xi be the choice of the ith variable. The derandomized algorithm from conditional expectation wants to prove

𝔼[X]≤𝔼[X∣x1,…,xn],

the right hand side is the number of satisfied clauses after all xi are decided. We prove by induction as follows.

The base case 𝔼[X]=𝔼[X∣x1] is immediate by symmetry.

The intermediate step 𝔼[X∣x1,…,xi]≤𝔼[X∣x1,…,xi+1] can be shown by conditional expectation, as

𝔼[X∣x1,…,xi]=12⁢∑xi+1∈{0,1}𝔼[X∣x1,…,xi+1]≤maxxi+1∈{0,1}⁢𝔼[X∣x1,…,xi+1].

We can greedily choose the next xi+1 that satisfies more clauses.

The n step greedy algorithm suffices to find an assignment satisfying at least m⁢(1−2−k) clauses by our analysis. ∎

Exercise 1.6.16 (Exercise 6.2 [MU17]).

Prove that for every integer n, there exists a 2-coloring of the edges of Kn so that the total number of monochromatic K4 is at most (n4)⁢2−5, and show the following

  • •

    A randomized algorithm to find a coloring with at most (n4)⁢2−5 monochromatic K4 in expected poly time in n.

  • •

    A deterministic polynomial time algorithm to find such a coloring by derandomization.

Proof.

There are (n4) copies of K4 in a Kn, and a K4 is 2-colored monochromatic with probability 2−5.

Let Xi be the 0-1 random variable indicating the ith K4 being monochromatic, and X=∑iXi be the number of monochromatic K4 in Kn. By linearity of expectation, 𝔼[X]=(n4)⁢2−5. Hence, the existence of 2-coloring with at most (n4)⁢2−5 monochromatic K4 is immediate by the expectation argument.

We can keep randomly sampling 2-coloring Kn until we see at most 𝔼[X] copies of monochromatic K4.

By lemma 1.6.14, Pr⁡[X≤𝔼[X]]≥(25⁢𝔼[X]+1)−1.

The expected sampling time is at most 25⁢𝔼[X]+1, and expected runtime is O⁢((n4)2)=O⁢(n8).

Let xi be the ith edge’s color choice among all N=(n2) edges. The derandomized algorithm wants to show

𝔼[X]≥𝔼[X∣x1,…,xN],

right hand side is the number of monochromatic K4 after fixing all vertices’ colors. We prove by induction as follows.

The base case 𝔼[X]=𝔼[X∣x1] is immediate by symmetry.

The intermediate step 𝔼[X∣x1,…,xi]≥𝔼[X∣x1,…,xi+1] can be shown by conditional expectation, as

𝔼[X∣x1,…,xi]=12⁢∑xi+1∈{0,1}𝔼[X∣x1,…,xi+1]≥minxi+1∈{0,1}⁢𝔼[X∣x1,…,xi+1].

We can greedily choose the next xi+1 that bring less monochromatic K4.

The N step greedy algorithm suffices to 2-color Kn with at most (n4)⁢2−5 monochromatic K4 by our analysis. ∎

Remark 1.6.17.

This appears in The Probabilistic Method [AS16], and uses the “pessimistic estimator” idea [Rag88].

Exercise 1.6.18 (Exercise 6.3 [MU17]).

Given a n-vertex undirected graph, consider the following method of generating an independent set. Given a permutation σ of V, define S⁢(σ)⊂V as follows: for each vertex i, i∈S⁢(σ) if and only if no neighbor j of i precedes i in the permutation σ.

  • •

    Show 𝔼[|S⁢(σ)|]=∑i1/(di+1), where {di}i∈[1,n] denotes the degree of vertices.

  • •

    Prove that G has an independent set of size at least ∑i1/(1+di).

Proof.

Given a random σ, the resulting S⁢(σ) has each vertex with no neighbors, which is an independent set.

Let {Xi}i∈[1,n] be 0-1 random variables indicating if the ith vertex is the first among all its neighbors, and X=∑iXi is the random variable for |S⁢(σ)|. The ith vertex is the first among all di neighbors and itself with probability 1/(1+di). Therefore, by linearity of expectation, 𝔼[X]=∑i1/(1+di).

The existence of an independent set at least ∑i1/(1+di) large is immediate by the expectation argument. ∎

Exercise 1.6.19 (Exercise 6.5 [MU17]).

We have shown using the probabilistic method that, if a graph G has n nodes and m edges, then there exists a partition of the n nodes into 2 sets such that at least m/2 edges cross the partition. Improve this result slightly: show that there exists a partition such that at least m⁢n/(2⁢n−1) edges cross the partition.

Proof.

The m/2 result derive from 2-coloring the vertices each with probability 1/2, and same color vertices goes to the same set. In this way, edges with two ends colored differently are included in the cut, with a probability of 1/2. Existence of cut with at least m/2 edges is immediate by linearity of expectation and the expectation argument.

On the other hand, n vertices can be partitioned into sets with ⌊n2⌋ and ⌈n2⌉ vertices each, and improve by the expectation argument. Let the event of choosing 2 vertices with different colors be E, the probability is

Pr⁡[E]=2⁢⌊n2⌋⁢⌈n2⌉n⁢(n−1).
  • •

    When n even, the probability is n/(2⁢n−2)>n/(2⁢n−1).

  • •

    When n odd, the probability is (n+1)/2⁢n>n/(2⁢n−1).

By linearity of expectation, the expected size of the cut is m⁢Pr⁡[E]≥m⁢n/(2⁢n−1). Hence, the existence of a cut with at least m⁢n/(2⁢n−1) is immediate by the expectation argument. ∎

Exercise 1.6.20 (Exercise 6.6 [MU17]).

A k-cut is a partition of the vertices into k disjoint sets, and the value of a cut is the weight of all edges crossing from one of the k sets to another. Show that any graph G with m edges has a k-cut with value at least (k−1)⁢m/k. Show how to use derandomization to deterministically find such a cut.

Proof.

We assign one out of the k colors to each of the n vertices with probability 1/k. The probability of 2 vertices having same color is 1/k, and therefore an edge being included into a k-cut has probability (k−1)/k.

By linearity of expectation, the expected k-cut size is m⁢(k−1)/k. Hence, the existence of k-cut with size at least m⁢(k−1)/k is immediate by the expectation argument.

When it comes to the derandomized deterministic algorithm for finding a k-cut that is larger than m⁢(k−1)/k, we let {Si}i∈[1,k] be the sets of partitioned vertices, and we write C⁢({Si}i∈[1,k]) for size of the k-cut. We pick an arbitrary emulation of all vertices {vi}i∈[1,n], and write {xi}i∈[1,n] for each vertex’s color choice. We prove by induction for

𝔼[C⁢({Si}i∈[1,k])]≤𝔼[C⁢({Si}i∈[1,k])∣x1,…,xn],

where the right hand side is the k-cut size determined by the derandomized algorithm, where the color choices are {xi}i∈[1,n], hence the algorithm gives a cut whose size is at least 𝔼[C⁢({Si}i∈[1,k])]=m⁢(k−1)/k.

The base case 𝔼[C⁢({Si}i∈[1,k])]≤𝔼[C⁢({Si}i∈[1,k])∣x1] is immediate by symmetry.

The intermediate step

𝔼[C⁢({Si}i∈[1,k])∣x1,…,xi]≤𝔼[C⁢({Si}i∈[1,k])∣x1,…,xi+1]

can be shown by conditional expectation, that

𝔼[C⁢({Si}i∈[1,k])∣x1,…,xi] =1k⁢∑xi+1∈[1,k]𝔼[C⁢({Si}i∈[1,k])∣x1,…,xi+1]
≤maxxi+1∈[1,k]⁢𝔼[C⁢({Si}i∈[1,k])∣x1,…,xi+1].

In fact, we greedily find the next xi+1 without computing all conditional expectations on xi+1’s choice. We choose the xi+1 such that vi+1 contribute most edges to the k-cut. Equivalently, we put vi+1 to the partition with the fewest vi+1’s colored neighbors, such that vi+1 introduces most k-cut edges with colored neighbors.

This n steps greedy searching algorithm suffices to determine a k-cut at least m⁢(k−1)/k large by our analysis. ∎

Exercise 1.6.21 (Exercise 6.9 [MU17]).

A tournament is a graph on n vertices with exactly one directed edge between each pair of vertices. If vertices represent players, then each edge can be thought of as the result of a match between the two players: the edge points to the winner. A ranking is an ordering of the n players from best to worst (ties are not allowed). Given the outcome of a tournament, one might wish to determine a ranking of the players. A ranking is said to disagree with a directed edge from y to x if y is ahead of x in the ranking.

  • •

    Prove that, for every tournament, there exists a ranking that disagrees with at most 50% of the edges.

  • •

    Prove that, for sufficiently large n, there exists a tournament such that every ranking disagrees with at least 49% of the edges in the tournament.

Proof.

Fix a tournament, and let Xi be the 0-1 random variable indicating if a random ranking disagrees with the ith of all (n2) edges of the tournament, then X=∑iXi is the total number of disagreement.

For any unordered pair (x,y), each ordering is equally likely in a random ranking. Therefore, Pr⁡[Xi=1]=1/2. By linearity of expectation,

𝔼[X]=∑i𝔼[Xi]=12⁢(n2).

By the expectation argument, there exists a ranking disagreeing at most 50% of the edges, proving the first part.

Fix a ranking. Let Y=∑jYj be the random variable for the number of disagreement with a random tournament, and Yj be the 0-1 random variable indicating if the ranking disagrees with the jth edge of the random tournament.

Let the fixed ranking be the kth among all n! ranking, and let Ek be the event that the fixed kth ranking has at most 49% of disagreement against a random tournament, namely Y≤(1−δ)⁢𝔼[Y], where δ=1/50. Since {Yj} are independent, we can use concentration inequality like Chernoff bound to upper bound the lower tail of Y as follows

Pr⁡[Y≤(1−δ)⁢𝔼[Y]]≤exp⁡(−δ2⁢μ/2)=exp⁡(−1502⋅12⁢(n2)⋅12).

Union bounding over all rankings yields

Pr⁡[⋃k∈[1,n!]Ek]≤∑k∈[1,n!]Pr⁡[Ek]=n!⋅exp⁡(−11002⁢(n2))≤nn⋅exp⁡(−11002⁢(n2))=exp⁡(n⁢ln⁡n−11002⁢(n2)),

and the bound is less than 1 if n is sufficiently large. Thus, for a tournament, the probability of existing a ranking permutation with at most 49% disagreement is strictly less than 1. Hence,

Pr⁡[⋂k∈[1,n!]¬Ek]=1−Pr⁡[⋃k∈[1,n!]Ek]>0.

∎

1.6.4 Sample and Modify

Exercise 1.6.22 (Exercise 6.7 [MU17]).

A Hypergraph H=(V,E), where V is the set of vertices and E is the set of hyperedges, and every hyperedge in E is a subset of V. In particular, r-uniform hypergraph is one where the size of each hyperedge is r. A standard graph is a 2-uniform hypergraph. A dominanting set in a hypergraph H is a set of vertices S⊂V such that e∩S≠∅ for every e∈E, namely S hits every hyperedge in H.

Let |V|=n and |E|=m, show that there is a dominanting set S with size at most n⁢p+(1−p)r⁢m for 0≤p≤1.

Proof.

Given a hypergraph H=(V,E) with |V|=n and |E|=m, we first sample across V with each vertices to be chosen with probability p, then check if any hyperedges are not covered, choose a vertex from each of the hyperedge. The sampling stage has expected chosen vertices n⁢p, leaving expected unchosen hyperedges m⁢(1−p)r to be fixed. ∎

Exercise 1.6.23 (Exercise 6.8 [MU17]).

Prove that, for every integer n, there is a way to 2-color the edges of Kx such that there is no monochromatic cliques of size k when

x=n−(nk)⁢21−(k2).
Proof.

We start 2-coloring Kn, keep removing vertices and attached edges until there is no monochromatic Kk.

Let each edge in Kn be 2-colored with probability 1/2, and let Xi be the 0-1 random variable indicating the ith Kk being monochromatic. There are (nk) Kk’s in a Kn, hence X=∑iXi is the number of monochromatic Kk’s in the Kn.

For a Kk, the probability of being monochromatic is 21−(k2) as it can be one of 2 colors. By linearity of expectation,

𝔼[X]=∑i𝔼[Xi]=(nk)⁢21−(k2).

By expectation argument, there exists a 2-coloring such that X≤𝔼[X].

To modify up to no monochromatic Kk, we can remove a vertex and the attached edges in each Kk, therefore we need to remove at most X vertices from Kn. Since there exists a 2-coloring for Kn containing at most 𝔼[X] Kk’s, then there exists a 2-coloring with no monochromatic Kk for Km that m≥n−𝔼[X].

“no monochromatic Kk” is a monotonely decreasing graph property, therefore any subgraph of such 2-colored Km has this property. Therefore, a Kx in this Km has no monochromatic Kk, which completes the proof. ∎

1.6.5 The Second Moment Method and the Conditional Expectation Inequality

Theorem 1.6.24 (The Second Moment Method (Chebyshev’s version)).

Let X be a random variable, then

Pr⁡[X=0]≤Var⁢[X]𝔼[X]2.
Proof.

Since

Pr⁡[X=0]≤Pr⁡[|X−𝔼[X]|≥𝔼[X]]≤Var⁢[X]𝔼[X]2,

which is immediate by Chebyshev’s inequality. ∎

Lemma 1.6.25.

For integer valued non-negative random variable X, Pr⁡[X>0]≤𝔼[X] by Markov’s inequality.

Theorem 1.6.26 (Cauchy-Schwarz).

For random variables X and Y (that may not be independent),

𝔼[XY]2≤𝔼[X2]⋅𝔼[Y2].
Proof.

Let Z=X−t⋅Y, then the second moment of Z is

𝔼[Z2]=𝔼[X2]+t2⋅𝔼[Y2]−2⁢t⋅𝔼[X⁢Y]≥0,

which holds for any t. Minimizing over t, and we have 𝔼[X2]⋅𝔼[Y2]≥𝔼[XY]2. ∎

Corollary 1.6.27.

For random variable X with 𝔼[X]≥0, 0≤t≤𝔼[X], and 1t=1 if and only if X≥t, by theorem 1.6.26

Pr⁡[X≥t]≥𝔼[X⋅1t]2𝔼[X2].
Theorem 1.6.28 (The Second Moment Method (Cauchy-Schwarz’s version)).

For random variable X≥0,

𝔼[X]≥Pr⁡[X>0]≥𝔼[X]2𝔼[X2].
Proof.

Let 1+=1 if and only if X>0, then by theorem 1.6.26 and corollary 1.6.27,

𝔼[X2]𝔼[1+2]≥𝔼[X2]Pr[X>0]≥𝔼[X⋅1+]2≥𝔼[X]2,

and the last inequality holds by non-negativity of X. ∎

Remark 1.6.29.

A weaker version of theorem 1.6.28 is in 1.3.10. We can relax non-negative X to 𝔼[X]≥0.

Theorem 1.6.30 (Paley-Zygmund).

For random variable X≥0 with finite 𝔼[X2], and 0≤α<1. Then

Pr⁡[X≥α⁢𝔼[X]]≥(1−α)2⋅𝔼[X]2𝔼[X2].
Proof.

Let 1α=1 if and only if X≥α⁢𝔼[X], and 1α‾=1 if and only if X<α⁢𝔼[X], then

𝔼[X] =𝔼[X⋅1α]+𝔼[X⋅1α‾]
≤𝔼[X⋅1α]+α⋅𝔼[X],

and therefore 𝔼[X⋅1α]≥(1−α)⋅𝔼[X]. By theorem 1.6.26 and corollary 1.6.27, we have

𝔼[X⋅1α]2≤𝔼[X2]⋅𝔼[1α]=𝔼[X2]⋅Pr[X≥α𝔼[X]].

Hence, the result is immediate by

Pr⁡[X≥α⁢𝔼[X]]≥𝔼[X⋅1α]2𝔼[X2]≥(1−α)2⋅𝔼[X]2𝔼[X2].

∎

Remark 1.6.31.

The theorem 1.6.30 can be relaxed from non-negative X to 𝔼[X]≥0.

Exercise 1.6.32 (Exercise 6.11 [MU17]).

Prove a threshold for the existence of triangles in the Gn,p. Let {Xi} each be the random value for the ith triangle appearing in the graph among the (n3) triplets of vertices, and let X=∑iXi.

  • •

    Show 𝔼[X], and show if p⁢n→0, then Pr⁡[X>0]→0.

  • •

    Show Var⁢[Xi]≤p3.

  • •

    Show that Cov⁢[Xi,Xj]=p5−p6 for O⁢(n4) pairs of triangle triplets i≠j, otherwise 0.

  • •

    Show Var⁢[X]=O⁢(n3⁢p3+n4⁢(p5−p6)).

  • •

    Show if p⁢n→∞ then Pr⁡[X=0]→0.

Proof.

By linearity of expectation, 𝔼[X]=(n3)⁢p3=O⁢(n3⁢p3). If p⁢n→0, then 𝔼[X]→0.

For variance, we have Var[Xi]=𝔼[Xi2]−𝔼[Xi]2=p3−p6≤p3.

For covariance, when the triplets overlap up to 1 vertex, no edges are shared, and 𝔼[Xi⁢Xj]=𝔼[Xi]⁢𝔼[Xj], hence Cov⁢[Xi,Xj]=0. Otherwise, when 2 vertices are shared, 𝔼[Xi⁢Xj]=p5, and there are in total (n2;1;1) csaes.

Therefore, the variance for X is derived as

Var⁢[X] =∑iVar⁢[Xi]+∑i≠jCov⁢[Xi,Xj]=(n3)⁢(p3−p6)+(n2;1;1)⁢(p5−p6)
=O⁢(n3⁢p3+n4⁢(p5−p6)).

When p⁢n→∞, by theorem 1.6.24, Pr⁡[X=0]≤O⁢((p⁢n)−1)→0. ∎

Exercise 1.6.33 (Exercise 6.12 [MU17]).

Use 1.3.1 to derive the variance of the number of K4 in Gn,p.

Proof.

Let {Xi} be the 0-1 random variable for the existence of the ith K4 among all possible (n4) K4, and let X=∑iXi. By 1.3.1,

𝔼[X2]=∑i𝔼[X∣Xi=1]⁢Pr⁡[Xi=1].

We know Pr⁡[Xi=1]=p6, and among all (n4) possible K4, if Xi=1,

  • •

    If there are no vertex overlap, then (n−44) K4 with probability p6.

  • •

    If there is 1 vertex overlapped, then (n−43)⁢(41) K4 with probability p6.

  • •

    If there are 2 vertices overlapped, then (n−42)⁢(42) K4 with probability p5.

  • •

    If there are 3 vertices overlapped, then (n−41)⁢(43) K4 with probability p3.

  • •

    If there are 4 vertices overlapped, then it has to be ith K4 with probability 1.

By summation,

𝔼[X∣Xi]=(n−44)⁢p6+(n−43)⁢(41)⁢p6+(n−42)⁢(42)⁢p5+(n−41)⁢(43)⁢p3+1,

therefore,

𝔼[X2] =(n4)⁢p6⁢((n−44)⁢p6+(n−43)⁢(41)⁢p6+(n−42)⁢(42)⁢p5+(n−41)⁢(43)⁢p3+1)
=(n4;4)⁢p12+(n3;3;1)⁢p12+(n2;2;2)⁢p11+(n3;1;1)⁢p9+(n4)⁢p6,

hence

Var⁢[X] =((n4;4)+(n3;3;1)−(n4)2)⁢p12+(n2;2;2)⁢p11+(n3;1;1)⁢p9+(n4)⁢p6
=O⁢(n7⁢p12)+O⁢(n6⁢p11)+O⁢(n5⁢p9)+O⁢(n4⁢p6).

When p=o⁢(n−2/3), by lemma 1.6.25, that Pr⁡[X≥1]≤𝔼[X]=o⁢(1).

When p=ω⁢(n−2/3), by theorem 1.6.24 and 𝔼[X]2=O(n8p12)=ω(1), we have

Pr⁡[X=0]≤Var⁢[X]𝔼[X]2=o⁢(1).

∎

Theorem 1.6.34 (Conditional Expectation Inequality).

Let {Xi}i∈[1,n] be 0-1 random variables, and X=∑iXi. Then

Pr⁡[X>0]≥∑i∈[1,n]Pr⁡[Xi=1]𝔼[X∣Xi=1].
Proof.

Let Y=1/X when X≠0, and 0 otherwise. Then 𝔼[X⁢Y]=Pr⁡[X>0], and

𝔼[X⁢Y] =∑i∈[1,n]𝔼[Y∣Xi=1]⁢Pr⁡[Xi=1]
≥∑i∈[1,n]Pr⁡[Xi=1]𝔼[X∣Xi=1],

where the first equality holds from 1.3.1, and the last inequality holds from theorem 1.2.5. ∎

Remark 1.6.35.

Previous 1.6.33 p=ω⁢(n−2/3) case can be solved with theorem 1.6.34 by

Pr⁡[X>0] ≥∑iPr⁡[Xi=1]𝔼[X∣Xi=1]
=(n4)⁢p6(n−44)⁢p6+(n−43)⁢(41)⁢p6+(n−42)⁢(42)⁢p5+(n−41)⁢(43)⁢p3+1.

When p=ω⁢(n−2/3), both (n4)⁢p6 and (n−44)⁢p6 are ω⁢(1), while the others are o⁢(1), proving the second part of the proof.

Exercise 1.6.36 (Exercise 6.13 [MU17]).

Consider the problem of whether graphs in Gn,p have Kk of constant size k. Suggest a threshold function and generalize the argument for K4 using either theorem 1.6.24 or theorem 1.6.34, to prove that your threshold function is correct for K5.

Proof.

We reuse notions in 1.6.33, let Xi be the random variable for the existence of the ith Kk in Gn,p, and let X=∑iXi. We guess the threshold p=n−2/(k−1), which balances both the dominanting numerator and denumerator terms in theorem 1.6.34, and convert 𝔼[X]=(nk)⁢pk⁢(k−1)/2=O⁢(nk⁢pk⁢(k−1)/2) into constant for lemma 1.6.25.

When p=o⁢(n−1/2), by linearity of expectation, 𝔼[X]=(n5)⁢p10=o⁢(1). By lemma 1.6.25, Pr⁡[X>0]≤𝔼[X]=o⁢(1).

When p=ω⁢(n−1/2), we apply the theorem 1.6.34. Among all (n5) possible K5, conditioned that Xi=1,

  • •

    If there are no vertex overlap, then (n−55) K5 with probability p10.

  • •

    If there is 1 vertex overlapped, then (n−54)⁢(51) K5 with probability p10.

  • •

    If there are 2 vertices overlapped, then (n−53)⁢(52) K5 with probability p9.

  • •

    If there are 3 vertices overlapped, then (n−52)⁢(53) K5 with probability p7.

  • •

    If there are 4 vertices overlapped, then (n−51)⁢(54) K5 with probability p4.

  • •

    If there are 5 vertices overlapped, then it has to be the ith K5 with probability 1.

By summation,

𝔼[X∣Xi=1]=(n−55)⁢p10+(n−54)⁢(51)⁢p10+(n−53)⁢(52)⁢p9+(n−52)⁢(53)⁢p7+(n−51)⁢(54)⁢p4+1.

Since (n−55)⁢p10 and (n5)⁢p10 are ω⁢(1), while all other terms are o⁢(1), therefore by theorem 1.6.34, Pr⁡[X>0]→1. ∎

Exercise 1.6.37 (Exercise 6.14 [MU17]).

Consider G∈Gn,p with p=c⁢ln⁡n/n. Use theorem 1.6.24 or theorem 1.6.34 to prove that if c<1 then, for any constant ε>0 and for n sufficiently large, the graph has isolated vertices with probability at least 1−ε.

Proof.

Let Xi be random variable for the ith vertex being isolated in the graph, and X=∑iXi.

By theorem 1.6.34, among n vertices, conditioned that Xi=1,

  • •

    If a vertex is not the ith vertex, it has probability (1−p)n−2 to be isolated.

  • •

    Otherwise, the ith vertex is isolated with probability 1 by conditioning.

By summing,

limn→∞𝔼[X∣Xi=1]=limn→∞1+(n−1)⁢(1−p)n−2=1+nnc.

Since Pr⁡[Xi=1]=(1−p)n−1, which is 1/nc as n→∞, therefore by theorem 1.6.34,

limn→∞Pr⁡[X>0]≥n/nc1+n/nc=nnc+n,

which approaches 1 if c<1. ∎

Exercise 1.6.38 (Exercise 6.15 [MU17]).

Consider a graph in Gn,p where p=1/n. Let X be the number of triangles in the graph. Show that

Pr⁡[X≥1]≤16,

and that

limn→∞Pr⁡[X≥1]≥17.
Proof.

There are (n3) triangles in Kn, while a triangle exists with probability p3. Let {Xi} be the set of 0-1 random variables indicating if the ith triangle exists in the graph, then X=∑iXi. By linearity of expectation,

𝔼[X]=∑i𝔼[Xi]=(n3)⁢p3=(n−1)⁢(n−2)6⁢n2≤16.

On the other hand, by lemma 1.6.25

𝔼[X]=∑x∈[0,(n3)]x⁢Pr⁡[X=x]≥∑x∈[1,(n3)]Pr⁡[X=x]=Pr⁡[X≥1],

which completes the proof for the first part.

On the other hand, by theorem 1.6.34 we have

limn→∞Pr⁡[X≥1] ≥limn→∞∑i∈[1,(n3)]Pr⁡[Xi=1]𝔼[X∣Xi=1]
=limn→∞(n3)⁢p3𝔼[X∣Xi=1].

For all (n3) possible triangles,

  • •

    If there are no vertex overlap, then (n−33) triangles with probability p3.

  • •

    If there are 1 vertex overlap, then (n−32)⁢(31) triangles with probability p3.

  • •

    If there are 2 vertex overlap, then (n−31)⁢(32) triangles with probability p2.

  • •

    If there are 3 vertex overlap, then 1 triangle with probability 1.

Summing, we have

𝔼[X∣Xi] =∑j∈[1,(n3)]𝔼[Xj∣Xi=1]
=1+(n−31)⁢(32)⁢p2+(n−32)⁢(31)⁢p3+(n−33)⁢p3.

When n→∞, (n3)⁢p3→1/6 and 𝔼[X∣Xi=1]→7/6, which proves the second part. ∎

Remark 1.6.39.

We attempted 1.6.8 from theorem 1.6.30, which is inspired by [AS16] to use the second/fourth moment method, just to avoid the bounding over binomial coefficients, but it did not bound as good.

Let {Yi}i∈[2⁢n] be independent Bernoulli trials from even coins, {Zi}i∈[n] each be Yi−Yi+n, and Z=∑iZi. Since Z is symmetric over 0, then event |Z|>c⁢n is equivalent to Z2>c′⁢n.

For random variable Z2, we want to prove Pr⁡[Z2>c′⁢n]≥1/2 for some constant c′>0, which fits theorem 1.6.30:

  • •

    The second moment is 𝔼[Z2]=∑i𝔼[Zi2]=n/2.

  • •

    The fourth moment is 𝔼[Z4]=∑i𝔼[Zi4]+∑i≠j𝔼[Zi2⁢Zj2]=∑i𝔼[Zi4]+∑i≠j𝔼[Zi2]⁢𝔼[Zj2]=n/2+(n2)⁢(42)/4.

Therefore, even when Pr⁡[Z2>0]<1/3 by Paley-Zygmund theorem 1.6.30, which is too loose.

1.6.6 Lovász Local Lemma

The symmetric Lovász Local Lemma requires that the bad events are all upper bounded by a probability p, and each bad event depends on at most d others.

By definition, an event En+1 is mutually independent of {Ei}i∈[1,n], if for any subset S⊆[1,n],

Pr⁡[En+1|⋂i∈SEi]=Pr⁡[En+1].

Onwards, we denote ES for ⋂i∈SEi, and E‾S for ⋂i∈S¬Ei.

Definition 1.6.40 (Dependency Graph).

A dependency graph for events {Ei} is a graph G=(V,E), such that Ei is independent of the events {Ej∣(i,j)∉E}. The degree of the dependency graph is the maximum degree of any vertex in the graph.

Lemma 1.6.41 (Symmetric Lovász Local Lemma [EL75]).

Let {Ei}i∈[1,n] be a set of events, and the following holds:

  • •

    Pr⁡[Ei]≤p for all i∈[1,n],

  • •

    The degree of the dependency graph given by {Ei} is at most d,

  • •

    4⁢d⁢p≤1,

then Pr⁡[E‾[1,n]]>0.

Proof.

The proving strategy is proving by induction the following lemma for all possible S⊆[1,n].

Lemma 1.6.42.

For all S⊆[1,n] with k∉S, we have both following being true

Pr⁡[Ek|E‾S]≤2⁢p⁢ and ⁢Pr⁡[E‾S]≥(1−2⁢p)|S|.
Proof.

We prove by induction over all possible |S|.

When |S|=0, this is vacuously true.

When |S|=1, let S={i}. Then Pr⁡[¬Ei]≥1−p≥1−2⁢p. For Pr⁡[Ek∣¬Ei]:

  • •

    If Ek and Ei mutually independent, namely (i,j)∉E, then

    Pr⁡[Ek∣¬Ei]=Pr⁡[Ek]≤p≤2⁢p.
  • •

    Otherwise (i,k)∈E, then

    Pr⁡[Ek∣¬Ei]=Pr⁡[Ek⁢⋂¬Ei]Pr⁡[¬Ei]≤Pr⁡[Ek]Pr⁡[¬Ei]≤p1−p≤2⁢p,

    where the last inequality holds as 4⁢d⁢p≤1, meaning p≤1/4.

WLOG let S′=[1,s−1], S=[1,s], and s≥2. Supposing the lemma holds for S′ with |S′|=s−1, then for S,

Pr⁡[E‾S] =Pr⁡[¬Es|E‾S′]⋅Pr⁡[E‾S′]
=(1−Pr⁡[Es|E‾S′])⋅Pr⁡[E‾S′]
≥(1−2⁢p)⋅(1−2⁢p)s−1=(1−2⁢p)s,

where the lower bound follows immediately from the induction hypothesis.

Remark 1.6.43.

Alternatively, we have

Pr⁡[E‾S] =Pr⁡[¬Es|E‾S′]⋅Pr⁡[E‾S′]
=Pr⁡[¬Es|E‾S′]⋅∏i∈[1,s−1]Pr⁡[¬Ei|E‾[1,i−1]]
=∏i∈[1,s](1−Pr⁡[Ei|E‾[1,i−1]])
≥(1−2⁢p)s,

where the last inequality holds from induction hypothesis.

Let A⊆S such that ∀i∈A, (i,s+1)∈E, and B=S∖A. If B=S, then Es+1 is mutually independent of {Ei}i∈S,

Pr⁡[Es+1|E‾S]=Pr⁡[Es+1]≤p≤2⁢p.

Otherwise, by Bayes’ rule,

Pr⁡[Es+1|E‾S] =Pr⁡[Es+1⁢⋂E‾S]Pr⁡[E‾S]=Pr⁡[Es+1⁢⋂E‾A⁢⋂E‾B]Pr⁡[E‾A⁢⋂E‾B]
=Pr⁡[Es+1⁢⋂E‾A|E‾B]Pr⁡[E‾A|E‾B].

For numerator, since Es+1 is mutually independent of {Ei}i∈B by the dependency graph, we have

Pr⁡[Es+1∩E‾A|E‾B]≤Pr⁡[Es+1|E‾B]=Pr⁡[Es+1]≤p.

For denumerator,

Pr⁡[E‾A|E‾B] =1−Pr⁡[⋃i∈AEi|E‾B]
≥1−∑i∈APr⁡[Ei|E‾B]
≥1−d⋅2⁢p
≥12,

where the first inequality holds from union bound, the second inequality holds from the induction hypothesis, and |A|≤d by the degree of the dependency graph, and the last inequality holds from the lemma’s requirement. Hence, Pr⁡[Es+1|E‾S]≤2⁢p. ∎

Since lemma 1.6.42 holds for any S, which finishes the proof immediately. ∎

Exercise 1.6.44 (Exercise 6.17 [MU17]).

Use lemma 1.6.41 to show that, if

4⋅(k2)⁢(nk−2)⋅21−(k2)≤1,

then it is possible to 2-color the edges of Kn so that it has no monochromatic Kk subgraph.

Proof.

Let Ei be the bad event that the ith Kk being monochromatic.

To upper bound the dependency degree d, we can pick an edge from the ith Kk, then uniformly randomly sample the rest of the vertices from all possible vertices. Hence

d≤(k2)⁢(nk−2).

The probability of Kk being monochromatic is 21−(k2). Therefore by lemma 1.6.41, if

4⋅(k2)⁢(nk−2)⋅21−(k2)≤1,

then it is possible to 2-color Kn edges such that there is no monochromatic Kk. ∎

The symmetric Lovász Local Lemma lemma 1.6.41 works best when all events are upper bounded equally, and the dependency degrees are also upper bounded equally. The asymmetric Lovász Local Lemma has likely or rare events, where likely events have smaller dependency degrees, while rare events could depend on many other events.

Onwards we denote Γi={j∣(i,j)∈E} for all the neighbors of Ei in the dependency graph.

Lemma 1.6.45 (Asymmetric Lovász Local Lemma [EL75]).

Let {Ei}i∈[1,n] be a set of events. If {xi}i∈[1,n] in [0,1] has

Pr⁡[Ei]≤xi⋅∏j∈Γi(1−xj),

then

Pr⁡[E‾[1,n]]≥∏i∈[1,n](1−xi).
Proof.

The proving strategy is similar to lemma 1.6.41 by introducing following lemma for all possible S⊆[1,n].

Lemma 1.6.46.

For all S⊆[1,n] with k∉S, we have both following being true

Pr⁡[Ek|E‾S]≤xk⁢ and ⁢Pr⁡[E‾S]≥∏i∈S(1−xi).
Proof.

We prove by induction over all possible |S|.

When |S|=0, this is vacuously true.

When |S|=1, let S={i}. Then

Pr⁡[¬Ei]≥1−xi⋅∏j∈Γi(1−xj)≥1−xi.

For Pr⁡[Ek|¬Ei],

  • •

    If Ek and Ei are mutually independent, namely (i,k)∉E, then

    Pr⁡[Ek|¬Ei]=Pr⁡[Ek]≤xk⋅∏j∈Γk(1−xj)≤xk.
  • •

    Otherwise (i,k)∈E, then

    Pr⁡[Ek|¬Ei]=Pr⁡[Ek⁢⋂¬Ei]Pr⁡[¬Ei]≤Pr⁡[Ek]Pr⁡[¬Ei]≤xk⋅∏j∈Γk∖{i}(1−xj)≤xk,

    where the second inequality holds from Pr⁡[¬Ei]≥1−xi.

WLOG let S′=[1,s−1], S=[1,s], and s≥2. Supposing the lemma holds for any S′ with |S′|=s−1, then for S,

Pr⁡[E‾S]=Pr⁡[¬Es|E‾S′]⋅Pr⁡[E‾S′]≥(1−xs)⋅∏i∈S′(1−xi)=∏i∈S(1−xi),

which is immediate from induction hypothesis. Alternatively, the same procedure in remark 1.6.43 applies.

Let A⊆S such that ∀i∈A, (i,s+1)∈E, and B=S∖A. If B=S, then Es+1 is mutually independent of {Ei}i∈S,

Pr⁡[Es+1|E‾S]=Pr⁡[Es+1]≤xs+1⋅∏j∈Γs+1(1−xj)≤xs+1.

Otherwise, by Bayes’ rule,

Pr⁡[Es+1|E‾S] =Pr⁡[Es+1⁢⋂E‾S]Pr⁡[E‾S]=Pr⁡[Es+1⁢⋂E‾A⁢⋂E‾B]Pr⁡[E‾A⁢⋂E‾B]
=Pr⁡[Es+1⁢⋂E‾A|E‾B]Pr⁡[E‾A|E‾B].

For numerator, since Es+1 is mutually independent of {Ei}i∈B by the dependency graph, we have

Pr⁡[Es+1∩E‾A|E‾B]≤Pr⁡[Es+1|E‾B]=Pr⁡[Es+1]≤xs+1⋅∏j∈Γs+1(1−xj).

For denumerator, let |A|=t, A={ai}i∈[1,t], and Aℓ={ai}i∈[ℓ,t], then

Pr⁡[E‾A|E‾B] =∏i∈[1,t]Pr⁡[¬Eai|E‾Ai+1∩E‾B]
=∏i∈[1,t](1−Pr⁡[Eai|E‾Ai+1∩E‾B])
≥∏i∈A(1−xi)
≥∏i∈Γs+1(1−xi),

where the first inequality holds from induction hypothesis, and the second inequality holds from A⊆Γs+1. Hence Pr⁡[Es+1|E‾S]≤xs+1. ∎

Since lemma 1.6.46 holds for any S, we finish the proof. ∎

Lemma 1.6.47.

For integer x≥0,

g⁢(x)=(1−11+x)x

is monotone decreasing and lower bounded by e−1.

Proof.

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

φ′⁢(x)=ln⁡(1−11+x)+x⋅11−1/(1+x)⋅(−−1(1+x)2)=ln⁡(1−11+x)+11+x.

Let t=1−1/(1+x), then φ′⁢(x)=ln⁡t+1−t.

Since ln⁡t≤t−1 for all t, then φ′⁢(x)≤0, g⁢(x) is monotone decreasing. As x→∞, g⁢(x)→e−1. ∎

Exercise 1.6.48 (Exercise 6.18 [MU17]).

Use the asymmetric LLL lemma 1.6.45 to show we can improve the symmetric LLL lemma 1.6.41 by replacing the condition 4⁢p⁢d≤1 to e⁢p⁢(d+1)≤1.

Proof.

Let each xi=1/(d+1), then

xi⋅∏j∈Γi(1−xj)≥xi⋅(1−xj)d=1d+1⋅(1−1d+1)d≥1e⁢(d+1)≥p,

where the second inequality holds from lemma 1.6.47.

p is directly applied in lemma 1.6.41, and the weakened condition is immediate. ∎

Remark 1.6.49.

Spencer proved this strengthened result in [Spe77].

Exercise 1.6.50 (Exercise 6.19 [MU17]).

Let G=(V,E) be an undirected graph and suppose each v∈V is associated with a set S⁢(v) of 8⁢r colors, where r≥1. Suppose, in addition, that for each v∈V and c∈S⁢(v), there are at most r neighbors u of v with c lies in S⁢(u). Prove that there exists a coloring of G assigning to each vertex v a color from S⁢(v) such that, for any edge (u,v)∈E, the color assigned to u and v are different. Hint: use Au,v,c to be the event that u and v are both colored with c, then consider the family of such events.

Proof.

Let Xu be the random number for vertex u’s color, and c∈S⁢(u), then Pr⁡[Xu=c]=1/8⁢r.

Let v be a neighboring vertex of u, since v is also associated with a set S⁢(v) of 8⁢r colors, then Pr⁡[Xv=c]≤1/8⁢r, as c might not be in S⁢(v). Therefore,

Pr⁡[Xu=c∧Xv=c]=Pr⁡[Au,v,c]≤164⁢r2.

For the dependency graph formed by events {Au,v,c}, fixing a color c∈S⁢(u)∩S⁢(v) and an edge (u,v)∈E, the event Au,v,c is dependent on all Au′,v′,c′ where either u′=u or v′=v. Since u has at most 8⁢r colors, and at most 8⁢r2 neighbors may share colors with u, therefore the dependency graph degree d≤16⁢r2 by symmetry on v side.

By lemma 1.6.41, by 4⁢d⁢p≤4⋅16⁢r2⋅1/64⁢r2≤1, there is probability that all edges are colored differently by

Pr⁡[⋂u,v,c¬Au,v,c]>0.

∎

Exercise 1.6.51 (Exercise 6.20 [MU17]).

A k-uniform hypergraph is an ordered pair G=(V,E), but edges consist of sets of k (distinct) vertices, instead of just 2. (So a 2-uniform hypergraph is just what we normally call a graph.) A hypergraph is k-regular if all vertices have degree k; that is, they are in k hypergraph edges.

Show that for sufficiently large k, the vertices of a k-uniform, k-regular hypergraph can be 2-colored so that no edge is monochromatic. What’s the smallest value of k you can achieve?

Proof.

We form a dependency graph for events of a hypergraph edge being monochromatic. Since the hypergraph is k-regular, then each vertex is appearing in k hypergraph edges. Excluding the hypergraph edge we are discussing, there are k−1 other hypergraph edges for the vertex, and therefore the dependency graph degree d≤k⁢(k−1).

On the other hand, a k-uniform hypergraph edge is monochromatic with probability 21−k.

  • •

    We can try lemma 1.6.41 and by 4⁢d⁢p≤1, then k≥10.

  • •

    We can also try the Spencer result in 1.6.48 that e⁢p⁢(d+1)≤1, then k≥9.

∎

1.6.7 Algorithmic Lovász Local Lemma

Theorem 1.6.52 (Beck’s k-Satisfiability Algorithm [Bec91]).

Consider a k-SAT formula with m clauses, where k≥12 is an even constant, and each variable appears in up to 2α⁢k clauses for a sufficiently small constant α>0, then there is an algorithm finding a satisfying assignment for the formula in expected polynomial time in m.

Proof.

Let {xi}i∈[1,ℓ] be the variables, and {Ci}i∈[1,m] be the m clauses.

The algorithm has 2 phases: some variables are fixed in the first phase, and the remaining variables are deferred to the second phase. During the first phase variable fixing, a clause Ci is considered dangerous if Ci is not yet satisfied, and k/2 variables in the clause have been fixed.

In the first phase, the algorithm iterates through all variables, if the variable is not in any dangerous clause, assign it independently and uniformly a value from {0,1}.

After the first phase, a clause is surviving if it is not yet satisfied, and such surviving clause has no more than k/2 variables fixed. A deferred variable is a variable not yet fixed in the first phase. In phase 2, we use exhaustive search to assign values to the deferred variables and so to complete a satisfying assignment for the formula.

Remark 1.6.53.

The algorithm assigns a subset of variables in the first phase, and the remaining variables are deferred to the second phase. The subset of variables with values assigned in the first phase are chosen such that

  • •

    By the Local Lemma, the random partial solution fixed in phase 1 can be extended to a full satisfying assignment without modifying any phase 1 variable assignments.

  • •

    The dependency graph H′ defined by the deferred variables in phase 2 is with high probability containing small connected subcomponents.

When the dependency graph consists only of small connected subcomponents, a solution for the variables of one component can be found independently of the other components. Therefore, such 2 phase algorithm first breaks the problem into smaller subproblems, and each smaller subproblem can be solved independently with exhaustive search in the phase 2.

We introduce following 2 lemmas for the 2 points in the prior remark.

Lemma 1.6.54.

There is an assignment to the deferred variables such that all the surviving clauses are satisfied.

Proof.

Let H=(V,E) be the dependency graph on m nodes, where V=[1,m], and (i,j)∈E if and only if Ci∩Cj≠∅. H is the dependency graph for the original problem. Let H′=(V′,E′) be the dependency graph with V′⊆V, E⊆E, with i∈V′ if and only if Ci is a surviving clause, and (i,j)∈E′ if and only if Ci and Cj share deferred variables.

Since a surviving clause has at least k/2 deferred variables, then the satisfying probability is at most 2−k/2. On the other hand, a variable appears up to 2α⁢k clauses, then the degree of the dependency graph H′ is d≤k⁢2α⁢k.

By symmetric Local Lemma lemma 1.6.41, given constant α>0 that is sufficiently small, if 4⋅k⁢2α⁢k⋅2−k/2≤1, there exists an assignment that all surviving clauses are satisfied. ∎

Lemma 1.6.55.

All connected components in H′ are of size O⁢(log⁡m) with probability 1−o⁢(1).

Proof.

We start by bounding the probability of a given clause surviving phase 1. For a given node, it is dangerous with probability at most 2−k/2, that exactly k/2 variables in phase 1 are fixed but the clause is not satisfying. A clause is surviving, either itself is dangerous, or it is sharing at least a deferred variable with a dangerous clause, namely it is neighboring a dangerous clause in H′. Union bounding over the clause and its neighbors in H′, which is at most the dependency graph degree d≤k⁢2α⁢k, a given node surviving phase 1 with probability at most (d+1)⁢2−k/2.

The survival of individual clauses are not independent of each other, as 2 neighboring surviving clauses share at least a deferred variable. We consider a connected component R⊆H of r vertices, then we identify a subset of vertices in R such that the survival of the clauses represented by these vertices are independent events.

Definition 1.6.56.

A 4-tree S of a connected component R in H is defined as follows:

  • •

    S is a rooted tree.

  • •

    Any 2 nodes in S is at least distance 4 in H.

  • •

    There can be an edge in S only between 2 vertices of distance exactly 4 between them in H.

  • •

    Any node in R is either in S or in distance at most 3 from a node in S.

The motivation of introducing 4-tree is that, for any 2 clauses on S, the survival of the clauses are independent. Since any 2 neighboring clauses u,v∈S are of distance exactly 4 in H, if both u and v are surviving, the clause causing u to survive is at least distance 2 in H from the clause causing v to survive. If 2 clauses are at least distance 2 in H, they are not sharing any variables, and their survival are surely independent. Supposing the survival of a large 4-tree is with low probability, this implies the survival of a large connected subcomponent with low probability.

For a 4-tree to survive, the probability is at most ((d+1)⁢2−k/2)|S|. For a clause in a 4-tree, there are at most

d+d⁢(d−1)+d⁢(d−1)2≤d3−1

clauses in H that are within distance 3. Immediate by the expectation argument, there exists a 4-tree S in R with |R|=r such that |S|≥r/d3.

The next step is to union bound over all possible sufficiently large 4-tree, such that we can derive an upper bound for the probability of existence of a sufficiently large 4-tree. A crude way to upper bound the number of 4-trees is, for each root, traverse the 4-tree in Euler cycle by visiting each path in 2 directions. There are at most m⁢(d4)2⁢r/d3 number of traversals by picking a vertex every 4 vertices until 2⁢r/d3 vertices are picked, over m roots.

The union bound is

m⁢d8⁢r/d3⋅((d+1)⁢2−k/2)r/d3,

when r≥c⁢log⁡m for a sufficiently large constant c>0 and a sufficiently small constant α>0, the bound is o⁢(1). ∎

Therefore, the proof is immediate by lemma 1.6.54 and lemma 1.6.55, that phase 1 partitions the problem into subproblems with O⁢(k⁢log⁡m) variables with probability 1−o⁢(1), then we just need to run constant number of times of phase 1 before we obtain a good partition. ∎

We now discuss the constructive proof by Moser [Mos09]. A simpler version was presented in his STOC’09 talk, which was based on the entropy compression argument. The following analysis follows the “entropy compression” idea, which appears explicitly in his doctoral thesis [Mos12] (see the “Incompressibility” section), rather than being the primary framing in the STOC’09 paper.

At the core of the “entropy compression” argument, it is arguing that the algorithm’s expected runtime must be small, otherwise we are able to compress the random bits used by the algorithm significantly.

We begin with a useful fact on the incompressibility of random strings.

Fact 1.6.57 (Incompressibility Principle).

For injective f:{0,1}t↦{0,1}∗, if 𝐬←r{0,1}t, then for any integer c,

Pr⁡[the length of ⁢f⁢(𝐬)≤t−c]≤21−c.
Proof.

There are in total 2t−c+1−1 binary strings of length at most t−c, while there are 2t possible inputs in {0,1}t. Hence, if 𝐬←r{0,1}t, then the probability of f outputting at most t−c bits is at most 21−c. ∎

There are 2t−1 binary strings of length at most t−1, and the average length is

∑i∈[0,t−1]i⋅2i2t−1≥∑i∈[0,t−1]i⋅2i2t≥t−2.

Therefore, the expected compression length over 𝐬←r{0,1}t is lower bounded by t−2.

Theorem 1.6.58 (Moser’s k-Satisfiability Algorithm [Mos12]).

For a k-SAT formula with m clauses, and each clause shares variables with at most 2k−3−1 other clauses. Then a satisfying assignment can be found in expected polynomial time in m.

The “entropy compression” argument is rather clean in the specific setting of k-SAT.

We let {xi}i∈[1,ℓ] be the ℓ variables, {Ci}i∈[1,m] be the m clauses, Γi be the set of indices of clauses sharing variables with the clause Ci, Γi+ be the inclusive neighborhood Γi∪{i}, and Vi be the set of indices of variables in Ci.

Informally, the algorithm picks a uniformly random assignment, then look for an unsatisfied Ci. If such Ci exists, we sample a new assignment for the variables in Vi uniformly at random. Doing so may fix Ci, but it may end up unsatisfying Cj for some j∈Γi+. The algorithm recursively fix the neighboring clauses, and by the end of the recursion, Ci is satisfied with no neighboring clauses damaged. Therefore, the situation is improved by satisfying at least 1 previously unsatisfied clause. Iterating through all m clauses, the algorithm finishes the fixing.

This leads to the question that when will the recursion stop, and is solved by the “entropy compression” argument. We describe the algorithm formally as follows, and bound the expected runtime.

The Moser’s algorithm has 2 functions: solve and local-fix.

  • •

    solve

    • –

      Sample a uniformly random variable assignment for {xi}i∈[1,ℓ].

    • –

      While there is Ci unsatisfied

      • *

        Choose the unsatisfied Ci with the smallest i.

      • *

        Enter i into the execution log with ⌈log2⁡m⌉ bits.

      • *

        Call local-fix on the clause Ci.

  • •

    local-fix

    • –

      Sample a uniformly random variable assignment for {xj}j∈Γi.

    • –

      While there is k∈Γi+ such that Ck is unsatisfied

      • *

        Choose the unsatisfied Ck with the smallest k.

      • *

        Enter “0” together with k in k−3 bits into the execution log.

      • *

        Call local-fix on the clause Ck.

      • *

        Enter “1” into the execution log.

Proof.

There are 2 distinct ways of describing how the algorithm works.

We can think of the algorithm as being described by the random string of bits it used. It takes ℓ bits for the initial variable assignment at random, then it takes k bits to resample variables for a clause each time local-fix is called. We refer to each time local-fix is called as a round. Hence, a way to describe the algorithm’s action for j rounds is with the random strings of ℓ+j⁢k bits used by the algorithm.

We can also think of the algorithm as being described as the history, the bits in its execution log. It includes the list of clauses called in the main routine and recursion of local-fix. For recursion, the log starts with a bit 0 and ends with a bit 1 to mark the start and the end of of recursion calls. For the index of the clause in the recursion call, we use k−3 bits instead of ⌈log2⁡m⌉ bits, as |Γi+|≤2k−3. The ℓ bits of final variable assignments are also included in the history, serving as an updatable state: each time a clause’s variables being resampled, the state is updated. Hence, the output execution log for the algorithm’s action for j rounds takes at most ℓ+m⁢⌈log2⁡m⌉+j⁢(k−1), as a round of clause variable resampling outputs k−1 bits: 2 bits for start/end marking, and k−3 bits for clause index.

Given ℓ+k⁢j resampling bits used by the algorithm, and ℓ+m⁢⌈log2⁡m⌉+j⁢(k−1) bits of output execution log, we can view the algorithm as a compression algorithm over random bits. We now show how to recover the resampling bits from the execution log. The execution log determines a sequence of clauses visited by the algorithm, and each visited clause must be unsatisfied before resampling. Only 1 setting of variables unsatisfy a clause. Hence, we work backwards from the final variable assignments. On each clause, we update with unsatisfying variable assignment, such that we know the resampling variables, and therefore we recover the ℓ+j⁢k bits of resampling bits.

After proving the compression is injective, now we use the compression argument to bound the expected runtime. Let J be the random variable for the number of rounds in the algorithm. The algorithm takes ℓ+J⁢k uniformly random bits as inputs, outputting at most ℓ+m⁢⌈log2⁡m⌉+J⁢(k−1) bits of history. By 1.6.57,

ℓ+m⁢⌈log2⁡m⌉+J⁢(k−1)≥ℓ+k⁢J−1,

and when J=m⁢⌈log2⁡m⌉+1+i,

Pr⁡[output length≤ℓ+m⁢⌈log2⁡m⌉+J⁢(k−1)]≤2−i.

Therefore, 𝔼[J] can be bounded as follows

𝔼[J]≤m⁢⌈log2⁡m⌉+1+∑i≥0i2i=m⁢⌈log2⁡m⌉+3.

Therefore, the expected runtime of the algorithm is O⁢(m⁢log⁡m). ∎

Exercise 1.6.59 (Exercise 6.20 [MU17]).

In the k-Satisfiability Algorithm using the algorithmic Lovász Local Lemma, we used ⌈log2⁡m⌉ bits in history to represent each clause called in the main routine. Instead, we could record in the history which clauses are initially unsatisfied with an array of m bits. Explain any other changes to the algorithm to properly record a history that one can “reverse” to obtain the initial assignment, and explain how this allows one to modify the proof of theorem 1.6.58 so that only O⁢(m) rounds are needed in expectation.

Proof.

Observing each run of local-fix, the subroutine visits an unsatisfied clause, resamples its variables, then fix neighboring unsatisfied clauses recursively. The invariant is, all of the visited clauses and their neighboring clauses are satisfied by the end of the recursion.

If we put m bits for the initially unsatisfied clauses, then we know the first unsatisfied clause visited by local-fix. We maintain a list of satisfied clauses by the first call to the local-fix, update the m bits for unsatisfied clauses, and move on to the remaining unsatisfied clause with smallest index. Repeating O⁢(m) times, we have a full list of visited clauses from history.

Therefore, we use m bits in history for visited unsatisfied clauses from the main routine rather than m⁢⌈log2⁡m⌉, and therefore replacing all appearances of m⁢⌈log2⁡m⌉ in the argument, we have the expected runtime being O⁢(m). ∎

The Algorithmic Lovász Local Lemma by Moser and Tardos [MT10] states that: in the variable-based LLL setting, an LLL existence proof is automatically (Las Vegas) constructive via resampling, with expected polynomial runtime. We describe the asymmetric algorithmic LLL, and the symmetric algorithmic LLL follows from 1.6.48.

Theorem 1.6.60 (Asymmetric Algorithmic Lovász Local Lemma [MT10]).

Let {Ei}i∈[1,n] be a set of events in arbitrary probability space that are determined by mutually independent random variables {yi}i∈[1,ℓ], and let G=(V,E) be the dependency graph for the events. Suppose there are {xi}i∈[1,n] in [0,1] such that for i∈[1,n],

Pr⁡[Ei]≤xi⋅∏j∈Γi(1−xj),

then there exists an assignment {yi} such that E‾[1,n] holds, and a resampling algorithm whose expected number of resampling Ei in finding an assignment is at most xi/(1−xi). Hence, the expected runtime is at most ∑ixi/(1−xi).

Corollary 1.6.61 (Symmetric Algorithmic Lovász Local Lemma [MT10]).

Let {Ei}i∈[1,n] be a set of events in arbitrary probability space that are determined by mutually independent random variables {yi}i∈[1,ℓ], and let G=(V,E) be the dependency graph for the events. Supposing the degree of G is at most d, Pr⁡[Ei]≤p for i∈[1,n], and e⁢p⁢(d+1)≤1, then there exists an assignment {yi} such that E‾[1,n] holds, and a resampling algorithm whose expected number of resampling Ei in finding an assignment is at most 1/d. Hence, the expected runtime is at most n/d.

The Moser-Tardos algorithmic LLL is even simpler than Moser’s k-SAT algorithm, and the algorithm is described as follows. Onwards we say each event Ei as bad events, and the algorithms avoids all the bad events, eventually.

  • •

    Moser-Tardos

    • –

      Sample a uniformly random variable assignments for {yi}.

    • –

      While there is Ei happening

      • *

        Randomly pick an happening Ei.

      • *

        Resample all yi determines this Ei.

We define 𝐜∈[1,n]k as the execution log, where the algorithm has k rounds of resampling over events {Ei}, and each ci is an index for n events {Ei}. At the core of the argument is the construction and analysis of a witness tree from resampling each event Eci in the execution log.

Definition 1.6.62 (Witness Tree).

A witness tree is constructed from execution log 𝐜 as follows.

  • •

    Let ck be the root.

  • •

    Let Tj,k be a witness tree from cj,…,ck, and let j goes backwards from k−1 to 1.

    • –

      If cj∈Γo+ for some o∈Tj+1,k, then add cj as the children of the deepest occurrence of such event.

    • –

      If Ecj do not share variables with any event in Tj+1,k, then drop cj and move on by Tj,k←Tj+1,k.

  • •

    Eventually, Tk←T1,k.

The following facts are immediate by the construction of the witness tree.

Fact 1.6.63.

For any events Ei and Ej sharing variables, they are appearing in the same depth of a witness tree.

Fact 1.6.64.

A variable xi is not appearing twice in the same depth of a witness tree.

Intuitively, a witness tree is a tree justifying how we end up selecting Eci to resample all variables in Vci.

We introduce an additional fact, that the witness trees from different prefixes of an execution log are different.

Fact 1.6.65.

For execution logs 𝐜0 of length k0 and 𝐜1=𝐜0∥𝐜′ of length k1, the execution trees Tk0 and Tk1 are different.

Proof.

Let the roots from 𝐜0 and 𝐜1 be r0 and r1.

If r0≠r1, then Tk0≠Tk1 by root. Otherwise, 𝐜1 has at least one more occurrence of r0, resulting in Tk0≠Tk1. ∎

Hence, the next lemma for counting the occurrence of resampling Ei in 𝐜 is immediate by 1.6.65.

Lemma 1.6.66.

Let Xi be the random variable of occurrence of resampling Ei in 𝐜, and Xi,j be the 0-1 random variable indicating the witness tree Tj from 𝐜[1,j], the prefix of 𝐜, has root i. Then

Xi=∑j∈[1,k]Xi,j.

Moreover, let Wi be the set of witness trees rooted by i, then by linearity of expectation,

𝔼[Xi]=∑j∈[1,k]𝔼[Xi,j]=∑j∈[1,k]∑T∈WiPr⁡[T=Tj]=∑T∈Wi∑j∈[1,k]Pr⁡[T=Tj].

We want to bound Pr⁡[Tj=T]. We say T appears in 𝐜, if T=Tj for Tj constructed from some 𝐜[1,j] prefix of 𝐜. Hence, fixing a T, since {Tj} are all distinct by 1.6.65, T=Tj are all independent, and

Pr⁡[T⁢ appears in ⁢𝐜]=∑j∈[1,k]Pr⁡[T=Tj].
Lemma 1.6.67.
Pr⁡[T⁢ appears in ⁢𝐜]≤∏j∈TPr⁡[Ej],

where the T in the right hand side production is a multiset, such that we capture multiple occurrence of an event being resampled.

Proof.

If we traverse the witness tree T in reverse BFS method, namely layering by depth bottom up, then we observe earlier events resampling induces later events resampling, following the Moser-Tardos algorithm’s execution order.

For variables {yi}, each resampling creates a sequence of assignments, say yi1,…,yis. By 1.6.64, we know that yia and yib with a≠b should be on different depth.

Hence, fixing the randomness from Moser-Tardos algorithm, which is fixing the assignment sequences {{yis}s}i, we form a checking algorithm for T as follows. The check algorithm traverses in described way, and checks if events in the current layer are happening: aborts if any event is not happening. Before traversing the next depth, the check algorithm resamples all the variables of the events in the current layer, by moving each yis to yis+1.

It becomes obvious that, on input the witness tree T from a successful run of Moser-Tardos algorithm, by fixing the assignment sequences for {{yis}s}i, the tree checking algorithm always passes. Therefore

Pr⁡[T⁢ appears in ⁢𝐜]≤Pr⁡[check⁢(T)⁢ succeeds].

To bound the probability of a tree being valid in the checking algorithm, we use 1.6.63 and 1.6.64, that the events are not sharing variables in a same depth, such that events in a layer are independent, and each layer is independent of each other. Hence, a tree is valid in the checking algorithm with probability ∏j∈TPr⁡[Ej].

Thus, the inequality holds by the coupling arguments above. ∎

Now we have derived

𝔼[Xi]=∑T∈WiPr⁡[T⁢ appears in ⁢𝐜]≤∑T∈Wi∏j∈TPr⁡[Ej]

by lemma 1.6.66 and lemma 1.6.67, the final step would be bounding the right hand side sum of product. We derive the upper bound by Galton-Watson process, that each children of Ei in Γi+ spawns with probability xi independently.

Lemma 1.6.68.

Deriving T rooted with i with Galton-Watson process has probability

pT=1−xixi⋅∏j∈TPr⁡[Ej].
Proof.

Let each node Ej has a set Sj⊆Γj+ for the indices of children in T, and the probability derivation follows

pT =∏j∈T(∏k∈Sjxk⋅∏k∈Γj+∖Sj(1−xk))=∏j∈T(∏k∈Sjxk1−xk⋅∏k∈Γj+(1−xk))
=1−xixi⋅∏j∈T(xj⋅∏k∈Γj(1−xk))=1−xixi⋅∏j∈TPr⁡[Ej],

where the third equality holds from moving all the xk/(1−xk) terms for k∈Sj from Ej to all the children in Sj. ∎

The proof for theorem 1.6.60 follows immediately:

Proof.

By lemma 1.6.68, we have

𝔼[Xi]=∑T∈WiPr⁡[T⁢ appears in ⁢𝐜]≤∑T∈Wi∏j∈TPr⁡[Ej]=xi1−xi⋅∑T∈WipT≤xi1−xi,

and ∑TpT≤1 as we are summing over disjoint events. The rest is immediate by the linearity of expectation. ∎