• Home
  • Textbooks
  • Probability and Computing
  • Martingales

Probability and Computing

Michael Mitzenmacher , Eli Upfal

Chapter 12

Martingales - all with Video Answers

Educators


Chapter Questions

06:58

Problem 1

Show that, if $Z_{0}, Z_{1}, \ldots, Z_{n}$ is a martingale with respect to $X_{0}, X_{1}, \ldots$, $X_{n}$, then it is also a martingale with respect to itself.

Chris Trentman
Chris Trentman
Numerade Educator
01:18

Problem 2

Let $X_{0}=0$ and for $j \geq 0$ let $X_{j+1}$ be chosen uniformly over the real interval $\left[X_{j}, 1\right]$. Show that, for $k \geq 0$, the sequence
$$
Y_{k}=2^{k}\left(1-X_{k}\right)
$$
is a martingale.

Manik Pulyani
Manik Pulyani
Numerade Educator
01:27

Problem 3

Let $X_{1}, X_{2}, \ldots$ be independent and identically distributed random variables with expectation 0 and variance $\sigma^{2}<\infty$. Let
$$
Z_{n}=\left(\sum_{i=1}^{n} X_{i}\right)^{2}-n \sigma^{2}
$$
Show that $Z_{1}, Z_{2}, \ldots$ is a martingale.

Manik Pulyani
Manik Pulyani
Numerade Educator
03:31

Problem 4

