Random Structures and Algorithms Notes
Random Structures and Algorithms Notes
2
Contents 3
4.3.4 Convergence in L1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
4.3.5 Relation between types of convergence . . . . . . . . . . . . . . . . . . . . 32
4.4 Moment generating and characteristic functions . . . . . . . . . . . . . . . . . . . 33
4.5 Convergence in distribution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
4.6 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
6 Chernoff bound 48
6.1 Going beyond first and second moments . . . . . . . . . . . . . . . . . . . . . . . 48
6.2 Chernoff bound: upper tail . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
6.3 Chernoff bound: lower tail . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
6.4 Example: random walk on Z . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
6.5 Largest degree in G(n, p) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
6.6 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
7 Martingale 56
7.1 Random walk on Z . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
7.2 σ-algebra . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
7.3 Filtration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
7.4 Conditional expectation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
7.4.1 Properties of conditional expectation . . . . . . . . . . . . . . . . . . . . . 58
7.5 Martingales . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
7.5.1 Examples of martingales . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
7.6 Stopping times . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
7.7 Optional stopping theorem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
7.8 Random walk and martingales . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
7.8.1 Unbiased random walk . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
7.8.2 Gambler’s ruin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
7.8.3 Example of wrong application of optional stopping . . . . . . . . . . . . . 62
7.8.4 Biased random walk . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
7.8.5 Other examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
7.9 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
9 Coupling 72
9.1 What is a coupling? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
9.2 Formal definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
9.3 Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
9.3.1 Stochastic domination . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
9.3.2 General construction of random variables via Uniform(0, 1) . . . . . . . . 74
9.3.3 Necessary and sufficient condition for stochastic domination . . . . . . . . 74
9.4 Example: Erdős-Rényi random graph . . . . . . . . . . . . . . . . . . . . . . . . . 74
9.5 Example: Galton-Watson process . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
9.6 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
10 Percolation 77
10.1 Definition of bond percolation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
10.2 A word on motivation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
10.3 Site percolation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
10.4 Percolation clusters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
10.5 Percolation probability and pc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
10.6 Monotonicity and phase transition . . . . . . . . . . . . . . . . . . . . . . . . . . 79
10.7 General lower bound on pc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
10.8 pc for the regular tree . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
10.9 Finite graphs and Erdős-Rényi . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
10.10Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
11 Review problems 85
11.1 Isolated triangle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
11.2 Second moment method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
11.3 Percolation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
11.4 A gambling game . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
List of Theorems
5
List of Definitions
6
List of Recalls
7
How to use the lecture notes
These lecture notes are intended to support you in following the lectures and contain the material
covered throughout the module. Each chapter corresponds roughly (but not exactly) to one week
of lecture.
A note on the style used. Theorems, lemmas, algorithms, and similar items are numbered
sequentially within each chapter, without distinction between them. This unified numbering is
intended to make it easier to locate results. The notes will refer to a theorem by its number. You
are not expected to memorize the numbering of theorems, propositions, or lemmas. However, if
a theorem has a standard name (which is clearly written in the statement of the theorem), you
are expected to know it, as you may be asked about it in the exam.
Special icons. The icons below will be used to highlight different types of content:
Information specific to the course (e.g., assessment details).
6 It is used either in the title of a section to indicate that the section content is non-examinable,
or inside a boxed region to mark non-examinable material.
Î It recalls a concept introduced in Probability & Statistics I.
It highlights useful information, intuition, or motivation.
It is used in the exercise sections to highlight problems that are more challenging and require
deeper thinking. They are intended for students who wish to explore the material of the
module in greater depth.
8
Chapter 1
Definition 1.1 (Algorithm). An algorithm A with input set I and output set O is a de-
terministic, well-defined procedure that, for every x ∈ I, halts after finitely many steps and
returns an output A(x) ∈ O. The running time on input x, denoted TA (x), is the number of
steps executed until the output is produced.
Input: integer n ≥ 2
Output: true if n is prime, false otherwise
If n = 2, return true.
√
Otherwise, for each integer x from 2 to n, check if n is divisible by x. If it is, return
false.
If no divisor is found in the step above, return true.
9
10 Chapter 1. Introduction to algorithms and randomization
Input: A, B, C ∈ Rn×n
Output: true if AB = C, false otherwise
Definition 1.4 (Randomized algorithm). Let I be an input set and O an output set, and let
Spec : I → 2O map each input to the set of correct outputs. A randomized algorithm A over
(I, O, Spec) is a well-defined procedure that may make random choices during its execution,
and such that the following holds for every input x ∈ I:
(i) the running time TA (x) has finite expectation, E[TA (x)] < ∞;
(ii) the probability of the output being correct is positive: Pr A(x) ∈ Spec(x) > 0.
Input: integer n ≥ 2
Output: true if n is prime, false otherwise
If n = 2, return true.
√
Otherwise, pick I uniformly at random from {2, . . . , n}.
If n is divisible by I, return false.
Otherwise, return true.
Definition 1.6 (Monte Carlo & Las Vegas algorithm). Let A be a randomized algorithm
over (I, O, Spec).
A is Monte Carlo if both the following hold:
• (bounded time) for every x ∈ I there exists a finite t such that P (TA (x) ≤ t) = 1;
• (nonzero error somewhere) there exists x ∈ I for which P (A(x) ∈ Spec(x)) < 1.
A is Las Vegas if, for every x ∈ I:
• (finite expected running time) E [TA (x)] < ∞;
• (always correct) P (A(x) ∈ Spec(x)) = 1.
It is worth noting that some randomized algorithms are neither Monte Carlo nor Las Vegas.
1
P (output is correct) = P (I = p) = √ < 1.
n−1
12 Chapter 1. Introduction to algorithms and randomization
Î Recall 1.7 (Probability space and events). Note that {the output is correct} and {I = j}
are both events.
√
If Ω = {2, . . . , n} is the (sample space) (set of possible outcomes), an event is a subset of Ω.
Given events A ⊆ B ⊆ Ω then P(A) ≤ P(B).
If two events A, B are independent then P(A ∩ B) = P(A)P(B).
If two events A, B are disjoint then P(A ∪ B) = P(A) + P(B).
In our example, {I = j} ⊂ {the output is correct}.
1.4.2. Boosting
One way to improve the probability that Algorithm 1.5 outputs the correct answer is to run it
for many times.
If n = 2, return true.
√
Otherwise, pick I1 , I2 , . . . , IK independently and uniformly at random from {2, . . . , n}.
If n is divisible by at least one of I1 , . . . , IK , return false.
Otherwise, return true.
√
Then, if n is not prime, and letting j ≤ n be a divisor of n, the probability that Algorithm 1.8
outputs the correct answer is
K
P (the output is correct) ≥ 1 − (P (I1 ̸= j))K ≥ 1 − 1 − √1
n−1
.
Input: integer n ≥ 2
Output: true if n is prime, false otherwise
If n = 2, return true.
√
Otherwise, pick I uniformly at random from {2, . . . , n}.
If n is divisible by I, return false.
Otherwise, run the deterministic Algorithm 1.2.
Below is another Las Vegas algorithm for primality test which does not resort to the deterministic
algorithm.
Input: integer n ≥ 2
Output: true if n is prime, false otherwise
If n = 2, return true.
√
Otherwise, pick a uniformly random permutation σ of {2, . . . , n}.
√
For each x from 1 to n − 1 check whether n is divisible by σ(x); if it is, return false.
If no divisor is found in the step above, returns true.
Input: A, B, C ∈ Rn×n
Output: true if AB = C, false otherwise
Now we condition on the possible values of {rj : j ≥ 2} and use that r1 is independent of
r2 , r3 , . . . , rn to obtain
X n
\ n
\
P (Dr = 0) = P Dr = 0 {rj = xj } P {rj = xj }
x2 ,x3 ,...,xn ∈{0,1} j=2 j=2
Pn
n n
j=2 D1,j xj
X \ \
= P r1 = − {rj = xj } P {rj = xj } .
D1,1
x2 ,x3 ,...,xn ∈{0,1} j=2 j=2
Tn
The last line holds because conditioning on j=2 {rj = xj } and using (1.5.1) we have that
(Dr)1 − n (Dr)1 − n
P P
j=2 D1,j rj j=2 D1,j xj
r1 = D1,1 = D1,1 .
This last term is just some number. The probability
that r1 is equal to any given number is at most 1/2, therefore,
n
X 1 \ 1
P (Dr = 0) ≤ · P {rj = xj } = .
2 2
x2 ,x3 ,...,xn ∈{0,1} j=2
Chapter 1. Introduction to algorithms and randomization 15
The proof of Lemma 1.13 employs a strategy known as searching for a witness. If
after choosing the random vector r we obtain ABr ̸= Cr, then this choice of r serves as a
certificate (also known as a witness) that demonstrates that AB ̸= C.
1.6 Exercises
Exercise 1.1. There are n balls and n bins. Each ball is placed in a bin chosen independently
and uniformly at random.
(a) Determine the probability that a given bin is empty.
(b) Determine the probability that there is no empty bin.
Exercise 1.2. A machine produces parts labelled 1, 2, . . .. Each part is defective with proba-
bility p ∈ (0, 1), independently of the others. For each i ≥ 1, let Xi be the indicator that part i
is defective.
(a) Determine the distribution of X1 , and compute E(X1 ) and Var(X1 ).
(b) Suppose that at least one of the first two parts is defective. Conditioned on this, determine
the probability that both are defective.
(c) Compute E(X1 + X2 | X1 + X2 ≥ 1).
(d) Let Yn = ni=1 Xi be the number of defective parts among the first n parts. Determine the
P
distribution of Yn , and compute E(Yn ) and Var(Yn ).
Exercise 1.3. In a large population of birds, each bird independently has the disease with
probability 0.1. A diagnostic test detects the disease in an infected bird with probability 0.9,
and it reports positive for a healthy bird with probability 0.1.
(a) We take a given bird from the population and perform the diagnostic test. Determine the
probability that the test is positive for that bird.
(b) Condition on a positive test result. Determine the probability that the bird has the disease.
(c) Now we perform the test again on the same bird. Assume the two test outcomes are
conditionally independent given the bird’s disease status, and that both results are positive.
Determine the probability that the bird has the disease.
Exercise 1.4. An algorithm receives as input a list of n distinct numbers and a target value
16 Chapter 1. Introduction to algorithms and randomization
t. The algorithm must return true if t belongs to the list, and false otherwise. Consider the
following algorithms (all random choices are independent of one another):
• Algorithm 1: pick one element from the list uniformly at random and return true if it
equals t, and false otherwise.
• Algorithm 2: repeatedly pick elements uniformly at random with replacement until either
(i) t is observed, or (ii) every distinct element of the list has been observed at least once;
return true in case (i) and false in case (ii). For this algorithm you can consider its runtime
as the number of elements picked until the algorithm stops. Note that since the elements are
picked with replacement, this number may be larger than n.
• Algorithm 3: repeatedly pick elements uniformly at random with replacement until either
(i) t is observed, or (ii) the same element is picked in two consecutive picks; return true in
case (i) and false in case (ii).
(a) Classify Algorithm 1 as Monte Carlo or Las Vegas, providing justification.
(b) Assuming t is present in the list, determine the probability that Algorithm 1 outputs the
correct answer.
(c) Assuming t is absent from the list, determine the probability that Algorithm 1 outputs the
correct answer.
(d) Determine the probability that Algorithm 2 outputs the correct answer.
(e) Classify Algorithm 2 as Monte Carlo or Las Vegas, providing justification.
(f) Assuming t is present in the list, determine the probability that Algorithm 3 outputs
the correct answer.
(g) Is Algorithm 3 Monte Carlo? Provide a justification to your answer.
Exercise 1.5. This question is about Freivalds’s algorithm. Recall that the algorithm receives
three n × n matrices A, B, C and decides whether AB = C by drawing a random vector r =
(r1 , . . . , rn ) with i.i.d. entries ri ∼ Bernoulli(1/2) and outputting “AB = C” iff ABr = Cr. In
class we proved the following result: for every A, B, C,
1
P(output is correct) ≥ 2.
1
(c) Recall that the proof that Freivalds’s algorithm satisfies P(output is correct) ≥ 2 for any
choice of input relies on the fact that
Pn
n
D r
j=2 1,j j
\ 1
max P r1 = − {rj = xj } ≤ .
x2 ,x3 ,...,xn ∈{0,1}n−1 D 1,1 2
j=2
Chapter 1. Introduction to algorithms and randomization 17
Now suppose instead that r1 , . . . , rn are chosen i.i.d. uniformly on {0, 1, 2, . . . , k} for some
integer k > 1. Does this choice yield a smaller upper bound on the probability in the
expression above? Does it change the lower bound on the probability that the output is
correct?
Exercise 1.6. We throw a fair coin twice, independently, and let Xi , i ∈ {1, 2}, be the indicator
random variables that the i-th toss is heads. Let Z = X1 .
(a) Compute E(X1 ), E(Z), Var(X2 ), and Var(Z).
(b) Compute E(X1 + X2 ) and E(X1 + Z).
(c) Compute Var(X1 + X2 ) and Var(X1 + Z).
Exercise 1.7. A pomegranate tree bears a random number N of fruits with distribution
Poisson(λ). Conditional on N , the numbers of seeds in different fruits are independent, and
each fruit has a Poisson(µ) number of seeds; assume also that these counts are independent of
N . Let Y be the total number of seeds on the tree.
(a) For any positive integer value n, determine E(Y | N = n).
(b) Determine E(Y ).
Exercise 1.8. We are interested in finding the smallest number in a list of n distinct numbers
(not necessarily sorted). Consider the following randomized algorithm:
Algorithm
Pick one element of the list uniformly at random and return its value.
(a) Classify this algorithm as Monte Carlo or Las Vegas, and justify your answer.
(b) Determine the probability that the algorithm outputs the correct answer.
(c) Now suppose the algorithm instead picks two elements uniformly at random, without re-
placement, and returns the smaller of the two. Determine the probability that the algorithm
outputs the correct answer.
Exercise 1.9. An algorithm receives as input a list of n ≥ 3 distinct, unsorted numbers, where
n is odd, and must output the list’s median; that is, the unique value x in the list such that
exactly n−1 n−1
2 elements are larger than x and exactly 2 elements are smaller than x. Consider
the following algorithms (all random choices are independent of one another):
• Algorithm 1: pick one element from the list uniformly at random and return its value.
• Algorithm 2: pick two elements from the list uniformly at random, without replacement,
and return their average.
• Algorithm 3: given a positive, odd integer M with M < n, pick M elements from the list
uniformly at random, without replacement, and return the median of these M elements.
(a) Classify Algorithm 1 as Monte Carlo or Las Vegas, providing justification.
(b) Explain why Algorithm 2 is neither Monte Carlo nor Las Vegas.
18 Chapter 1. Introduction to algorithms and randomization
(c) Determine the probability that Algorithm 1 outputs the correct answer.
(d) Determine the probability that Algorithm 3 with M = 3 outputs the correct answer.
Chapter 2
2
2 1 4
5
1 4
5 3
3
9
10 8 6
9
10 8 6
7
7
(b) A graph with one loop {4, 4} and a multiple
(a) A simple graph edge {6, 8}.
Definition 2.1 (Graphs). A graph is a pair G = (V, E) where V is a set of vertices (or nodes)
and E ⊆ V 2 is a set of edges. The number of vertices may be either finite or infinite. Edges
are denoted by {u, v} with u, v ∈ V being usually called the endpoints of the edge {u, v}.
Unless stated otherwise, graphs in this module are simple and undirected : no multiple edges
(that is, at most one edge between any two vertices), no loops, and {u, v} = {v, u}.
19
20 Chapter 2. Graphs and randomness
Proof. Note that in the sum each edge is counted twice (once for each of its endpoint). More
formally, we can write
X X X X X X
dG (v) = 1= 1= 2 = 2 |E| ,
v∈V v∈V u : {u,v}∈E {u,v}∈E w∈{u,v} {u,v}∈E
where the second equality is obtained by changing the order of the double sums.
Definition 2.3 (Trees). A connected graph without cycles is called a tree. Vertices of degree
1 in a tree are called leaves. See Figure 2.2b for an example.
2 2
1 4 1 4
5 5
3 3
9 9
10 8 6 10 8 6
7 7
Instructor’s Note. We will study several problems on graphs such as the min-cut
problem above. You are not expected to memorize their formal definitions. If an assessment
includes a question about any of these problems, the necessary definition will be stated in the
question. However, you are requirement to remember the other definitions in this section,
such as the ones in Sections 2.2 and 2.4.
2
1 4 1,2 1,2
5
4 4,6,8
3 5 5
3 3
9
10 6,8
9 9
10 6,8 10
7 7
(a) Graph obtained after con-
tracting {6, 8} in Figure 2.1a (b) After contracting {1, 2} (c) After contracting {4, (6, 8)}.
Repeatedly choose a uniformly random edge from the graph and contract it, until the
graph has only two vertices.
Return the number of edges between the two remaining vertices.
22 Chapter 2. Graphs and randomness
We will check the probability that the algorithm outputs the correct answer in Proposition 2.5.
But before we may ask: Why intuitively is this algorithm any good?
• The algorithm constructs a cut S ⊂ V by contracting edges
• When an edge {u, v} is contracted, the algorithm puts u and v on the same side of the cut
(both in S or both in V \ S).
• The min-cut is a set with a small edge boundary: so by contracting edges uniformly at random,
intuitively the chances of picking an edge at the edge boundary of the min-cut is small.
Below we quantify this intuition precisely.
Proof. Let CG be the size of the min-cut, then every vertex of G has degree at least CG (oth-
erwise, that vertex alone would be a cut of size smaller than CG ). We also note that, for any
edge {u, v} ∈ E, the graph H obtained from G by contracting edge {u, v} has minimum degree
at least CG . The reason is that any cut of H is a cut of G.
The probability that Algorithm 2.4 produces the correct answer is equal to the probability that,
at each step of the algorithm, the edge chosen to be contracted is not an edge from the edge
boundary of the min-cut. If H is a graph at some point of the algorithm with k vertices, there
are at least CG k/2 edges in H by the Handshake Lemma and that every degree in H is at least
CG . Therefore the probability that the next edge to be contracted is in a given min-cut is at
most CKCG 2
k/2 = k . Thus the probability that the algorithm avoids contracting any edge of the
min-cut is at least
3
Y 2 n−2n−3n−4n−5 321 2
1− = ··· = .
k n n−1n−2n−3 543 n(n − 1)
k=n
Definition 2.6 (Erdős–Rényi graphs G(n, p)). The Erdős–Rényi random graph with param-
eters n ∈ Z+ and p ∈ [0, 1] is defined as follows. Fix a set V = [n] of n vertices. For each
of the n2 possible edges independently, include it in the graph with probability p ∈ [0, 1],
and exclude it otherwise. We denote this model as G(n, p), and a random graph G = (V, E)
obtained in this way is denoted G ∼ G(n, p).
Note that for any given vertex u ∈ V , we have that dG (u) ∼ Binomial(n − 1, p).
Chapter 2. Graphs and randomness 23
2.7 Exercises
Exercise 2.1. Consider a simple random walk on Z: a particle that starts at the origin and at
each step independently moves one unit to the right or to the left with probability 1/2 each. If
P random variables uniformly distributed on {−1, 1}, then after t steps the
X1 , X2 , . . . are i.i.d.
position is St = ti=1 Xi , S0 = 0.
(a) Find the probability that the particle reaches 2 before −2.
(b) Find the probability that the particle reaches 3 before −1.
(c) Find the probability that the particle reaches 2 before −1.
(d) Let T be the hitting time of {−2, 2}. Compute E(T ).
Exercise 2.2. Suppose we are given a graph G = (V, E) with n vertices. We know n but not
the number of edges m = |E|. Consider two randomized algorithms to estimate m:
• Algorithm 1: pick a vertex u uniformly at random and then pick another vertex v uniformly
n
at random without replacement. Output 2 if u and v are adjacent in G, and 0 otherwise.
n dG (u)
• Algorithm 2: pick a vertex u uniformly at random from V . Output .
2
(a) Determine the expectation of the output of algorithm 1.
(b) Determine the expectation of the output of algorithm 2.
Theorem 3.1 (Key result for the probabilistic method). Let X be a random variable with
finite expectation (E(X) < ∞). Then, P (X ≥ E(X)) > 0.
Proof. The proof is via contradiction. Assume that the statement is false; that is, we are
assuming that P (X ≥ E(X)) = 0. Define a new random variable Y = E(X) − X. Then Y is a
positive random variable (that is, P(Y > 0) = 1), which implies that E(Y ) > 0. On the other
hand, using the definition of Y ,
reaching a contradiction.
The max-cut models situations where objects (vertices) must be divided into two groups
while maximizing interactions (edges) across them.
|E|
Computing the maximum cut is difficult! We will prove that its size is always at least 2 .
The problem is deterministic, but the proof employs probability in an elegant way.
Î Recall 3.2 (Indicator random variable). Given an event A, an indicator random variable
(or indicator function) 1(A) is the random variable that has value 1 if the event A holds, and
has value 0 if the event A does not hold. Therefore, 1(A) is a Bernoulli(p) random variable
with parameter p = P(A). Hence, E(1(A)) = p = P(A).
Proposition 3.3. Given any graph G = (V, E), there exists S ⊂ V such that |∂S| ≥ |E|/2.
24
Chapter 3. The probabilistic method 25
Proof. First, let W be a random subset of V obtained by adding each vertex of V to W inde-
pendently with probability 1/2. Since W is a random set, then ∂W is a random set of edges.
We want to compute its expectation. Using linearity of expectation (see a recall at the end of
the proof):
!
X X X
E (|∂W |) = E 1 (e ∈ ∂W ) = E (1 (e ∈ ∂W )) = P (e ∈ ∂W ) .
e∈E e∈E e∈E
Now we estimate P (e ∈ ∂W ). For a given edge e to be in ∂W , we need that exactly one of e’s
endpoint be in W . The probability that this happens is 2 × 21 × 12 . Therefore,
X1 |E|
E (|∂W |) = = .
2 2
e∈E
Using Theorem 3.1 we obtain that P |∂W | ≥ |E| 2 > 0. Therefore, there exists a subset S ⊂ V
|E|
such that |∂S| ≥ 2 .
Î Recall 3.4 (Linearity of expectation). Given any two random variables X and Y (not
necessarily independent of each other) we have E(X + Y ) = E(X) + E(Y ).
The probabilistic method guarantees the existence of a large cut, but provides no
information about which cut achieves this value.
• Biology or social networks: it can represent genes that do not interact directly or groups
of individuals with no conflicting relationships.
Proposition 3.5. Let G = (V, E) be a graph with n = |V | vertices and m = |E| edges. Then
n2
I(G) ≥ 4m .
Proof. We start constructing a random set of vertices Z by putting each vertex of v indepen-
dently in Z with probability p. We will
P choose the value of p later. Note that Z is not necessarily
an independent set. Define MZ = {u,v}∈V 1(u ∈ Z and v ∈ Z). That is, MZ is the number
of edges with both endpoints in Z. We will construct W by taking Z and removing from it one
endpoint for each edge that has both endpoints in Z. In this way, W is an independent set.
Note that |W | ≥ |Z| − MZ , therefore
Since Z is a binomial random variable with parameters n and p, we get E(|Z|) = np. As for
E(MZ ), we have
X X
E(MZ ) = P(u ∈ Z and v ∈ Z) = p2 = mp2 .
{u,v}∈E {u,v}∈V
E(|W |) ≥ np − mp2 .
So using Theorem 3.1 we have that I(G) ≥ np−mp2 . But this is true for all p ∈ [0, 1]. So we can
now choose the p that maximizes the expression np − mp2 so that we get the best bound. This
can easily be done by first derivating in p and seeing the value of p that makes the derivative
n
equal to 0, which is p = 2m . Substituting this value into np − mp2 gives that
n n 2 n2
I(G) ≥ n −m = .
2m 2m 4m
Instructor’s Note. As with the min-cut problem, I do not expect you to memorize
the definition of the max-cut and the independent set problems.
3.5 Exercises
Exercise 3.1. Let X be any random variable. Show that P (X ≤ E(X)) > 0.
Exercise 3.2. A town is represented by a graph G = (V, E), where each vertex is a street
corner and each edge is a road between two corners. The mayor wants to install streetlights at
some corners so that every corner is lit: we say that a corner is lit if either a streetlight is placed
there or it has a neighboring corner with a streetlight. The goal of this exercise is to show that
it is possible to achieve this using at most n 1+log(δ+1)
δ+1 streetlights, where n = |V | is the number
of vertices in G and δ = minv∈V dG (v) is the smallest degree in G.
For this, let U ⊂ V be a random subset of vertices obtained by picking each vertex of V
independently with probability p ∈ (0, 1). Let W be the set of vertices of V \ U that have no
neighbors in U .
Hint: You may use the inequality e−x ≥ 1 − x which is valid for all x ∈ R.
Chapter 3. The probabilistic method 27
(a) If we place a streetlight at each vertex of U , show that the probability that there is an unlit
corner is at most ne−p(δ+1) .
(b) Determine E(|U ∪ W |).
(c) Deduce that it is possible to lit all corners with at most n 1+log(δ+1)
δ+1 streetlights.
Exercise 3.3. You own a large collection Ω of artworks. Each artwork x ∈ Ω is associated with
an n-bit binary string fx ∈ {0, 1}n describing its features (for example, abstract or realistic,
modern or classical style, large or small, etc.). No two artworks in your collection share the
same feature string; that is, for any distinct x, y ∈ Ω, fx ̸= fy . Consequently, |Ω| ≤ 2n .
We wish to select a subset S ⊆ Ω to include in an exhibition. The exhibition should not include
any pair of similar artworks, where two artworks are considered similar if they differ in fewer
than three features. That is, x, y ∈ Ω are similar if
n
X
|fx (i) − fy (i)| < 3,
i=1
where fx (i) and fy (i) are the i-th bits in the strings fx and fy , respectively.
(a) Show that there exists a selection S of pairwise dissimilar artworks such that |S| ≥
2 |Ω|
n(n+1)+2 .
Hint: Consider a random process that adds artworks one at a time to S.
(b) Suppose that, for each artwork x ∈ Ω, the number of other artworks in Ω that are similar
¯ 1 P
to x is ∆x . Let ∆ = |Ω| x∈Ω ∆x be the average number of artworks similar to a given
one.
Show that there exists a selection S of pairwise dissimilar artworks such that |S| ≥ 2|Ω|
∆¯.
Hint: Randomly select each artwork with a suitable probability, and then remove one
artwork from every similar pair.
Exercise 3.5. Two companies, A and B, each provide long-distance connections between 1000
cities. Every pair of cities must be connected by a direct link operated by exactly one of the
two providers.
We want to decide, for each pair of cities, which company provides the link between them so that
no group of 20 cities is completely dependent on a single provider; that is, within any subset of
20 cities, there must be at least one pair connected by an A-link and at least one pair connected
by a B-link.
Show that such an assignment of providers to pairs of cities is possible.
Hint: You can use that for any n ≥ k we have nk ≤ nk /k!.
28 Chapter 3. The probabilistic method
Exercise 3.6. A non-trivial 3-arithmetic progression (3-AP) is a set of three natural numbers
(a, a + d, a + 2d) where a, d ∈ N. Let [n] denote the set {1,
√
2, . . . , n}. Show that, for any n, there
3 n
exists a set S ⊆ [n] with no 3-AP and such that |S| ≥ 4 .
2
Hint: You can use that the number of 3-AP inside [n] is at most n4 . If you want to know
where this bound comes from, the number of 3-AP inside [n] is
n−1
n−1 n−1
2
X 1X 1X 1 n(n − 1) n2
(n − 2d) ≤ (n − d) = d= ≤ .
2 2 2 2 4
d=1 d=1 d=1
Chapter 4
Why do we say that an event occurs almost surely rather than surely when P(F ) = 1?
Because even when an event has probability one, there may still exist legitimate outcomes
in the probability space where it fails to occur.
For example, for F = {U ̸= 1/3} as above, we have P(F ) = 1 since P(U = 1/3) = 0; yet the
outcome U = 1/3 is perfectly valid. The term almost surely emphasizes this distinction: the
event holds except on a set of probability zero.
Î Recall 4.2 (Limit of sequences). Given a sequence of real numbers a1 , a2 , . . ., we say that
limn→∞ an = C for some C ∈ [−∞, ∞] if for every ε > 0 there exists n0 = n0 (ε) such that
29
30 Chapter 4. Asymptotics and convergence of random variables
(a) f (n) = e1/n converges to 1 (b) f (n) = (−1)n does not converge
√
(c) f (n) = n converges to ∞ (d) f (n) = sin(n) does not converge
P(|Xn − C| > ε) → 0.
p
Examples: If Xn ∼ Bernoulli(1/n) then Xn → − 0. Another example is the weak
P law of large
numbers. If Xn are i.i.d. with finite expectation µ ∈ (−∞, ∞), and Sn = n1 ni=1 Xi , then
p
Sn →
− E(X1 ).
4.3.2. Borel-Cantelli
In order to prove results about convergence of random variables, the following simple theorem
will be fundamental.
Chapter 4. Asymptotics and convergence of random variables 31
P∞
Proof. (i) Let τ = n=1 1(Fn ) be the number of Fn that occur. Therefore,
∞
X
E(τ ) = P(Fn ).
n=1
P∞
If n=1 P(Fn ) < ∞ we have that τ has finite expectation, which implies that P(τ < ∞) =
1.
(ii) It suffices to show that P ( ∞ c
T
n=m Fn ) = 0 for any m, since this means that for any m there
exists at least one Fn with n ≥ m that occurs. We write
∞ ∞ ∞ ∞
! !
\ Y Y X
c c
P Fn = P (Fn ) = (1 − P (Fn )) ≤ exp − P (Fn ) ,
n=m n=m n=m n=m
x
P∞ we used the inequality 1 − x ≤ e valid for all x ∈ R. The result then follows since
where
n=m P (Fn ) = ∞.
a.s.
Examples.
P∞ If Xn ∼ Bernoulli(1/n2 ) then Xn −−→ 0. This holds by Borel-Cantelli since
n=1 P(Xn = 1) < ∞. Now consider the example Xn ∼ Bernoulli(1/n), where Xn are in-
dependent of one another. does not converge a.s. (by the second part of Borel-Cantelli) but
converges in probability.
Instructor’s Note. The concept of almost sure convergence will be explained more
deeply in Fundamentals of Probability. For this module, it is important to understand the
difference with convergence in probability and convergence in L1 , and how to use Borel-
Cantelli to show almost sure convergence.
Sn a.s.
−−→ µ.
n
4.3.4. Convergence in L1
32 Chapter 4. Asymptotics and convergence of random variables
Figure 4.2: Illustration of the law Pof large numbers. The horizontal axis gives the value n and
the vertical axis gives f (n) = n1 ni=1 Xi the average of the first n elements, where X1 , X2 , . . .
are i.i.d. Exponential(1) random variables. The plot shows convergence to 1 for that particular
sampling of X1 , X2 , . . .. This is intuitively what almost sure convergence means: it says that with
probability 1 our sampling of X1 , X2 , . . . will be such that the sequence f (1), f (2), . . . converges
to 1.
Un
Examples. Let U1 , U2 , . . . be i.i.d. Uniform(0, 1) random variables, and set Xn = n . Then
Xn → 0 in L1 since
1
E(|Xn |) = → 0.
n
Now let Xn = n with probability 1/n, otherwise Xn = 0: it does not converge in L1 but
converges in probability. To see this, if this sequence were to converge in L1 we would have for
some value C that
Since 0 cannot be equal to 1 + |C| for any choice of C the sequence cannot converge in L1 .
Theorem 4.8 (Relation between types of convergence). Almost sure convergence implies
convergence in probability. Convergence in L1 implies convergence in probability. Almost
sure convergence and convergence in L1 are incomparable in general: neither implies the
other.
Proof. The first statement we leave as an exercise, and the second statement will be an ex-
ercise for the next week. For the third statement, we provide two examples. First, let U ∼
Uniform(0, 1) and Xn = n2 · 1(U ≤ 1/n). Then, Xn converges almost surely to 0 but does
not converge in L1 since E(Xn ) = n2 · n1 = n. To show that convergence in L1 does not imply
Chapter 4. Asymptotics and convergence of random variables 33
Definition 4.9 (Moment generating function). The moment generating function (m.g.f.) of
a random variable X is
MX (t) = E etX , t ∈ R,
The next theorem gives two important properties of moment generating function.
Theorem 4.10 (Moment generating function determines the distribution). Let X be a ran-
dom variable such that its moment generating function exists in a neighborhood of 0. Then,
• MX (t) uniquely determines the distribution of X,
(n) (n)
• MX (0) = E(X n ) where MX is the n-th derivative of MX (t).
If X ∼ Uniform(0, 1) then
1
et − 1
Z
MX (t) = ext dx = .
0 t
If X ∼ Exponential(λ) then
Z ∞
λ
MX (t) = λe−λx ext dx = , for t ∈ (0, λ).
0 λ−t
The moment generating function is useful to show that two random variables have the same
distribution. For this, we only need to show that their moment generating functions are the
same in some region around 0. However, not all random variables have a moment generating
1 tX ) = ∞
function. For example, X defined on R with density function fX (x) = π(1+x 2 ) has E(e
for all t ̸= 0.
Corollary 4.12 (Convergence in distribution via moment generating functions). Theorem 4.10
implies that if there exists ε > 0 so that for all t ∈ (−ε, ε) we have MXn (t) and MX (t) are finite
d
and MXn (t) → MX (t), then Xn −
→ X.
Example. Consider a random variable Xn which with probability 1/n is distributed according
to a Bernoulli(1/2) and with probability 1 − 1/n is distributed according to a Uniform(0, 1).
d
Then, Xn −
→ Uniform(0, 1) since, for any t ∈ (−1, 1) we have
t
et − 1
1 1 1 t 1 e −1
MXn (t) = + e + 1− → , as n → ∞,
n 2 2 n t t
where the right-hand side is the moment generating function of Uniform(0, 1).
A very important example of convergence in distribution is the Central Limit Theorem.
Î Recall 4.14 (Normal distribution). A random variable X ∼ N (µ, σ) has value in R with
density function
(y − µ)2
1
fX (y) = √ exp − .
2πσ 2 2σ 2
The law of large numbers and the central limit theorem are simple examples of a
universal behavior. If we have a sequence of i.i.d. random variables (Xn )n with finite mean
µ and finite variance σ 2 , then regardless of the actual distribution of the Xn we have
• The average mean Sn = n1 ni=1 Xi converges a.s. to µ, and
P
Pn
(Xi −µ)
• The “standardized sum” i=1 √
σ n
converges to N (0, 1) random variable.
Chapter 4. Asymptotics and convergence of random variables 35
4.6 Exercises
Exercise 4.1. Let U ∼ Exponential(1). For each of the following events, determine whether
the event occurs almost surely, and justify your answer:
(a) {U ̸= 2}.
(b) {U = 2}.
(c) {U ≤ 2}.
(d) {U ∈ N}, where N = {1, 2, . . .} denotes the set of natural numbers.
Exercise 4.2. Consider the sequence of graphs (Gn )n , where Gn ∼ G(n, p) with fixed p ∈ (0, 1)
and Gn = (Vn , En ). Recall that we identify Vn with [n] = {1, 2, . . . , n}. Let u denote vertex
number 1.
|En | a.s.
(a) Determine whether n −−→ p, and justify your answer.
2
dG (u) − (n − 1)p d
(b) Determine whether p n −
→ N (0, 1), and justify your answer.
(n − 1)p(1 − p)
(c) Let v denote vertex number 2. Consider the event Fn = {u and v have a common neighbor}.
Determine whether Fn occurs asymptotically almost surely.
Now assume that Gn ∼ G(n, pn ), where pn = c/n for some constant c > 0. Recall that dGn (u)
denotes the degree of vertex u in Gn .
d
(d) Show that dGn (u) −
→ Poisson(c).
Exercise 4.3 ( ). Let (Xn )n≥1 be random variables and let C ∈ R. Show that if
∞
X
P (|Xn − C| > ε) < ∞ for all ε > 0,
n=1
Exercise 4.4 ( ). This exercise will help you prove the Central Limit Theorem. Let (X Pn )n be
i.i.d. random variables with mean E(X1 ) = µ and variance Var(X1 ) = σ 2 , and let Sn = ni=1 Xi
be the sum of the first n values. The Central Limit Theorem states that
Sn − nµ d
√ −
→ N (0, 1).
σ n
Assume that there exists ε > 0 such that the moment generating function MX1 (t) exists for all
t ∈ (−ε, ε).
(a) Compute the moment generating function of a Normal random variable with parameters µ
and σ.
Xn −µ
(b) Let Yn = σ . Compute the moment generating function of Yn as a function of MX1 (·).
Note that Yn is a random variable with mean 0 and variance 1, and its moment generating
function exists in (−ε, ε). This implies that, letting φ(t) = log MY1 (t) , we can obtain a
constant C so that
t2 t2
− C|t3 | ≤ φ(t) ≤ + C|t3 |, for all t ∈ (−ε, ε).
2 2
Sn − nµ
(c) Compute the moment generating function of √ as a function of φ.
σ n
36 Chapter 4. Asymptotics and convergence of random variables
Sn − nµ d
(d) Justify why combining the inequalities for φ and the previous step implies that √ −
→
σ n
N (0, 1).
Exercise 4.6. Let X ∼ Exponential(1) and, for a > 0, define the random variable Y = aX.
(a) Compute the moment generating function of Y .
(b) Use this result to show that Y follows an Exponential(1/a) distribution.
Exercise 4.7. Imagine that we have a new digital currency called NewCoin, whose value starts
at 1 on day 0. Each day i = 1, 2, . . ., the value is obtained by taking the value from day i − 1 and
increasing it by one unit with probability p ∈ (0, 1), or decreasing it by one unit with probability
1 − p. Let Sn denote the value of NewCoin on day n.
Assume first that p = 32 .
(a) Compute E(Sn ) and Var(Sn ) as functions of n.
Sn
(b) Determine whether converges to some quantity. If so, find the limit and specify the
n
mode of convergence.
Now assume that p = 12 .
(a) ( ) Suppose that NewCoin is declared bankrupt the first time it reaches the value 0.
Does this event occur almost surely?
Chapter 5
Theorem 5.1 (Markov’s Inequality). Let X be a nonnegative random variable. Then, for
every m ∈ R+ , P (X ≥ m) ≤ E(X)
m .
Proof. It is equivalent to show that E(X) ≥ mP (X ≥ m). But this is already true since
E(X) = E (X1 (X < m) + X1 (X ≥ m))
= E (X1 (X < m)) + E (X1 (X ≥ m)) Linearity of expectation
≥ E (X1 (X < m)) + mE (1 (X ≥ m)) Using X ≥ m in the second term
≥ mP (X ≥ m) . Using X ≥ 0 in the first term.
Note that it is important that the random variable X is non-negative. Otherwise, the
following is a simple counterexample. Let X be the random variable that has value −2
with probability 14 and value 1 with probability 34 . Then, E(X) = (−2) 41 + 1 34 = 14 and
P (X ≥ 1) = P (X = 1) = 34 . However Markov’s inequality would give the incorrect bound
P(X ≥ 1) ≤ E(X) = 14 .
37
38 Chapter 5. First and second moment methods
Note that we have drawn all coupons after t samples if and only if X = 0.
Step 2: calculate expectations. Now we compute E(X) in order to apply Markov’s inequal-
ity. Everything we need is an upper bound on E(X). We start using linearity of expectations:
n
X
E(X) = E (Xi ) .
i=1
Since Xi is a Bernoulli random variable, E(Xi ) is the probability that Xi is equal to 1. This is
the probability that coupon i was never drawn, therefore
n n
1 t 1 t
X X
E(X) = P (Xi = 1) = 1− =n 1− .
n n
i=1 i=1
It is usually useful to write such types of “(1 − · · · )t ” bounds as an exponential using Lemma 5.2
that we state below. Since we need an upper bound on E(X), this goes in the correct direction,
giving
E(X) ≤ ne−t/n ≤ ne−c log n = n1−c ,
where we used the value of t in the last equality. Note that when c > 1 this bound goes to 0 as
n → ∞.
1 x
→ e−1
5.3 Fundamental inequalities: ex ≥ 1 + x and 1 − x
Despite its simplicity, the following inequalities are very useful and it is good to know them well.
6 Non-examinable material.
f ′ (x) = ex − 1.
This implies that f is increasing in (0, ∞) and is decreasing in (−∞, 0). So it has a point of
minimum at x = 0. Since f (0) = e0 − 1 − 0 = 0, we have that f (x) ≥ 0 for all x ∈ R, which
Chapter 5. First and second moment methods 39
6 Non-examinable material. The proof of Lemma 5.3 uses Lemma 5.4 below, which
in turn follows by analyzing the Taylor expansion of log(1 + x).
Lemma 5.4. For any x ∈ (−1/2, ∞),
2
1 + x ≥ ex−x .
1 x
1
exp −1 − ≤ 1− ≤ exp (−1) .
x x
where Ij,k is the indicator random variable that balls j and k land in the same bin. Note that
there exists a bin with at least two balls if and only if X ≥ 1.
Now compute
n
X X 1 2
E(X) = E(Ij,k ) = = .
m m
j̸=k∈[n] j̸=k∈[n]
Thus,
n(n − 1)
E(X) = → 0 as n → ∞ (since m ≫ n2 ).
2m
Therefore, a.a.s. every bin contains at most one ball.
40 Chapter 5. First and second moment methods
Î Recall 5.5 (Notation ≪ and ≫). Given two functions f (n) and g(n) the notation f (n) ≪
g(n) means that limn→∞ fg(n)
(n)
= 0. The notation f (n) ≫ g(n) means that limn→∞ fg(n)
(n)
= ∞.
f (n)
We say that f and g have the same order of magnitude if limn→∞ g(n) ∈ (0, ∞).
This is also known as the birthday paradox. If m = 365 is the number of days of the year,
and we have n students, assuming the birthday of each student is distributed independently
and uniformly at random over the year, the probability that two
√ students share a birthday
is small only when n is relatively small (not much larger than 365).
where the inequality is an application of Markov’s inequality since the sum of indicators is a
non-negative random variable.
What if E(X) is large? Does this imply that P(X ≥ 1) is large and the event occurs?
Not necessarily. Consider the following simple example. Let X be a random variable that
9 1 n
equals 0 with probability 10 and equals a parameter n with probability 10 . Then E(X) = 10 ,
1
which grows with n. However, P(X ≥ 1) = 10 , which does not depend on n. Not really:
9 1
Let X be 0 with probability 10 and equals a parameter n with probability 10 .
Now (X − E(X))2 is a non-negative random variable, and the result follows by applying Markov’s
inequality to that random variable noting that E (X − E(X))2 = Var(X).
(1 − θ)2 E2 (X)
P(X ≥ θE (X)) ≥ .
E (X 2 )
E2 (X)
Taking the limit as θ → 0, we obtain P (X > 0) ≥ E(X 2 )
.
Two simple corollaries are worth noting. First, setting X = Y makes the two terms equal.
Second, if Y = 1 (the constant random variable), we obtain the inequality E2 (X) ≤ E(X 2 ),
which in turn implies that Var(X) ≥ 0 for any random variable.
6 Non-examinable material.
Before proving the Paley–Zygmund inequality, we recall a fundamental tool known as the
Cauchy–Schwarz inequality, stated here in the form for random variables.
Thus, p p
E (X) ≤ θE (X) + E (X 2 ) P(X ≥ θE (X)).
42 Chapter 5. First and second moment methods
Rearranging gives p p
(1 − θ)E (X) ≤ E (X 2 ) P(X ≥ θE (X)).
Squaring both sides and reorganizing we obtain
(1 − θ)2 E2 (X)
P(X ≥ θE (X)) ≥ .
E (X 2 )
Since the above works for all θ > 0, we can take the limit in both sides as θ → ∞.
What does Theorem 5.8 tell us? In essence, it says that if E(X) is large and Var(X) is relatively
small (for instance, at most CE2 (X) for some constant C) then
E2 (X) 1
P (X > 0) ≥ 2
≥ .
(C + 1)E (X) C +1
In particular, this gives a positive lower bound on the probability that X is at least a constant
fraction of its expectation.
where Ij,k is the indicator random variable that balls j and k fall into the same bin. Then,
n
X X 1
2
E(X) = E(Ij,k ) = = .
m m
j̸=k∈[n] j̸=k∈[n]
where Ip2 = Ip because Ip ∈ {0, 1}. The second sum is over pairs of pairs p, p′ such that p < p′ .
So each pair of pairs is counted exactly once, justifying the number 2 appearing before the sum.
Then X X X
E(X 2 ) = E(Ip ) + E(Ip Ip′ ) = E(X) + E(Ip Ip′ ).
p∈P p<p′ p<p′
For the cross term E(Ip Ip′ ), there are two cases:
• Disjoint tuples. If the pairs p and p′ have no element in common, then events are independent,
so
1
E(Ip Ip′ ) = E(Ip )E(Ip′ ) = 2 .
m
Chapter 5. First and second moment methods 43
• Non-disjoint tuples. If p and p′ have one ball in common, then p ∪ p′ is a set of three balls
and all need to fall inside the same bin. There are m possible bin, so the probability that all
three go into the same bin is
m 1
E(Ij,k Ij,k′ ) = 3 = 2 .
m m
Putting everything together, we obtain
2
X 1 |P | 1
E(X ) = E(X) + 2 2
= E(X) + 2 .
′
m 2 m2
p<p
n
Since |P | = 2 we get
n
|P | 2 1 n n n (n + 1)(n − 2)
= = −1 = .
2 2 2 2 2 2 4
as long as m ≪ n2 . Consequently,
P(X > 0) → 1.
t
Here we cannot use the upper bound 1 − n1 ≤ e−t/n since the second-moment method requires
a lower bound on E(X). There are other inequalities that we can use to obtain a lower bound
on the expression above. But, in general, for the second moment method, it is better to remain
with an equality at this point since E(Xi ) naturally appears in the calculation of the second
moment. The main thing we need to assess is that E(X) does not go to zero with n.
n
From Lemma 5.3, we know that 1 − n1 → e−1 . Therefore, for any ε > 0, there exists
n0 = n0 (ε) such that
1 n
1− ≥ e−1−ε .
n
Thus, for all large enough n we have
n·t/n
1
E(X) = n 1 − ≥ ne−(1+ε)t/n = n1−(1+ε)c .
n
Since ε > 0 is arbitrary and c < 1, we chose ε so that c(1 + ε) < 1, so the above is valid for this
choice of ε for all large enough n. Consequently,
E(X) → ∞.
since we need that each of the t draws avoids the i-th and j-th coupons. Putting things together
we have
1 t 2 t 1 t 2 t
2 n
E(X ) = n 1 − +2 1− ≤n 1− + n(n − 1) 1 − .
n 2 n n n
At this moment wet need to see that this expression does not go to zero as n → ∞. We already
saw that n 1 − n1 → ∞ and note that n(n−1) n2
→ 1. As for the remaining term, note that
2 t 2 t 2 t
1− n 1− n 1− n
= ≤ = 1.
1 2t 2 1 t 2 t
1− n
1− n + n2 1− n
Therefore,
1
lim P(X > 0) ≥ t ≥ 1.
n→∞ (1− n2 )
limn→∞ 2t
(1− n1 )
5.12 Exercises
Exercise 5.1. Let X be a random variable such that E(X 4 ) = 10. Determine whether P(X ≥
1
10) ≤ 1000 , justifying your answer.
Exercise 5.3. Let X1 , X2 , . . . be a sequence of random variables such that the following two
properties hold:
E(Xn2 )
• E2 (Xn )
→ 1 as n → ∞, and
• limn→∞ E(Xn ) > 0.
Show that P(Xn > 0) → 1 as n → ∞.
Exercise 5.4. Let X be a bounded random variable. That is, there is a value M ∈ (−∞, ∞)
−E(X)
such that P(X ≤ M ) = 1. Show that for any a < E(X) we have P(X ≤ a) ≤ MM −a .
Hint: consider the random variable Y = M − X.
Exercise 5.5. Let Gn ∼ G(n, p). We say that Gn has an isolated vertex if Gn has a vertex of
degree 0. This exercise will show that the property of having an isolated vertex for G(n, p) has
a phase transition at log(n)
n .
c log(n)
(a) Show that if p ≥ n for some constant c > 1 then Gn has no isolated vertex a.a.s.
c log(n)
(b) Show that if p ≤ n for some constant c < 1 then Gn has an isolated vertex a.a.s.
Exercise 5.6. Toss a fair coin n times, independently of one another. Let Ln be the length of
the longest consecutive sequence of heads among the n tosses.
(a) Show that for any c > 1, Ln is smaller than c log2 (n) a.a.s. as n → ∞.
(b) Show that for any c < 1, Ln is larger than c log2 (n) a.a.s. as n → ∞.
Exercise 5.7. A virus begins with a single particle at time 0 (called generation 0). At each
unit of time every particle splits into two offspring, and each offspring independently either
• does not mutate (it has exactly the same genome as its parent) with probability p, or
• mutates with probability 1 − p.
The particles present at time i ∈ {0, 1, 2, . . .} are called the particles of generation i, and the
single particle at generation 0 is referred to as the root particle. Once a mutation occurs in some
offspring particle v, all the descendants of v are considered “mutated” and no longer count as
having the same genome as the root particle.
Let Zn be the number of particles in generation n whose genome is still identical to the genome
of the root particle.
(a) Show that E(Zn ) = (2p)n .
1
(b) Use Markov’s inequality to show that if p < 2 then the genome of the root particle will
p
eventually cease to exist, that is Zn →
− 0.
1 (1−(2p)−n )
(c) Assume p > 2 and show that E(Zn2 ) = (2p)n + (2p)2n 1
2(1− 2p )
.
(d) Apply the Paley–Zygmund inequality to deduce that for p > 12 the genome of the root
particle does not cease to exist with positive probability. That is, show that limn→∞ P(Zn >
46 Chapter 5. First and second moment methods
0) > 0.
Exercise 5.8. At a conference, n identical chairs are arranged evenly around a large circular
table. In the morning session, m researchers from Team A sit down uniformly at random
on distinct chairs. Later, in the afternoon, m researchers from Team B arrive and sit down
uniformly at random on distinct chairs that are not occupied by a researcher from Team A.
Two researchers sitting in neighbouring chairs can easily start a conversation. Let X be the
number of adjacent pairs of chairs where one chair is occupied by a member of Team A and the
other by a member of Team B.
We want to determine for which team size m = m(n) we have that a conversation can start
among researchers from different teams. To do this, determine a function f (n) such that if
m ≫ f (n) we have X ≥ 1 a.a.s., and if m ≪ f (n) we have X = 0 a.a.s.
Exercise 5.9. An ant is located at a vertex a of a graph G and a food source is located at a
vertex f . The graph G is such that the vertices a and f are connected by n disjoint paths, each
of length n. Recall that the length of a path is the number of edges in the path. Below is an
illustration for n = 4:
a f
In the graph G, each edge is free with probability e−φ and blocked with probability 1 − e−φ ,
independently of all other edges, where φ = φn > 0 is a parameter that may depend on n. The
ant can reach the food source only by traversing edges that are free.
Determine a function fn of n such that, as n → ∞,
• if φ ≪ fn , the ant can reach the food source a.a.s.;
• if φ ≫ fn , the ant cannot reach the food source a.a.s.
wedges in Gn (i.e., the number of triples {u, v, x} such that {u, v} , {v, x} ∈ En ). Assume that
limn→∞ |E n| wn
|Vn | = ∞ and limn→∞ |En |2 = 0.
Exercise 5.11. This exercise is meant to show that Markov’s inequality cannot be improved
in general.
Chapter 5. First and second moment methods 47
Let X be a non-negative random variable. Show that there is a probability distribution for X
so that
1
P (X ≥ 2E(X)) = .
2
Exercise
Pn 5.12. Let X1 , X2 , . . . , Xn be i.i.d. Bernoulli(1/2) random variables. Let Sn =
X
i=1 i .
(a) Use Markov’s inequality to obtain a upper bound on P Sn ≥ 3n
4 .
(b) Use Chebyshev’s inequality to obtain a upper bound on P Sn ≥ 3n ∪ Sn ≤ 14 .
4
Exercise 5.13. Let Gn ∼ G(n, p) and denote Gn = (Vn , En ). Let Tn be the number of triangles
in Gn ; that is, Tn is the number of triplets u, v, w ∈ Vn such that {u, v}, {u, w} and {v, w} all
belong to En . A triangle is also called a 3-clique.
(a) Show that if p ≪ n−1 then Gn has no triangle a.a.s.
(b) Show that if p ≫ n−1 then Gn has at least one triangle a.a.s.
Exercise 5.14. This exercises revisits the random procedure we did to obtain a lower bound
on the maximum cut of a graph via the probabilistic method.
Let G = (V, E) be any graph with m = |E| edges. Consider the following randomized procedure
to construct random sets of vertices S1 , S2 , . . .: place each vertex of V independently into S1
with probability 1/2, and let X1 = |∂S1 | be the number of edges crossing the cut S1 . Repeat this
procedure k times independently, obtaining X1 , X2 , . . . , Xk , and let Mk = max{X1 , . . . , Xk } be
the largest cut found.
(a) Show that E (X) = m/2 and Var (X) = m/4.
(b) Use Chebyshev’s inequality to prove that for every t > 0,
m
P (X1 ≥ m/2 + t) ≤ .
4t2
P M ≥ 12 + α m → 0,
so repeating the algorithm a “sublinear” number of times cannot improve much beyond the
expected value m/2 by any constant fraction.
Chapter 6
Chernoff bound
Var (X)
P (|X − E (X)| ≥ ε E (X)) ≤ ,
ε2 (E (X))2
which holds for every θ ∈ R+ . Note that eθX is a nonnegative random variable, so we are set
up to apply Markov’s inequality:
P (X ≥ (1 + ε)E (X)) = P eθX ≥ eθ(1+ε)E(X) ≤ e−θ(1+ε)E(X) E eθX .
Since this bound holds for every θ > 0, we may optimize over θ to get as good a bound as
possible:
P (X ≥ (1 + ε)E (X)) ≤ inf E eθX e−θ(1+ε)E(X) .
θ>0
48
Chapter 6. Chernoff bound 49
Theorem 6.1 (Chernoff bound for Bernoulli: upper tail). Let X1 , X2 , . . . , Xn beP
independent
Bernoulli random variables (not necessarily identically distributed). Let Sn = ni=1 Xi and
1 Pn
p = n i=1 E (Xi ). Then, for any λ > np,
λ
P (Sn ≥ λ) ≤ exp −λ log − 1 − np .
np
where the last step follows by independence of Xi ’s. If we know the moment generating function
of each Xi we can compute the product; otherwise we may bound it and then choose the value
of θ that optimizes
(i.e., minimizes) the bound. Since the Xi are Bernoulli, if pi = E(Xi ) we
have that E eθXi = pi eθ + (1 − pi ). Then,
n
Y
−θλ
P (X ≥ λ) ≤ e pi eθ + (1 − pi )
i=1
n
Y
−θλ
=e pi eθ − 1 + 1
i=1
n
!
X
≤ exp −θλ + pi eθ − 1
i=1
= exp −θλ + np eθ − 1 . (6.2.1)
λ
Note that we used Lemma 5.2 in the second inequality. The bound is optimized when eθ = np .
First it is important to check that this bound is feasible, and in fact it is since λ > np. This is
natural, since we should not get a good decay on the probability P(X ≥ λ) when λ < E(X) = np.
λ
How do you show that the bound is optmized when eθ = np ? Well, you need to differentiate
θ
−θλ + np e − 1 and see where the minimum of this expression is as a function of θ. That is,
we first computer
d
−θλ + np eθ − 1 = −λ + npeθ
dθ
and then noticed that the above is zero when
npeθ = λ.
50 Chapter 6. Chernoff bound
You must also notice that this is indeed a minimum of the function; a quick second derivative
check completes this part of the argument:
d2
θ
−θλ + np e − 1 = npeθ > 0.
dθ2
λ
So, indeed, eθ = np is a minimum.
Now replacing this value of θ into (6.2.1) we obtain
λ
P (X ≥ λ) ≤ exp −λ log − 1 − np .
np
You are expected to understand the proof until this point. In applications, the bound above is
a bit cumbersome to use. So, in practice, the bound below is more easily applicable:
2
ε np
P (X ≥ (1 + ε)np) ≤ exp − .
2+ε
The derivation of this final step is beyond the scope of this module; it goes by analyzing carefully
the function log(1 + ε).
Proof. Repeat the argument leading to (6.2.1), replacing θ by −θ and optimizing at e−θ = λ
np
(now λ < np, where λ = (1 − ε)np):
λ
P (X ≤ λ) ≤ exp −λ log − 1 − np .
np
Chapter 6. Chernoff bound 51
Now you set λ = (1 − ε)np. As with the upper tail, you should be able to get up to this point,
but the bound you will obtain is difficult to work with in applications. To turn it into a more
useful bound, you apply inequalities such as (1 − ε) log(1 − ε) ≥ −ε + ε2 /2, which you do not
need to remember for this module. At the end, you obtain the following more useful bound:
2
ε np
P (X ≤ (1 − ε)np) ≤ exp − .
2
We could derive a Chernoff bound directly for St , since its distribution is known, but for simplic-
ity (and to practice the method) we reduce to Bernoulli variables to use Theorems 6.1 and 6.2.
1+Xi
Note that if we set Yi = 2 , then Yi ∼ Bernoulli(p). Thus
t
X 1 + Xi t + St t + E (St ) t + tρ t(1 + ρ)
Y = = , µ = E (Y ) = = = .
2 2 2 2 2
i=1
Using the Bernoulli Chernoff bounds (Corollary 6.3), for any δ ∈ (0, 1),
2
ε µ
P (|Y − µ| ≥ εµ) ≤ 2 exp − .
3
From this we obtain concentration of St around tρ by writing, for any δ ∈ (0, 1),
|St − tρ| δtρ
P (|St − tρ| ≥ δtρ) = P ≥
2 2
δtρ
= P |Y − µ| ≥ µ
2µ
δρ
= P |Y − µ| ≥ µ .
1+ρ
52 Chapter 6. Chernoff bound
δρ δρ
Note that 1+ρ ∈ (0, 1). Plugging this into the Chernoff bound above (with ε = 1+ρ ) yields
δ 2 ρ2 µ δ 2 ρ2 t
P (|St − tρ| ≥ δtρ) ≤ 2 exp − = 2 exp − .
3(1 + ρ)2 6(1 + ρ)
This inequality shows that after t steps, St is concentrated around tρ. For any fixed
δ > 0, the probability that the random walk lies outside ((1 − δ)E(St ), (1 + δ)E(St )) decays
exponentially fast in t. If δ decreases with t, for example δ = √1t , the exponential term
δ 2 ρ2 t ρ2 √
becomes 6(1+ρ) = 6(1+ρ) , independent of t. This is expected since δtρ scales as tρ, match-
ing the growth of the standard deviation of St , so the probability of leaving the interval
((1 − δ)E(St ), (1 + δ)E(St )) remains bounded away from zero. The Chernoff bound thus
reveals that whenever δ ≫ √1t , the probability already decays exponentially fast with δ 2 t.
Proof. Let K be any value. If ∆n ≥ K then there exists u ∈ Vn such that dGn (u) ≥ K. So we
can write X
P (∆n ≥ K) ≤ P (dGn (u) ≥ K) .
u∈Vn
Note that dGn (u) ∼ Binomial(n − 1, p). Using the Chernoff Bound (first inequality in Theo-
rem 6.1) gives
K
P (degGn (u) ≥ K) ≤ exp −K log −1 .
(n − 1)p
Note that the right-hand side above does not depend on u. So we obtain
K
P (∆n ≥ K) ≤ n exp −K log −1 .
(n − 1)p
So we need to take K large enough so that the bound above goes to 0as n →∞. For this, it
suffices to set K so that K ≫ log log n since for such a K we obtain K log (n−1)p − 1 ≥ K log
log n K
2
K
for all large enough n. Moreover, we need K ≪ log n so that P (∆n ≥ K) → 0 gives that
∆n ≪ log n. Therefore, we need to set K to be much larger than logloglogn n and much smaller than
log n; for example, set K = √ log n and we obtain for all large enough n that
log log n
log n log √ log n
log n log log n
P ∆n ≥ √ ≤ n exp − √
log log n 2 log log n
log n
log √log log n
= exp log n − log n √
2 log log n
→0 as n → ∞.
Chapter 6. Chernoff bound 53
Suppose we have a sequence of graphs G1 , G2 , . . . where Gn = (Vn , En ) with n = |Vn |. For each
n, independently sample a uniform random permutation π of Vn and order the vertices according
to this permutation. Let Fn be the event that there exists an edge {u, v} ∈ En such that u and v
are adjacent in the permutation. Let wn = v∈Vn dGn2 (v) be the number of wedges in Gn (i.e.,
P
|En |
the number of triples {u, v, x} such that {u, v} , {v, x} ∈ En ). Assume that limn→∞ |Vn | =∞
and limn→∞ |Ewnn|2 = 0.
Use the second-moment method to show that as n → ∞ we have P (Fn ) → 1.
6.6 Exercises
2
Exercise 6.1. Let X ∼ N (0, 1). Using E eθX = eθ /2 , show that for t > 0,
2 /2
P(X ≥ t) ≤ e−t .
Exercise 6.3. Let n, m be integers, and consider the random graph G = (V, E) where V =
{1, 2, . . . , n} is the vertex set, and E is a random set of m edges chosen independently and
uniformly with replacement among the n2 possible unordered pairs of vertices. Thus, multiple
edges between two vertices are allowed. Assume that m = Cn for some fixed constant C > 0,
and let I be the number of isolated vertices in G (that is, the number of vertices of degree 0).
(a) Compute E (I).
(b) Show that a.a.s. the maximum degree of G is at most log n.
Exercise 6.4. Let G ∼ G(n, p), and let A, B ⊆ V (G) be two disjoint subsets of size k ≥ 1. Let
X(A, B) denote the number of edges with one endpoint in A and one in B.
(a) Use the Chernoff bound to prove that, for any fixed A, B,
2 2
2 2
ε pk
P |X(A, B) − pk | ≥ εpk ≤ 2 exp − .
3
(b) Apply a union bound over all possible pairs of disjoint k-sets to show that a.a.s. all pairs
A, B satisfy |X(A, B) − pk 2 | ≤ εpk 2 , provided pk ≫ log n as n → ∞.
k
Hint: you can apply the inequality nk ≤ ne
k which holds for all n ≥ k > 0.
Exercise 6.5. A winery has 20,000 vines. On each vine, the number of grape clusters is an
independent Poisson (100) random variable, and conditioned on the number of clusters, each
cluster independently contains a Poisson (50) number of grapes. During the production, to
reduce the density of grapes and increase the quality of the final product, each grape cluster
is cut and discarded with probability 1/2, independently of everything else. We call this the
pruning step. When a grape cluster is discarded during pruning, all the grapes in that cluster
are discarded. For each grape cluster that was not discarded during pruning, each individual
grape fails to mature and is also discarded with probability 1/5, independently. This is called
the maturity check step.
54 Chapter 6. Chernoff bound
and λ
e−ε
P(X ≤ (1 − ε)λ) ≤ .
(1 − ε)1−ε
(c) Show that after the pruning step, the number of remaining grape cluster in a given vine is
Poisson(50).
(d) Show that, given a grape cluster that remained after the pruning step, the number of grapes
in that cluster that were not discarded during the maturity check is Poisson(25).
(e) Let C be the total number of grape clusters in the winery after pruning. Show that
C ∼ Poisson(1,000,000).
(f) Consider the random variable C from the previous item. Show that P(C < 800,000) ≤
e−10,000 .
e−ε −ε2 /2 .
Hint: You can use that for any ε ∈ (0, 1) we have (1−ε)1−ε ≤ e
(g) ( ) Consider the random variable C from the previous two items and let G be the
total number of usable grapes after the pruning and maturity check steps. Show that
P(G ≤ 16,000,000 | C ≥ 800,000) ≤ e−400,000 .
(h) Suppose that the winery needs at least 16,000,000 fully matured grapes to produce its usual
amount of wine. Use the result from the previous two parts to show that the probability
that the winery does not have enough grapes to produce its usual amount of wine is at
most e−10,000 − e−400,000 .
Exercise 6.7. Let G ∼ G 100, 91 , and let X be the total number of edges in G.
Martingale
t
X
St = St−1 + Xt = S0 + Xi .
i=1
We showed via Chernoff bound that for large time t the random walk is concentrated around
tρ, where ρ = E(X1 ) = 2p − 1. We also showed that the probability that |St − tρ| > εtρ decays
exponentially fast with tρ.
A walker that jumps one unit to the right or to the left is called a simple random walk. If
p = 1/2 the random walk is called unbiased, while it is biased if p ̸= 1/2.
7.2 σ-algebra
The definition of σ-algebra is more general, and in the case of continuous random variables it is
more involved. However, the definition above will suffice in this module.
The concept of σ-algebra is a way to model the information revealed by a set of random vari-
ables.
56
Chapter 7. Martingale 57
Example: for the example of random walk on Z, the three random variables below are measurable
with respect to σ(X1 , X2 , . . . , Xt ):
• St ,
• max {Si : i ∈ {0, 1, 2, . . . , t}},
• ti=1 {Si = 0}.
S
7.3 Filtration
In our simple random walk example, Ft contains everything we know after the first t steps, such
as St and any function of X1 , . . . , Xt . So having a filtration is a way of revealing more and more
about the random walk.
Definition 7.4 (Adapted sequence). Given a filtration {Ft }t≥0 , a sequence of random vari-
ables Y1 , Y2 , . . . , is said to be adapted to (Ft ) if each Yt is measurable with respect to Ft .
Proof. For the first three items, it is enough to note that the equalities holds for each possible
values x1 , . . . , xt of the random variables X1 , X2 , . . . , Xt . Therefore, the equality should hold for
the random variable E(· | X1 , . . . , Xt ).
We now prove the last item. Assume that X1 , . . . , Xt are discrete random variables (otherwise
replace sums by integrals). Then, for any x1 , . . . , xs we have
E (E(Y | X1 , . . . , Xt ) | X1 = x1 , . . . , Xs = xs )
X
= E(Y | X1 = x1 , . . . , Xt = xt )P (Xs+1 = xs+1 , . . . , Xt = xt | X1 = x1 , . . . , Xs = xs )
xs+1 ,...,xt
= E(Y | X1 = x1 , . . . , Xs = xs ).
E (E(Y | X1 , . . . , Xt ) | X1 , . . . , Xs ) = E (Y | X1 , . . . , Xs ) .
7.5 Martingales
Definition 7.7 (Martingale). Let (Ft )t≥0 be a filtration. A sequence of random variables
(Mt )t≥0 is a martingale with respect to (Ft ) if all the following hold:
(i) E(|Mt |) < ∞ for all t;
(ii) (Mt ) is adapted to (Ft ), that is Mt is measurable with respect to Ft ;
(iii) E(Mt+1 | Ft ) = Mt for all t.
If (i) and (ii) above hold and E(Mt+1 | Ft ) ≤ Mt , we say that (Mt ) is a supermartingale. If
(i) and (ii) above hold and E(Mt+1 | Ft ) ≥ Mt , we say that (Mt ) is a submartingale.
Definition 7.8 (Stopping time). Let (Ft )t≥0 be a filtration. A random time τ ∈ Z+ ∪ {∞}
is a stopping time if for every t ≥ 0, the event {τ ≤ t} belongs to Ft .
In words: at time t, we can tell whether the stopping time has already occurred, using only the
information revealed by Ft .
The following are examples of stopping times.
• The hitting time τa = inf {t ≥ 0 : St = a}.
• The first return time τ0+ = inf {t ≥ 1 : St = 0}.
• The first exit time, inf {t ≥ 0 : St ̸∈ [−10, 10]}.
The last visit to the origin sup {t ≥ 0 : St = 0} is not a stopping time.
Note that Zt is equal to Mt for all t ∈ {0, 1, 2, . . . , τ } and then, from time τ onwards Zt remains
stopped at Mτ ; that is, Zt = Mτ for all t > τ .
60 Chapter 7. Martingale
Theorem 7.10 (Stopped martingales are martingales). Let {Mt }t be a martingale and τ be
a stopping time with respect to a filtration {Ft }t . Define Zt = Mt∧τ for all t. Then Zt is a
martingale with respect to {Ft }t .
Proof. Note that Zt = Mt 1 (τ ≥ t) + Mτ 1 (τ ≤ t − 1). We first check property (i). Notice that
Mt is measurable with respect to Ft . Since τ is a stopping time, both indicator functions are
measurable with respect to Ft .
For property (ii), note that
since E(|Mi |) < ∞ for all i and the supremum is taken over a finite number of elements.
Finally, for property (iii) we write
Note that {τ ≥ t + 1} ∈ Ft . For the second term, note that Mτ 1 (τ ≤ t) is equal to 0 if τ > t
and it is equal to some M1 , M2 , . . . , Mt if τ ≤ t. In particular, Mτ 1 (τ ≤ t) is measurable with
respect to Ft . Therefore
E (Zt+1 | Ft ) = 1 (τ ≥ t + 1) · E (Mt+1 | Ft ) + Mτ 1 (τ ≤ t)
= Mt 1 (τ ≥ t + 1) + Mτ 1 (τ ≤ t) = Zt ,
Proof of Theorem 7.11 for bounded stopping times. Let τ take values in {0, 1, . . . , T } for some
fixed T . Define the stopped process Mt′ = Mt∧τ . By Theorem 7.10, we know that Mt′ is a
martingale. Therefore, E(Mt′ ) = E(M0′ ) = M0 for all t. If we then set t = T , we note that
τ ∧ T = τ , which gives
M0 = E(MT′ ) = E(MT ∧τ ) = E(Mτ ).
Proposition 7.12. Let p = 1/2 and {St }t be an unbiased simple random walk. For any a ∈ Z
recall that τa = inf {t ≥ 0 : St = a}. Then,
b
P (τa < τ−b ) = .
a+b
Proof. Let τ−b,a = τa ∧ τ−b . {St }t is a martingale for the filtration Ft = σ(X1 , X2 , . . . , Xt ), and
τ−b,a is a stopping time. We need to show that we can apply optional stopping. First τ−b,a
is not bounded (so regularity condition (i) does not hold), but we can see that the regularity
condition (ii) is satisfied because St − St−1 ∈ {−1, 1}, so it is bounded, and E(τ−b,a ) < ∞. The
reason for this second fact is that if St ∈ (−b, a) and the walker takes b + a consecutive steps to
the right, then St+a+b ̸∈ (−b, a). The probability that such event happens is 2−a−b . If Y is a
geometric random variable with parameter 2−a−b then E(τ−b,a ) ≤ E ((a + b)Y ) = (a + b)E(Y ) =
(a + b)2a+b < ∞.
We now apply the Optional Stopping Theorem:
E(Sτ−b,a ) = E(S0 ) = 0.
where the last step follows since St ∈ [−b, a] for t ≤ τ and E (τ ) was proved in the previous
example.
We can then apply the Optional Stopping Theorem, which gives
E(Mτ ) = E(M0 ) = 0.
Hence
E(Sτ2 ) − E(τ ) = 0 ⇒ E(τ ) = E(Sτ2 ).
b
P (τ−b = ∞) ≤ lim P (τa < τ−b ) = lim = 0.
a→∞ a→∞ a+b
This shows that simple random walk on Z is recurrent, meaning that it reaches any given
vertex after finitely many steps a.s. Curiously, for any b ∈ Z+ , we have
1 − βb
P (τ−b = ∞) = lim P (τa < τ−b ) = lim = 1 − β b ∈ (0, 1).
a→∞ a→∞ 1 − β a+b
Thus biased simple random walk on Z is transient: it has a positive probability of never
visiting a given vertex.
Consider a (non-simple) random walk St = ti=1 Xi starting from S0 = 0 and such that Xi are
P
i.i.d. with P(Xi = −1) = 2/3 and P(Xi = 2) = 1/3. Note that E(Xi ) = 0 as in the unbiased
b
simple random walk case. We showed in class that P(τa < τ−b ) < a+b .
Chapter 7. Martingale 63
Think of a gambling game, where at step i we get Xi pounds. Then St is the total
amount we gained or losed after t steps, and q = P(τa < τ−b ) is the probability that we
manage to get a target profit of a before losing all of our initial capital b. The example
above shows that, if the goal is to maximize q, then the unbiased simple random walk is a
better game to play.
7.9 Exercises
Exercise 7.1. Suppose we invest S0 = £2 in a risky fund. At each month t ∈ {1, 2, . . .}, one
of the following happens independently of Ft−1 :
• with probability p ∈ (0, 1) the fund goes bankrupt and our capital becomes St = 0 (and stays
0 thereafter),
• with probability 1 − p the fund grows deterministically from St−1 to St = 2St−1 .
We would like to accumulate £210 . So let
τ = inf t ≥ 0 : St ≥ £210 or St = 0 .
Exercise 7.2. Let {Mt }t be a submartingale and τ be a stopping time with respect to the
filtration {Ft }t . Show that if Mt′ = Mt∧τ then {Mt′ }t is a submartingale with respect to {Ft }t .
1
Note that each step takes integer values in {−1, 0, 1, 2, . . .}, with mean E(Xi − 2) = p − 2.
64 Chapter 7. Martingale
(a) Show that the moment generating function of Yi := Xi − 2 exists for θ < − log(1 − p) and
is given by
p e−θ
E eθYi = .
1 − (1 − p)eθ
1 − β −b
P(τa < τ−b ) ≤ .
β a − β −b
Exercise 7.4 ( ). During a winter business dinner, n people leave their coats at the restaurant
entrance (with no identification). At the end of the dinner, all n people come to pick up their
coats at the same time. The owner, not knowing whose coat is whose, chooses a uniformly
random permutation of the n coats and hands them out accordingly. Everyone who gets their
own coat is happy and leaves. Let L1 be the number of such people. The remaining n − L1
people return to the owner and complain. The owner then takes the remaining n − L1 coats
and, independently of everything else, chooses a uniformly random permutation of these coats
and hands them out to the n − L1 people. Let L2 be the number of people who now get their
own coat and leave; the other n − L1 − L2 again complain. The owner repeats this procedure
until everyone receives their own coat. Let ξ be the total number of rounds needed (i.e., the
smallest integer with L1 + L2 + · · · + Lξ = n).
Determine E (ξ).
Hint: compute E(L1 ) and try to come up with a martingale that allows you to use optional
stopping and obtain E(ξ).
St = X1 + X2 + · · · + Xt , S0 = 0,
where {Xi }i≥1 are i.i.d. random variables with E(Xi ) = 0 and |Xi | ≤ c for some constant c ≥ 1.
Assume further that P(X1 ̸= 0) > 0 to avoid trivial cases.
(a) Show that {St } is a martingale with respect to its natural filtration Ft = σ(X1 , . . . , Xt ).
(b) Let Mt = St2 − t E(X12 ). Show that {Mt } is a martingale.
(c) Fix a ≥ 1 and define τa = min {t : |St | ≥ a}. For each fixed integer n ≥ 1, define the
stopping time sn = τa ∧ n. Show that limn→∞ E(sn ) < ∞.
(d) Use the above to show that τa < ∞ almost surely.
Hint: note that sn ≥ n · 1 (τa = ∞) for all n ≥ 1.
• Y = X · 1 (X ∈ {2, 4}),
• Z = X · 1 (X ∈ {2, 4, 6}).
Describe the distribution or determine the value of the following quantities:
(a) E (X | I).
(b) E (I | X).
(c) E (I · J | Y ).
Now consider the sequence of σ-algebras
F1 = σ(I), F2 = σ(Z), F3 = σ(X).
(d) Is the sequence F1 , F2 , F3 a filtration?
Exercise 7.7. We invest an initial amount S0 = £1,000 in a fund whose value changes monthly
as follows. At the end of each month t ∈ {1, 2, . . .}, independently of the past,
(
(1 + ε) St−1 , with probability 1/2,
St =
(1 − ε) St−1 , with probability 1/2,
where ε ∈ (0, 1) is fixed. For each t ∈ Z+ , define the filtration Ft = σ(S0 , S1 , . . . , St ).
(a) Determine whether {St }t is a martingale with respect to {Ft }t .
(b) Compute the expected value of the investment after five years.
(c) Suppose that after one year (twelve months) the investment is worth £1,500. Conditioned
on this information, compute the expected value of the investment after five years.
Exercise 7.8. Consider two simple random walks {St }t and {St′ }t on Z defined as follows. Fix
p ∈ (1/2, 1) and let X1 , X1′ , X2 , X2′ , . . . be i.i.d. random variables taking values in {−1, 0, 1} with
1 p 1−p
P(X1 = 0) = , P(X1 = 1) = , and P(X1 = −1) = .
2 2 2
Pt Pt
Let S0 = S0′ = 0 and, for every t ∈ N, define St = i=1 Xi and St′ = ′
i=1 Xi . Define also the
relative position of the two walkers at time t by
Dt = St − St′ .
Finally, for every t ∈ Z+ , define
Ft = σ(St , St′ ), Gt = σ(S1 , S1′ , . . . , St , St′ ), Ht = σ(D1 , . . . , Dt ).
(a) Is {Ft }t a filtration?
(b) Is {Gt }t a filtration?
(c) Is {Ht }t a filtration?
(d) Is Xt measurable with respect to Ft , Gt , or Ht ?
(e) Is {Dt }t a martingale with respect to Gt ? Is it a martingale with respect to Ht ?
(f) Find k ∈ R such that Mt = St − kt is a martingale with respect to Gt , or show that no such
a kexists.
Now, define the first meeting time of the walkers as
τ = min {t ≥ 1 : Dt = 0} ,
and define the start of the first “triple meeting” of the walkers by
τ ′ = min {t ≥ 1 : Dt = Dt+1 = Dt+2 = 0} .
66 Chapter 7. Martingale
(g) Is τ a stopping time with respect to {Gt }t ? Is it a stopping time with respect to {Ht }t ?
(h) Is τ ′ a stopping time with respect to {Gt }t or {Ht }t ?
Exercise 7.9. Consider two simple random walks on Z, denoted {St }t≥0 and {St′ }t≥0 , with
initial positions S0 = 1 and S0′ = −1. At each time step, we choose one of the two walkers
uniformly at random and update only that walker’s position: the chosen walker moves one
unit to the right with probability p, or moves or unit to the left with probability 1 − p. Let
Dt = |St − St′ | denote the distance between the two walkers at time t, and define the meeting
time
τ = inf{t ≥ 0 : Dt = 0}.
Note that the number of times the first walker has moved by time t is Binomial(t, 1/2).
(a) Assume p = 21 . Is it true that τ is finite almost surely? Justify your answer.
(b) Does your conclusion in part (a) change if p > 12 ? Explain why or why not.
(c) For n ∈ Z+ let τn = inf {t ≥ 0 : Dt ≥ n}. Compute P(τ < τn ) the probability that the
walkers meet before their distance increase to n.
Exercise 7.10. Consider the simple random walk {St }t on Z starting from S0 = 0 and such
that P(St = St−1 + 1) = p > 1/2. For any a, b ∈ Z+ define τa = inf {t : St = a} and τ−b,a =
τa ∧ τ−b = min {τa , τ−b }.
(a) Show that for any a, b ∈ Z+ we have
1 − βb
P (τa < τ−b ) = ,
1 − β a+b
1−p
where β = p ∈ (0, 1).
(b) For any given finite a, b ∈ Z+ show that E(τ−b,a ) < ∞.
(c) With a, b, β as above, show that
1 − βb
b
β − β a+b
1
E (τ−b,a ) = a −b ,
ρ 1 − β a+b 1 − β a+b
where ρ = 2p − 1.
Exercise 7.11. Suppose we have a randomized algorithm with binary output (that is, the
algorithm outputs either “yes” or “no”). Suppose that, regardless of whether the correct answer
is “yes” or “no”, the algorithm gives the correct answer with probability 2/3.
To improve the performance of the algorithm, we build a program that repeatedly runs the
algorithm until the difference between the number of occurrences of the two answers is at least
n. In other words, if we define Xi ∈ {−1, 1} by Xi = 1 if and only if the i-th execution of the
algorithm outputs “yes”, the program stops at the first step τ such that
τ
X
Xi = n,
i=1
and outputs “yes” if τi=1 Xi > 0, otherwise it outputs “no”. Suppose further that each execu-
P
tion of the algorithm takes an independent random time distributed as Uniform(0, 100).
(a) Compute the probability that the program outputs the correct answer.
(b) Compute the expected number of repetitions E(τ ).
(c) Compute the expected total time for the program to terminate.
Chapter 8
Definition 8.1 (Galton-Watson branching process). Start at time 0 with one infected indi-
vidual, and define S0 = 1. For k ≥ 0 and i ≥ 1, let Zk,i be i.i.d. random variables on Z+ . For
k ≥ 1, set (PS
k−1
i=1 Zk−1,i , if Sk−1 ≥ 1
Sk =
0, if Sk−1 = 0.
In words, Sk is the number of people from generation k. Each person i ∈ {1, 2, . . . , Sk−1 } from
generation k − 1 gives rise to Zk−1,i new individuals (called its offspring) at generation k.
Definition 8.2 (Galton-Watson tree). Given a Galton-Watson braching process {St }t , the
Galton-Watson tree is the following random graph:
• Vertices are labelled (k, i) for k ∈ Z+ with Sk > 0 and i ∈ {1, 2, . . . , Sk },
• Vertex (k, i) represents the ith individual at generation k,
• There is an edge between (k, i) and (k + 1, j) iff (k, i) is an offspring of (k + 1, j).
• The degree of vertex (k, i) is Zk,i .
67
68 Chapter 8. Galton-Watson branching process
(2, 1)
(1, 1)
S0 S1 S2 S3 S4 S5
Figure 8.1: An example of a Galton-Watson tree with S6 = 0. The leftmost endpoint of an edge
is the parent and the rightmost endpoint of an edge is the child, so the generations are ordered
from left to right. Vertex (1, 1) and one of its child (2, 1) are labelled in the figure. Note that
Z1,1 = 2 and Z2,1 = 3. Regarding vertex (2, 1), its descendants are colored in orange, and its
ancestors are colored in blue.
Definition 8.3 (Galton-Watson tree: parent, ancestors and descendants). Given a Gal-
ton–Watson tree G = (V, E):
• If there is an edge between some (k, i) ∈ V and some (k + 1, j) ∈ V , we say that the former
is the parent of the latter, and the latter is the offspring or child of the former.
• The ancestors of (k, i) are the vertices on the unique path from the root (0, 1) to (k, i),
excluding (k, i) itself.
• The descendants of (k, i) are all vertices (ℓ, j) with ℓ > k such that (k, i) is an ancestor of
(ℓ, j).
Definition 8.4 (Extinction time and survival). The extinction time is τ = inf {t ≥ 1 : St = 0}
with the convention that inf ∅ = ∞. We say the population dies out or becomes extinct if
τ < ∞, otherwise we say that the population survives.
where Z stands for a random variable with the distribution of the Zk,i . In fact, if P(Z = 1) =
1 then Sk = 1 for all k, while if P(Z = 0) ∈ {0, 1} the population either dies immediately or
always survives.
The infection cannot survive with probability 1 because P(S1 = 0) = P(Z = 0) > 0.
Definition 8.6 (Critical, supercritical and subcritical regimes). The Galton-Watson branch-
ing process is called
• Subcritical if µ < 1,
• Critical if µ = 1,
• Supercritical if µ > 1.
Case µ = 1, which implies that Mt = St . For any a ∈ Z+ , let τa = inf {t : St ≥ a}. Show that
you can apply optional stopping to Mt and τa . We obtain
1 = E (Sτ ∧τa ) = E (Sτ 1 (τ < τa ) + Sτa 1 (τa < τ )) = E (Sτa 1 (τa < τ )) ≥ a P(τa < τ ),
so P(τa < τ ) ≤ 1/a. Taking a → ∞ gives P(τ = ∞) = 0.
6 Non-examinable material.
Proof of Theorem 8.5 for µ > 1. Case µ > 1. This case is difficult to handle via martingales,
so we take a different strategy and use the recursive definition of the branching process. Let
qt = P(St = 0) (the probability that extinction has occurred by time t). Then qt is increasing
in t, and since qt ∈ (0, 1), the limit q∞ = limt→∞ qt exists. Moreover,
X X
n n
qt = P(S1 = n)qt−1 = P(Z = n)qt−1 = φ(qt−1 ),
n n
where φ(q) = E(q Z ) is the generating function of Z. Thus qt = φ(φ(· · · φ(0))) = φt (0), the
t-fold composition of φ with itself with argument q0 = 0.
As t → ∞, qt → q∞ where q∞ = φ(q∞ ), i.e. q∞ is a fixed point of φ. Since φ is increasing,
70 Chapter 8. Galton-Watson branching process
φ(0) = P(Z = 0) > 0, and φ(1) = 1, the smallest fixed point is q∞ . Because φ′ (1) = E(Z) =
µ > 1, there exists a fixed point in (0, 1), so q∞ < 1 and therefore P(τ = ∞) = 1−q∞ > 0.
The case µ > 1 cannot be solved via Martingales. In order to see this, consider
the following process starting from S0 = 1: for every t, St = 0 with probability 1/2 or
St = 2µSt−1 with probability 1/2, for some µ > 1. Note that if St = 0 then Ss = 0 for all
s ≥ t. Let τ inf {t : St = 0}. Note that
In particular, τ < ∞ almost surely and the process goes extinct. However, Mt = St µ−t is a
martingale because E(Mt+1 | Ft ) = µ−t−1 21 2µSt = Mt .
So in order to show that the Galton-Watson process survives for µ > 1 it is not enough to
use the fact that Mt is a martingale.
8.4 Exercises
Exercise 8.1. Let µ > 1. Show that there exists a process {St }t with S0 = 1 and St ≥ 0 for
all t ∈ Z+ , such that {Mt }t defined by Mt = St µ−t is a martingale with respect to the filtraton
Ft = σ(S0 , S1 , . . . , St ), but P(τ = ∞) = 0, where τ = inf {t : St = 0}.
Hint: construct a process that, regardless of St−1 ≥ 1, sets St = 0 with probability 1/2.
Exercise 8.2. Given a parameter λ > 0, consider a Galton–Watson branching process {St }t≥0
with S0 = 1 and the following offspring distribution. Each individual has 0 children with prob-
ability 1/2; otherwise (with probability 1/2), its number of children is given by a Geometric(λ)
random variable.
(a) Determine the interval of values of λ for which this branching process survives with positive
probability.
Chapter 8. Galton-Watson branching process 71
(a) Determine the interval of values of λ for which this branching process survives with positive
probability.
Exercise 8.4. A virus begins with a single particle at time 0 (generation 0). At each unit of
time, every particle splits into an independent Poisson(λ) number of offspring. Each offspring
independently
• does not mutate (it has exactly the same genome as its parent) with probability p, or
• mutates with probability 1 − p.
The particles present at time i ∈ {0, 1, 2, . . .} are called particles of generation i, and the single
particle at generation 0 is referred to as the root particle. Once a mutation occurs in some
offspring particle v, all descendants of v are considered mutated and no longer count as having
the same genome as the root particle.
(a) Determine for which values of λ, p the genome of the root particle will eventually cease to
exist almost surely.
Exercise 8.5. Given a parameter λ > 0, consider a Galton–Watson branching process (Sn )n≥0
with S0 = 1 and the following offspring distribution. Each individual has 0 children with prob-
ability 1/2; otherwise (with probability 1/2), its number of children is given by a Geometric(λ)
random variable.
(a) Determine the interval of values of λ for which this branching process survives with positive
probability.
Exercise 8.6. Given a parameter λ > 0, consider the following branching process. At time 0,
we have S0 = 1 individual. Then, for each t ≥ 1, we define St as follows:
• If t is even, each individual at generation t − 1 has an independent number of offsprings
distributed as Poisson(λ).
• If t is odd, each individual at generation t − 1 has an independent number of offsprings
distributed as Bernoulli(1/2).
(a) Determine E(S2 ).
(b) Determine the value of α > 0 so that Mt = S2t αt is a martingale with respect to the
filtration Ft = σ(S0 , S1 , . . . , St ).
(c) Determine the largest value of λ so that St becomes extinct almost surely.
Chapter 9
Coupling
How to say that X ≥ Y ? The idea is to construct X and Y together ; for example:
• Throw two fair coins independently.
• Set X = 1 ( first coin is heads) and Y = 1 (both coins are heads).
• Notice that X ∼ Bernoulli(1/2) and Y ∼ Bernoulli(1/4).
• Moreover, P (X < Y ) = 0; thus X ≥ Y almost surely.
This illustrates a fundamental concept known as coupling.
Definition 9.1 (Coupling). Given two discrete random variables X and Y with sample
spaces ΩX , ΩY and probability distributions PX , PY , respectively, a coupling of X and Y is a
probability measure Q on ΩX × ΩY such that for all x ∈ ΩX and y ∈ ΩY ,
X X
Q(X = x, Y = y) = PX (X = x) and Q(X = x, Y = y) = PY (Y = y).
y∈ΩY x∈ΩX
An analogous definition holds for continuous random variables by replacing probability dis-
tribution with density functions and by replacing sums with integrals.
A simple coupling is to sample X and Y independently of one another. Despite always being a
coupling, this is usually not very useful.
9.3 Examples
Let p > q ∈ (0, 1) and set X ∼ Bernoulli(p) and Y ∼ Bernoulli(q). Can we couple them
so that X ≥ Y almost surely? Yes! Let U ∼ Uniform(0, 1) and set X = 1 (U ≤ p) and
Y = 1 (U ≤ q). Check that this is a coupling!
72
Chapter 9. Coupling 73
Let p > q ∈ (0, 1) and set X ∼ Geometric(p) and Y ∼ Geometric(q). Can we couple them
so that X ≤ Y almost surely? Yes! Let A1 , A2 , . . . be i.i.d. Bernoulli(p) and let B1 , B2 , . . .
be i.i.d. Bernoulli(q) such that for every i we have Ai coupled with Bi as before, which gives
Ai ≥ Bi for all i almost surely. Then, X = min {i : Ai = 1} and Y = min {i : Bi = 1}. It follows
that X and Y have the desired distribution and X ≤ Y almost surely under this coupling.
Definition 9.2 (Stochastic domination). Given two random variables X and Y , we say that
X is stochastically dominated by Y , written X ⪯ Y , if there exists a coupling Q of X and Y
such that
Q (X ≤ Y ) = 1.
In this case, we also say that Y stochastically dominates X, denoted Y ⪰ X.
This is precisely the situation for the variables X ∼ Bernoulli(p) and Y ∼ Bernoulli(q) with
p > q, which gives X ⪰ Y .
Example: X ∼ Binomial(n, p) and Y ∼ Binomial(n + m, p). Show that X ⪯ Y . We use the
fact that the sum of two independent binomial random variables with the same parameter p is
nothing else than a Binomial random variable with the parameter p and the sum of the other two
binomials. That is, if perform the coupling by first sampling X ∼ Binomial(n, p) and sampling
an independent random variable W ∼ Binomial(m, p), then setting Y = X + W implies that
Y ∼ Binomial(n + m, p). Since W ≥ 0 almost surely, we have that, under this coupling, X ≤ Y
almost surely.
Theorem 9.3 (Expectation under stochastic domination). Let X and Y be random variables
on a common sample space Ω, and let f : Ω → R be a non-decreasing function. If X is
stochastically dominated by Y , then
E (f (X)) ≤ E (f (Y )) .
Moreover, given any X, Y , if the above inequality holds for all increasing functions f , then
X ⪯Y.
Proof. We prove only one direction (the direction that if X ⪯ Y then E (f (X)) ≤ E (f (Y )).
Given any coupling Q we have
X
E (f (Y )) − E (f (X)) = QR(X = x, Y = y)(f (y) − f (x)).
x,y∈Ω
By stochastic domination we can choose Q such that Q(X ≤ Y ) = 1. That is, the sum above
can be restricted to values x ≤ y. Therefore,
X
E (f (Y )) − E (f (X)) = QR(X = x, Y = y)(f (y) − f (x)).
x≤y∈Ω
Theorem 9.4 (Construction of a random variable via Uniform(0, 1)). Let X be any real-
valued random variable with distribution function FX (x) = P (X ≤ x). If U ∼ Uniform(0, 1)
and is independent of everything else, then
d
since U ∼ Uniform(0, 1). Hence the cdf of FX−1 (U ) equals FX , so FX−1 (U ) = X.
Proof. First we show that if FX ≥ FY pointwise, we have X ⪯ Y . For this, define a coupling
Q of X, Y as follows: let U ∼ Uniform(0, 1) and set X = FX−1 (U ) and Y = FY−1 (U ). Note
that X, Y have the correct marginal distributions and Q(X ≤ Y ) because FX ≥ FY pointwise.
Therefore, X ⪯ Y .
Now assume that there exists z ∈ Ω such that FX (z) < FY (z). To reach a contradiction, assume
that X ⪯ Y . Consider the function f : Ω → R defined as f (w) = 1 (w ≥ z) and note that f (w)
is non-decreasing in w. Therefore, X ⪯ Y implies that
E(f (X)) ≤ E(f (Y )).
However,
E(f (X)) = P(X ≥ z) = 1 − fX (z) > 1 − fX (Y ) = E(f (Y )),
which gives a contradiction.
Proof. For each unordered pair of vertices u, v ∈ V we have 1 ({u, v} ∈ Ep ) is Bernoulli(p) and
1 ({u, v} ∈ Eq ) is Bernoulli(q). So we can couple these indicators so that
Proof. We can do a coupling each generation at a time, first coupling S0 , S0′ , then S1 , S1′ and
so on and so forth. We can couple the number of offsprings of each individual so that the
offsprings with distribution Z is always less than or equal the number of offsprings obtained
with distribution Z ′ . Refer to the lecture for a more pictorial description of this proof.
9.6 Exercises
Exercise 9.1. Let {St }t and {St′ }t be two Galton-Watson branching processes such that {St }t ⪯
{St′ }t with S0 = S0′ = 1. Show that if {St }t is supercritical, then so is {St′ }t .
Exercise 9.2. Given p, q ∈ (0, 1) with p < q, for each positive integer n let Gp ∼ G(n, p) and
Gq ∼ G(n, q). Let Mp be the size of the largest component of Gp , and let Mq be the size of the
largest component of Gq . Show that Mp ⪯ Mq .
Exercise 9.5. Let X ∼ Uniform(0, 1), let Y ∼ Uniform(0, 10) and let Z ∼ Uniform(1, 9).
(a) Is X ⪯ Y or Y ⪯ X?
(b) Is X ⪯ Z or Z ⪯ X?
(c) Is Y ⪯ Z or Z ⪯ Y ?
Exercise 9.6. Let Z be a random variable which assumes value 0, 1 or 2 with probabilities .8, .1
and .1, respectively. Let Z1 be a random variable which assumes value 0, 1 or 2 with probabilities
.5, .3 and .2, respectively. In a branching process, given an individual v, the siblings of v are the
other individuals in the branching process with the same parent as v.
76 Chapter 9. Coupling
Now consider a branching process {St }t starting from S0 = 1 which evolves as follows. If an
individual has exactly one sibling, then its number of children is given by an independent random
variable with the same distribution as Z1 . On the other hand, if an individual has any other
number of siblings (0 or at least 2), then its number of children is given by an independent
random variable with the same distribution of Z.
Determine whether this branching process gets extinct almost surely.
Exercise 9.7. Let X1 , X2 , . . . be i.i.d. random variables with distribution Geometric(1/4), and
let X1′ , X2′ , . . . be i.i.d. random variables with distribution Geometric(1/5). Let {St }t and {St′ }t
be two random walks on Z starting from S0 = S0′ = 0 and such that
t
X t
X
St = (Xi − 2) and St′ = (Xi′ − 2).
i=1 i=1
Given a > 0, define τa = inf {t : St ≥ a} and τa′ = inf {t : St′ ≥ a}, with the convention that
inf ∅ = ∞.
Show that τa ⪰ τa′ .
Chapter 10
Percolation
Ep = {e ∈ E : ωe = 1} .
Observe that G1 coincides with G, while G0 is the graph on V without any edges.
Percolation also makes sense on finite graphs. In fact,
if G is the complete graph on n
n
vertices (that is, the graph with n vertices and all 2 edges), then Gp is the Erdős-Rényi
random graph distributed as G(n, p).
77
78 Chapter 10. Percolation
Definition 10.2 (Line graph). The line graph of a graph G = (V, E) is the graph
G′ = (V ′ , E ′ ) where
Therefore, site percolation is in some sense more general than bond percolation.
Figure 10.1: Examples of bond percolation on a piece of Z2 with parameter p = 0.45 (left) and
p = 0.55 (right). Only the open edges of Gp are shown. The largest cluster is highlighted in red.
The main problem in percolation is about determining whether an infinite cluster exists. When-
ever such an infinite cluster appears, we say that percolation occurs.
In the physical interpretation (for instance, flow through a porous rock), the existence of
an infinite cluster means that the micro–channels inside the rock form a connected network,
so that water can flow from one side of the material to the other.
Chapter 10. Percolation 79
Definition 10.3 (Probability measure and percolation). Let Pp denote the probability mea-
sure induced by the graph Gp . Define the event
Definition 10.4 (Critical probability). Given a graph G = (V, E) the critical probability is
defined as
pc = pc (G) = inf {p ∈ [0, 1] : θ(p) > 0} .
Then, for all p < pc , the probability of the existence of an infinite cluster is zero. Indeed, by the
union bound over x ∈ V ,
!
[ X
Pp {|Cx | = ∞} ≤ Pp (|Cx | = ∞) = 0,
x∈V x∈V
The above result requires us to prove that if θ(p) = 0 then Pp (v ⇝ ∞) = 0 for any
v ∈ V . In the two examples of graphs (Zd and the regular tree) this follows by symmetry of
the graph. In fact, it follows in greater generality but we will not prove this as it requires
an additional result.
At first, this may look obvious: if we increase p, then Gp should contain more edges, hence it
should be more likely to contain an infinite cluster. The intuition is clear, but we need a rigorous
argument: coupling.
An immediate consequence of Theorem 10.5 is the phase transition.
Corollary 10.6 (Phase transition of percolation). For p < pc , θ(p) = 0, while for p > pc ,
θ(p) > 0.
80 Chapter 10. Percolation
We employ the term phase transition in analogy to the transition of water from liquid
to solid at 0◦ C. Note that water suffers a visible (or macroscopic) change from liquid to
solid as the temperature decreases past 0◦ C. Similarly, the percolating cluster undergoes a
macroscopic change with the appearance of an infinite cluster as the parameter p is increased
past pc .
Proof of Theorem 10.5. The event {|C| = ∞} is an increasing event, meaning that if it occurs
for a configuration ω ′ , it also occurs for any ω ≥ ω ′ .
Let p > p′ and define ω, ω ′ as bond percolation with parameter p and p′ , respectively. We
construct ω, ω ′ in a coupled way as follows. For each edge e ∈ E, let Ue be an independent
Uniform(0, 1) random variable. Then, set ωe = 1 (Ue ≤ p) and ωe′ = 1 (Ue ≤ p′ ). Note that
ωe ≥ ωe′ and ωe ∼ Bernoulli(p) and ωe′ ∼ Bernoulli(p′ ). Let Q denote the probability
measure induced by this coupling.
Now let C(ω) and C(ω ′ ) be the clusters of the origin under each configuration. Then
The inequality follows from ω ⪰ ω ′ . The second and third equalities use the definition of
coupling.
Theorem 10.7 (Lower bound on pc ). Let G be an infinite d-regular graph. Then, for every
1
p < d−1 ,
θ(p) = 0.
1
Consequently, pc (G) ≥ d−1 .
Moreover,
{0 ⇝ B c (n)} ⊂ {∃ a path of open edges from the origin with length at least n} .
ρn (p) = Pp {∃ a path of open edges from the origin with length at least n} .
Let Pn be the set of paths from the origin with exactly n edges (this set is deterministic). Let
Xn be the number of paths in Pn whose edges are all open. By Markov’s inequality,
because there are at most d choices for the first edge of the path and then at most d − 1 choices
at each subsequent edge of the path.
Hence
θ(p) ≤ lim ρn (p) ≤ lim d(d − 1)n−1 pn = lim pd ((d − 1)p)n−1 .
n→∞ n→∞ n→∞
If (d − 1)p < 1, the limit is 0, hence θ(p) = 0.
1
We already showed that pc ≥ d−1 . So it remains to show an upper bound.
There are two ways to prove this: one via branching process and another with the second
moment method.
1
Proof of Theorem 10.8 via the second-moment method. We only need to show that for p > d−1
there exists an infinite cluster. Let Xn be the number of paths from the origin to distance n
whose edges are all open. Then
X
Xn = 1all edges of P are open,
P ∈Pn
where Pn is the set of paths from the origin to distance n. Note that, in a regular tree we have
|Pn | = d(d − 1)n−1 , therefore
E(Xn ) = d(d − 1)n−1 pn .
1
When p > d−1 we have that E(Xn ) → ∞ as n → ∞.
1
We will show that for p > d−1 ,
lim Pp (Xn > 0) → 1,
n→∞
which implies the existence (with positive probability) of an infinite open path from the origin.
We use the second moment. We compute
X
E(Xn2 ) = E(Xn )2 Pp all edges of P and P ′ are open .
P ̸=P ′
For P ̸= P ′ , let ρ(P, P ′ ) be their most distant common ancestor from the origin (the last shared
vertex). Let |ρ(P, P ′ )| = i ∈ {0, 1, . . . , n − 1} be its level (distance from the origin). Given i,
the two paths together use i + 2(n − i) = 2n − i edges, so
Pp all edges of P and P ′ are open = p2n−i .
By Paley–Zygmund,
Thus 2
d 1
Pp (Xn > 0) ≥ 1 > 0,
d−1 1
1− (d−1)p
uniformly in large n, which implies the desired positive probability of an infinite open path.
1
Hence pc (Td ) ≤ d−1 , completing the proof.
Proof of Theorem 10.8 via branching process. Given vertex o, for each k ∈ Z+ let Wk be the
vertices at distance exactly k from o. Note that |Wk | = d(d − 1)k−1 . We will see Wk a branching
process that starts at W1 = d. Then, note that for each k ≥ 2, each vertex v ∈ Wk−1 has exactly
d − 1 neighbors in Wk because one of its neighbors is in Wk−2 . Now we define the branching
process. Let S0 = {o}. Then, for each k ≥ 1 we let Sk be a subset of Wk defined as the set of
vertices u ∈ Wk which are connected via an open edge to a vertex in Sk−1 . Then, any vertex in
Sk is a vertex of distance k from o for which the unique path that connects it to o is composed
only of open edges. In other words, Sk contains all vertices from Wk that belong to the cluster
of the origin. So, the origin is in an infinite cluster if and only if the branching process {Sk }k
survives.
Note that |S1 | ∼ Binomial(d, p) and for k ≥ 2 we have |Sk | is equal to the sum of |Sk−1 |
independent Binomial(d − 1, p) random variables. Because d becomes d − 1 from generations
2 and higher, we can see that conditioned on S1 we obtain a Galton-Watson branching process
with offspring distribution Binomial(d − 1, p), whose expectation is (d − 1)p. Therefore, if
(d − 1)p < 1 the branching process becomes extinct almost surely, implying that the cluster
of the origin is finite almost surely. On the other hand, if (d − 1)p > 1, the branching process
survives with positive probability, which gives that the origin is in an infinite cluster with positive
probability.
Theorem 10.9 (Giant component). Let limn→∞ pn = λ ∈ [0, ∞]. Then, if λ > 1, we have
that En,p,ε occurs a.a.s. for some ε > 0.
On the other hand, if λ < 1, we have that En,p,ε does not occurs a.a.s. for any ε > 0. Moreover,
there exists c = c(p) such that P (|C| ≥ x) ≤ e−cx .
Proof. The proof of the first part is beyond the scope of this course. We will see the proof of
the second part. So, assume that p ≪ n1 . The proof strategy is to show that
|C|is stochastically dominated by a subcritical Galton-Watson branching process with offspring distribution Bi
(10.9.1)
Chapter 10. Percolation 83
Assuming the above for the moment, let Z ∼ Binomial(n, p) and note that E(Z) = np < 1.
Therefore, letting X be the total number of individuals in this Galton-Watson branching process
we obtain
P (|C| ≥ x) ≤ P(X ≥ x) ≤ e−cx .
Taking the union bound over all vertices, we have
P max |Ci | ≥ x ≤ ne−cx .
i∈V
Choosen x = C log n for some large enough C gives that the above bound goes to zero as n → ∞,
establishing that a.a.s. there are no connected component of size larger than C log n.
It remains to show (10.9.1). Take vertex 1. We know that dG (1) ∼ Binomial(n − 1, p) ⪯
Binomial(n, p).
10.10 Exercises
Exercise 10.1. Let d ≥ 3 and G = (V, E) be a graph. Site percolation on G is the process
obtained by declaring each vertex to be open independently with probability p, and vertices that
are not open are declared to be closed. An open path for site percolation is a path in G where all
vertices in the path are open. The critical probability for site percolation is the smallest value
of p so that there exists a positive probability that the origin is in an infinite open path for site
percolation.
Determine the critical probability for site percolation on the infinite d-regular tree.
Exercise 10.2. Let G be the graph obtained from the infinite 3-regular tree by replacing each
vertex by a cycle of length 4 as illustrated below: Determine pc (G).
···
···
···
···
···
Exercise 10.3 ( ). Consider the graph G = (V, E), where V is an infinite set of vertices, G
is a tree, the degrees of the vertices are either 3 or 5, and each edge of G has an endpoint with
degree 3 and an endpoint with degree 5. Assume that the origin has degree 3.
Determine pc (G).
84 Chapter 10. Percolation
Exercise 10.4 ( ). The graph induced by Z 2 and the 4-regular tree are two infinite regular
graphs where the degrees are equal to 4. Let Gp be the graph obtained by doing percolation on
Z 2 with probability p, and let Tp be the graph obtained by doing percolation on the 4-regular
tree with probability p. Let M be the size of the open cluster of the origin in Gp , and let M ′ be
the size of the open cluster of the root in Tp .
Show that M ⪯ M ′ .
Exercise 10.6. Recall that the critical probability for percolation on Z2 is 1/2. Let G be the
graph obtained from Z2 by replacing each edge with a path of length k (see the figure below for
an example with k = 3). Determine pc (G).
.. .. .. .. .. ..
. . . . . .
··· ···
··· ···
··· ···
··· ···
··· ···
··· ···
.. .. .. .. .. ..
. . . . . .
Exercise 10.7. Consider a Galton Watson tree G = (V, E) where the offspring distribution
is given by a random variable Z. Fix p ∈ [0, 1] and let Gp be the random graph obtained by
performing bond percolation with parameter p on the random graph G. Assume that E(Z) > 1
such that the event |V | = ∞ has positive probability. Let Pp be the probability induced by
the random graph Gp . Let o be the origin of the Galton Watson tree. Establish the following
results:
1
(a) Pp (o ⇝ ∞) = 0 for all p < E(Z) .
1
(b) Pp (o ⇝ ∞) > 0 for all p > E(Z) .
1
(c) Pp (o ⇝ ∞ | |V | = ∞) > 0 for all p > E(Z) .
Chapter 11
Review problems
Given a graph G = (V, E), a triple of vertices (u, v, w) is called an isolated triangle if u, v, w are
neighbors of one another but are not neighbors of any other vertex in V .
Let A = (Au,v )u,v∈V be the adjacency matrix of G:
(
1, if {u, v} ∈ E
Au,v =
0, otherwise.
Exercise 11.1. What is the probability that the output is correct when G has an isolated
triangle?
Exercise 11.2. What is the probability that the output is correct when G does not have an
isolated triangle?
Exercise 11.4. Is the algorithm above Monte Carlo, Las Vegas or neither?
Exercise 11.5. Run the algorithm for k times, independently, and output true if at least one
of the iterations return true, otherwise output false. What is the probability that the output
produced in this procedure is correct?
Now consider the random graph G ∼ G(n, p) where p = p(n) can depend on n. For each triple
85
86 Chapter 11. Review problems
Exercise 11.6. Show that if p ≪ n1 or p ≫ n1 then G does not have an isolated triangle almost
surely.
Hint: you may use that, for any constant c > 0, we have limx→∞ x3 e−cx = 0.
n
p3 (1 − p)3(n−3) .
Hint: prove that E(X) = 3
Hint: Note that it is not possible for two non-disjoint and distinct triples to be isolated triangles
simultaneously. You should get E(X 2 ) = E(X) + n3 n−3 6
3 p (1 − p)
6(n−6)+9 .
Exercise 11.8. Show that if p = nλ for some constant λ then G has an isolated triangle with
positive probability.
x
Hint: you may use that, for any constant x ∈ (0, 1), we have 1 − x ≥ exp − 1−x .
Hint:
E(Xn2 )
E(Xn ) → ∞ and →1
E2 (Xn )
then P(Xn ≥ 1) → 1.
11.3 Percolation
Consider the variation of the binary tree below:
···
···
···
o ···
···
···
···
···
Consider the graph obtained from the previous graph by replacing each edge with a path of
length 2.
···
···
···
o ···
···
···
···
···
Exercise 11.13. Determine the value α ∈ R+ so that Mt = αSt is a martingale with respect
to the filtration {Ft }t .