Consider the gambler's ruin problem, where a player plays a sequence of independent games, either winning one dollar with probability $1 / 2$ or losing one dollar with probability $1 / 2$. The player continues until either losing $\ell_{1}$ dollars or winning $\ell_{2}$ dollars. Let $X_{n}$ be 1 if the player wins the $n$th game and $-1$ otherwise. Let $Z_{n}=$ $\left(\sum_{i=1}^{n} X_{i}\right)^{2}-n$.
(a) Show that $Z_{1}, Z_{2}, \ldots$ is a martingale.
(b) Let $T$ be the stopping time when the player finishes playing. Determine $\mathbf{E}\left[Z_{T}\right]$.
(c) Calculate $\mathbf{E}[T]$. (Hint: You can use what you already know about the probability that the player wins.

Nick Johnson
Nick Johnson
Numerade Educator
03:31

Problem 5

Consider the gambler's ruin problem, where now the independent games are such that the player either wins one dollar with probability $p<1 / 2$ or loses one dollar with probability $1-p .$ As in Exercise 12.4, the player continues until either losing $\ell_{1}$ dollars or winning $\ell_{2}$ dollars. Let $X_{n}$ be 1 if the player wins the $n$th game and $-1$ otherwise, and let $Z_{\mathrm{a}}$ be the player's total winnings after $n$ games.
(a) Show that
$$
A_{n}=\left(\frac{1-p}{p}\right)^{Z_{n}}
$$
is a martingale with mean $1 .$
(b) Determine the probability that the player wins $\ell_{2}$ dollars before losing $\ell_{1}$ dollars.
(c) Show that
$$
B_{n}=Z_{n}-(2 p-1) n
$$
is a martingale with mean 0 .
(d) Let $T$ be the stopping time when the player finishes playing. Determine $\mathbf{E}\left[Z_{T}\right]$, and use it to determine $\mathbf{E}[T]$. (Hint: You can use what you already know about the probability that the player wins.)

Nick Johnson
Nick Johnson
Numerade Educator
01:43

Problem 6

Prove Theorem $12.6$

Carson Merrill
Carson Merrill
Numerade Educator
01:56

Problem 7

In the bin-packing problem, we are given items with sizes $a_{1}, a_{2}, \ldots, a_{n}$ with $0 \leq a_{i} \leq 1$ for $1 \leq i \leq n$. The goal is to pack them into the minimum number of bins, with each bin being able to hold any collection of items whose total sizes sum to at most 1. Suppose that each of the $a_{i}$ is chosen independently according to some distribution (which might be different for each $i$ ). Let $P$ be the number of bins required in the best packing of the resulting items. Prove that
$$
\operatorname{Pr}(|P-\mathbf{E}[P]| \geq \lambda) \leq \mathrm{e}^{-2 \lambda^{2} / n}
$$

Nick Johnson
Nick Johnson
Numerade Educator
11:29

Problem 8

Consider an $n$-cube with $N=2^{n}$ nodes. Let $S$ be a nonempty set of vertices on the cube, and let $x$ be a vertex chosen uniformly at random among all vertices of the cube. Let $D(x, S)$ be the minimum number of coordinates in which $x$ and $y$ differ over all points $y \in S$. Give a bound on
$$
\operatorname{Pr}(|D(x, S)-\mathbf{E}[D(x, S)]|>\lambda)
$$

Chris Trentman
Chris Trentman
Numerade Educator
02:36

Problem 9

In Chapter 4 we developed a tail bound for the sum of $\{0,1\}$ random variables. We can use martingales to generalize this result for the sum of any random variables whose range lies in $[0,1] .$ Let $X_{1}, X_{2}, \ldots, X_{n}$ be independent random variables such that $\operatorname{Pr}\left(0 \leq X_{i} \leq 1\right)=1$. If $S_{n}=\sum_{i=1}^{n} X_{i+}$ show that
$$
\operatorname{Pr}\left(\left|S_{n}-\mathbf{E}\left[S_{n}\right]\right| \geq \lambda\right) \leq 2 \mathrm{e}^{-2 \lambda^{2}}
$$

Amany Waheeb
Amany Waheeb
Numerade Educator
05:01

Problem 10

A parking-lot attendant has mixed up $n$ keys for $n$ cars. The $n$ car owners arrive together. The attendant gives each owner a key according to a permutation chosen uniformly at random from all permutations. If an owner receives the key to his car, he takes it and leaves; otherwise, he returns the key to the attendant. The attendant now repeats the process with the remaining keys and car owners. This continues until all owners receive the keys to their cars.

Let $R$ be the number of rounds until all car owners receive the keys to their cars. We want to compute $\mathbf{E}[R]$. Let $X_{i}$ be the number of owners who receive their car keys in the $i$ th round. Prove that
$$
Y_{\imath}=\sum_{j=1}^{l}\left(X_{1}-\mathbf{E}\left[X_{2} \mid X_{1}, \ldots, X_{i-1}\right]\right)
$$
is a martingale. Use the martingale stopping theorem to compute $\mathbf{E}[R]$.

Rosina Dapaah
Rosina Dapaah
Numerade Educator
01:30

Problem 11

Alice and Bob play each other in a checkers tournament, where the first player to win four games wins the match. The players are evenly matched, so the probability that each player wins each game is $1 / 2$, independent of all other games. The number of minutes for each game is uniformly distributed over the integers in the range $[30,60]$, again independent of other games. What is the expected time they spend playing the match?

Nick Johnson
Nick Johnson
Numerade Educator
03:42

Problem 12

Consider the following extremely inefficient algorithm for sorting $n$ numbers in increasing order. Start by choosing one of the $n$ numbers uniformly at random, and placing it first. Then choose one of the remaining $n-1$ numbers uniformly at random, and place it second. If the second number is smaller than the first, start over again from the beginning. Otherwise, next choose one of the remaining $n-2$ numbers uniformly at random, place it third, and so on. The algorithm starts over from the beginning whenever it finds that the $k$ th item placed is smaller than the $(k-1)$ th item. Determine the expected number of times the algorithm tries to place a number, assuming that the input consists of $n$ distinct numbers.

Hunza Gilgit
Hunza Gilgit
Numerade Educator
03:59

Problem 13

Suppose that you are arranging a chain of $n$ dominos so that, once you are done, you can have them all fall sequentially in a pleasing manner by knocking down the lead domino. Each time you try to place a domino in the chain, there is some chance that it falls, taking down all of the other dominos you have already carefully placed. In that case, you must start all over again from the very first domino.
(a) Let us call each time you try to place a domino a trial. Each trial succeeds with probability $p$. Using Wald's equation, find the expected number of trials necessary before your arrangement is ready. Calculate this number of trials for $n=100$ and $p=0.1$.
(b) Suppose instead that you can break your arrangement into $k$ components, each of size $n / k$, in such a way so that once a component is complete, it will not fall when you place further dominos. For example: if you have 10 components of size 10 , then once the first component of 10 dominos are placed successfully they will not fall; misplacing a domino later might take down another component, but the first will remain ready. Find the expected number of trials necessary before your arrangement is ready in this case. Calculate the number of trials for $n=100, k=$ 10 , and $p=0.1$, and compare with your answer from part (a).

SB
Spencer Bahr
Numerade Educator
02:36

Problem 14

(a) Let $X_{1}, X_{2}, \ldots$ be a sequence of independent exponential random variables, each with mean 1. Given a positive real number $k$, let $N$ be defined by
$$
N=\min \left\{n: \sum_{i=1}^{n} X_{i}>k\right\}
$$
That is, $N$ is the smallest number for which the sum of the first $N$ of the $X_{i}$ is larger than $k$. Use Wald's inequality to determine $\mathbf{E}[N]$.
(b) Let $X_{1}, X_{2}, \ldots$ be a sequence of independent uniform random variables on the interval $(0,1)$. Given a positive real number $k$ with $0<k<1$, let $N$ be defined by
$$
N=\min \left\{n: \prod_{i=1}^{n} X_{i}<k\right\}
$$ That is, $N$ is the smallest number for which the product of the first $N$ of the $X_{i}$ is smaller than $k$. Determine $\mathbf{E}[N]$. (Hint: You may find Exercise $8.9$ helpful.)

Amany Waheeb
Amany Waheeb
Numerade Educator
04:47

Problem 15

A subsequence of a string $s$ is any string that can be obtained by deleting characters from $s$. Consider two strings $x$ and $y$ of length $n$, where each character in each string is independently a 0 with probability $1 / 2$ and a 1 with probability $1 / 2$. We consider the longest common subsequence of the two strings.
(a) Show that the expected length of the longest common subsequence is greater than $c_{1} n$ and less than $c_{2} n$ for constants $c_{1}>1 / 2$ and $c_{2}<1$ when $n$ is sufficiently large. (Any constants $c_{1}$ and $c_{2}$ will do; as a challenge, you may attempt to find the best constants $c_{1}$ and $c_{2}$ that you can.)
(b) Use a martingale inequality to show that the length of the longest common subsequence is highly concentrated around its mean.

Chris Trentman
Chris Trentman
Numerade Educator
View

Problem 16

Given a bag with $r$ red balls and $g$ green balls, suppose that we uniformly sample $n$ balls from the bin without replacement. Set up an appropriate martingale and use it to show that the number of red balls in the sample is tightly concentrated around $n r /(r+g)$.

Rashmi Sinha
Rashmi Sinha
Numerade Educator
09:12

Problem 17

We showed in Chapter 5 that the fraction of entries that are 0 in a Bloom filter is concentrated around
$$
p^{\prime}=\left(1-\frac{1}{n}\right)^{k m},
$$
where $m$ is the number of data items, $k$ is the number of hash functions, and $n$ is the size of the Bloom filter in bits. Derive a similar concentration result using a martingale inequality.

Chris Trentman
Chris Trentman
Numerade Educator
01:38

Problem 18

Consider a random graph from $G_{n, N}$, where $N=$ cn for some constant $c>0$. Let $X$ be the expected number of isolated vertices (i.e., vertices of degree 0 ).
(a) Determine $\mathbf{E}[\boldsymbol{X}]$.
(b) Show that
$$
\operatorname{Pr}(|X-\mathbf{E}[X]| \geq 2 \lambda \sqrt{c n}) \leq 2 e^{-\lambda^{2} / 2}
$$

Manik Pulyani
Manik Pulyani
Numerade Educator
02:06

Problem 19

We improve our bound from the Azuma-Hoeffding inequality for the problem where $m$ balls are thrown into $n$ bins. We let $F$ be the number of empty bins after the $m$ balls are thrown and $X_{i}$ the bin in which the $i$ th ball lands. We define $Z_{0}=$ $\mathbf{E}[F]$ and $Z_{1}=\mathbf{E}\left[F \mid X_{1}, \ldots, X_{i}\right] .$
(a) Let $A_{i}$ denote the number of bins that are empty after the $i$ th ball is thrown. Show that in this case (b) Show that, if the $i$ th ball lands in a bin that is empty when it is thrown, then
$$
Z_{i}=\left(A_{i-1}-1\right)\left(1-\frac{1}{n}\right)^{m-i}
$$
(c) Show that, if the $i$ th ball lands in a bin that is not empty when it is thrown, then
$$
Z_{i}=A_{i-1}\left(1-\frac{1}{n}\right)^{m-i}
$$
(d) Show that the Azuma-Hoeffiding inequality of Theorem $12.6$ applies with $d_{i}=$ $(1-1 / n)^{m-i}$
(e) Using part (d), prove that
$$
\operatorname{Pr}(|F-\mathbf{E}[F]| \geq \lambda) \leq 2 \mathrm{e}^{-\lambda^{2}(2 n-1) /\left(n^{2}-(\mathbf{E}(F])^{2}\right)}
$$

Anand Jangid
Anand Jangid
Numerade Educator
01:56

Problem 20

Let $f\left(X_{1}, X_{2}, \ldots, X_{n}\right)$ satisfy the Lipschitz condition so that, for any $i$ and any values $x_{1}, \ldots, x_{n}$ and $y_{i}$
$$
\left|f\left(x_{1}, x_{2}, \ldots, x_{i-1}, x_{i}, x_{i+1}, \ldots, x_{n}\right)-f\left(x_{1}, x_{2}, \ldots, x_{i-1}, y_{i}, x_{1+1}, \ldots, x_{n}\right)\right| \leq c
$$
We set
$$
Z_{0}=\mathbf{E}\left[f\left(X_{1}, X_{2}, \ldots, X_{n}\right)\right]
$$
and
$$
Z_{i}=\mathbf{E}\left[f\left(X_{1}, X_{2}, \ldots, X_{n}\right) \mid X_{1}, X_{2}, \ldots, X_{i}\right]
$$
Give an example to show that, if the $X_{r}$ are not independent, then it is possible that $\left|Z_{1}-Z_{1-1}\right|>c$.

Jacob Fry
Jacob Fry
Numerade Educator