Randomized Algorithms (Spring 2010)/Martingales

From EtoneWiki
Jump to: navigation, search


Review of conditional expectations

The conditional expectation of a random variable with respect to an event is defined by

In particular, if the event is , the conditional expectation

defines a function

Thus, can be regarded as a random variable .

Suppose that we uniformly sample a human from all human beings. Let be his/her height, and let be the country where he/she is from. For any country , gives the average height of that country. And is the random variable which can be defined in either ways:
  • We choose a human uniformly at random from all human beings, and is the average height of the country where he/she comes from.
  • We choose a country at random with a probability proportional to its population, and is the average height of the chosen country.

The following proposition states some fundamental facts about conditional expectation.

Proposition (fundamental facts about conditional expectation)
Let and be arbitrary random variables. Let and be arbitrary functions. Then
  1. .
  2. .
  3. .

The proposition can be formally verified by computing these expectations. Although these equations look formal, the intuitive interpretations to them are very clear.

The first equation:

says that there are two ways to compute an average. Suppose again that is the height of a uniform random human and is the country where he/she is from. There are two ways to compute the average human height: one is to directly average over the heights of all humans; the other is that first compute the average height for each country, and then average over these heights weighted by the populations of the countries.

The second equation:

is the same as the first one, restricted to a particular subspace. As the previous example, inaddition to the height and the country , let be the gender of the individual. Thus, is the average height of a human being of a given sex. Again, this can be computed either directly or on a country-by-country basis.

The third equation:


looks obscure at the first glance, especially when considering that and are not necessarily independent. Nevertheless, the equation follows the simple fact that conditioning on any , the function value becomes a constant, thus can be safely taken outside the expectation due to the linearity of expectation. For any value ,

The proposition holds in more general cases when and are a sequence of random variables.


"Martingale" originally refers to a betting strategy in which the gambler doubles his bet after every loss. Assuming unlimited wealth, this strategy is guaranteed to eventually have a positive net profit. For example, starting from an initial stake 1, after losses, if the th bet wins, then it gives a net profit of

which is a positive number.

However, the assumption of unlimited wealth is unrealistic. For limited wealth, with geometrically increasing bet, it is very likely to end up bankrupt. You should never try this strategy in real life. And remember: gambling is bad!

Suppose that the gambler is allowed to use any strategy. His stake on the next beting is decided based on the results of all the bettings so far. This gives us a highly dependent sequence of random variables , where is his initial capital, and represents his capital after the th betting. Up to different betting strategies, can be arbitrarily dependent on . However, as long as the game is fair, namely, winning and losing with equal chances, conditioning on the past variables , we will expect no change in the value of the present variable on average. Random variables satisfying this property is called a martingale sequence.

Definition (martingale)
A sequence of random variables is a martingale if for all ,
Example (coin flips)
A fair coin is flipped for a number of times. Let denote the outcome of the th flip. Let
The random variables defines a martingale.
We first observe that , which intuitively says that the next number of HEADs depends only on the current number of HEADs. This property is also called the Markov property in statistic processes.
Example (random walk)
Consider an infinite grid. A random walk starts from the origin, and at each step moves to one of the four directions with equal probability. Let be the distance from the origin, measured by -distance (the length of the shortest path on the grid). The sequence does NOT directly defines a martingale sequence. However, we can fix it by changing the rule of the random walk a little bit: when the current position is on the same horizontal or vertical line of the origin, with 1/2 probability the random walk moves towards the origin, and with 1/2 probability it moves to one of the three other directions; while the random walk at all other places, the rules remain the same (moving to one of the four direction uniformly at random).
The fixed random walk is a martingale. It is due to the fact that conditioning on any previous walk, the expected change to the current distance from the origin is zero.
Example (Polya's urn scheme)
Consider an urn (just a container) that initially contains balck balls and white balls. At each step, we uniformly select a ball from the urn, and replace the ball with balls of the same color. Let , and be the fraction of black balls in the urn after the th step. The sequence is a martingale.
Example (edge exposure in a random graph)
Consider a random graph generated as follows. Let be the set of vertices, and let be the set of all possible edges. For convenience, we enumerate these potential edges by . For each potential edge , we independently flip a fair coin to decide whether the edge appears in . Let be the random variable that indicates whether . We are interested in some graph-theoretical parameter, say chromatic number, of the random graph . Let be the chromatic number of . Let , and for each , let , namely, the expected chromatic number of the random graph after fixing the first edges. This process is called edges exposure of a random graph, as we "exposing" the edges one by one in a random grpah.
As shown by the above figure, the sequence is a martingale. In particular, , and . The martingale moves from no information to full information (of the random graph ) in small steps.

It is nontrivial to formally verify that the edge exposure sequence for a random graph is a martingale. However, we will later see that this construction can be put into a more general context.

Azuma's Inequality

We then introduce a martingale tail inequality, called Azuma's inequality.

Azuma's Inequality
Let be a martingale such that, for all ,

Before formally proving this theorem, some comments are in order. First, unlike the Chernoff bounds, there is no assumption of independence. This shows the power of martingale inequalities.

Second, the condition that

is central to the proof. This condition is sometimes called the bounded difference condition. If we think of the martingale as a process evolving through time, where gives some measurement at time , the bounded difference condition states that the process does not make big jumps. The Azuma's inequality says that if so, then it is unlikely that process wanders far from its starting point.

A special case is when the differences are bounded by a constant. The following corollary is directly implied by the Azuma's inequality.

Let be a martingale such that, for all ,

This corollary states that for any martingale sequence whose diferences are bounded by a constant, the probability that it deviates far away from the starting point after steps is bounded by .

The proof of Azuma's Inequality uses several ideas which are used in the proof of the Chernoff bounds. We first observe that the total deviation of the martingale sequence can be represented as the sum of deferences in every steps. Thus, as the Chernoff bounds, we are looking for a bound of the deviation of the sum of random variables. The strategy of the proof is almost the same as the proof of Chernoff bounds: we first apply Markov's inequality to the moment generating function, then we bound the moment generating function, and at last we optimize the parameter of the moment generating function. However, unlike the Chernoff bounds, the martingale differences are not independent any more. So we replace the use of the independence in the Chernoff bound by the martingale property. The proof is detailed as follows.

In order to bound the probability of , we first bound the upper tail . The bound of the lower tail can be symmetrically proved with the replaced by .

Represent the deviation as the sum of differences

We define the martingale difference sequence: for , let

It holds that

The second to the last equation is due to the fact that is a martingale and the definition of conditional expectation.

Let be the accumulated differences

The deviation can be computed by the accumulated differences:

We then only need to upper bound the probability of the event .

Apply Markov's inequality to the moment generating function

The event is equivalent to that for . Apply Markov's inequality, we have

This is exactly the same as what we did to prove the Chernoff bound. Next, we need to bound the moment generating function .

Bound the moment generating functions

The moment generating function

The first and the last equations are due to the fundamental facts about conditional expectation which are proved by us in the first section.

We then upper bound the by a constant. To do so, we need the following technical lemma which is proved by the convexity of .

Let be a random variable such that and . Then for ,
Observe that for , the function of the variable is convex in the interval . We draw a line between the two endpoints points and . The curve of lies entirely below this line. Thus,

Since , we have

By expanding both sides as Taylor's series, it can be verified that .

Apply the above lemma to the random variable

We have already shown that its expectation and by the bounded difference condition of Azuma's inequality, we have Thus, due to the above lemma, it holds that

Back to our analysis of the expectation , we have

Apply the same analysis to , we can solve the above recursion by

Go back to the Markov's inequality,

We then only need to choose a proper .


By choosing , we have that

Thus, the probability

The upper tail of Azuma's inequality is proved. By replacing by , the lower tail can be treated just as the upper tail. Applying the union bound, Azuma's inequality is proved.


Coin flips

A fair coin is flipped for a number of times. Let denote the outcome of the th flip. Let


As we proved, the random variables is a martingale. is gives the absolute difference between the number of HEADs and TAILs in coin flips. The differences

Due to Azuma's inequality:

Random walk on a two-dimensional grid

Consider a problem we defined earlier: a random walk on an infinite grid. Let be the grid distance ( distance) from the origin at step . We fix the random walk so that defines a martingale. And it is obvious that

for any . This is because the random walk moves through one edge in each step, which contributes at most 1 to the grid distance from the origin.

Note that . Apply the Azuma's inequality, we have

The Method of Bounded Differences


The martingale can be generalized to be with respect to another sequence of random variables.

Definition (martingale, general version)
A sequence of random variables is a martingale with respect to the sequence if, for all , the following conditions hold:
  • is a function of ;

Therefore, a sequence is a martingale if it is a martingale with respect to itself.

The purpose of this generalization is that we are usually more interested in a function of a sequence of random variables, rather than the sequence itself.

The Doob martingales

The following definition describes a very general approach for constructing an important type of martingales.

Definition (The Doob sequence)
The Doob sequence of a function with respect to a sequence of random variables is defined by
In particular, and .

The Doob sequence of a function defines a martingale. That is

for any .

To prove this claim, we recall the definition that , thus,

where the second equation is due to the fundamental fact about conditional expectation introduced in the first section.

The Doob martingale describes a very natural procedure to determine a function value of a sequence of random variables. Suppose that we want to predict the value of a function of random variables . The Doob sequence represents a sequence of refined estimates of the value of , gradually using more information on the values of the random variables . The first element is just the expectation of . Element is the expected value of when the values of are known, and when is fully determined by .

The following two Doob martingales arise in evaluating the parameters of random graphs.

Example: edge exposure martingale
Let be a random graph on vertices. Let be a real-valued function of graphs, such as, chromatic number, number of triangles, the size of the largest clique or independent set, etc. Denote that . Fix an arbitrary numbering of potential edges between the vertices, and denote the edges as . Let
Let and for , let .
The sequence gives a Doob martingale that is commonly called the edge exposure martingale.
Example: vertex exposure martingale
Instead of revealing edges one at a time, we could reveal the set of edges connected to a given vertex, one vertex at a time. Suppose that the vertex set is . Let be the subgraph of induced by the vertex set , i.e. the first vertices.
Let and for , let .
The sequence gives a Doob martingale that is commonly called the vertex exposure martingale.

Azuma's inequality -- general version

Azuma's inequality can be generalized to a martingale with respect another sequence.

Azuma's Inequality (general version)
Let be a martingale with respect to the sequence such that, for all ,

The proof is almost identical to the proof of the original Azuma's inequality. We also work on the sum of the martingale differences (this time the differences are ), yet conditioning on . The rest of the proof proceeds in the same way.

Application: Chromatic number

The random graph is the graph on vertices , obtained by selecting each pair of vertices to be an edge, randomly and independently, with probability . We denote if is generated in this way.

Theorem [Shamir and Spencer (1987)]
Let . Let be the chromatic number of . Then
Consider the vertex exposure martingale

where each exposes the induced subgraph of on vertex set . A single vertex can always be given a new color so that the graph is properly colored, thus the bounded difference condition

is satisfied. Now apply the Azuma's inequality for the martingale with respect to .

For , the theorem states that the chromatic number of a random graph is tightly concentrated around its mean. The proof gives no clue as to where the mean is. This actually shows how powerful the martingale inequalities are: we can prove that a distribution is concentrated to its expectation without actually knowing the expectation.

Application: Hoeffding's Inequality

The following theorem states the so-called Hoeffding's inequality. It is a generalized version of the Chernoff bounds. Recall that the Chernoff bounds hold for the sum of independent trials. When the random variables are not trials, the Hoeffding's inequality is useful, since it holds for the sum of any independent random variables whose ranges are bounded.

Hoeffding's inequality
Let , where are independent random variables with for each . Let . Then
Define the Doob martingale sequence . Obviously and .

Apply Azuma's inequality for the martingale with respect to , the Hoeffding's inequality is proved.

For arbitrary random variables

Given a sequence of random variables and a function . The Doob sequence constructs a martingale from them. Combining this construction with Azuma's inequality, we can get a very powerful theorem called "the method of averaged bounded differences" which bounds the concentration for arbitrary function on arbitrary random variables (not necessarily a martingale).

Theorem (Method of averaged bounded differences)
Let be arbitrary random variables and let be a function of satisfying that, for all ,
Define the Doob Martingale sequence by setting and, for , . Then the above theorem is a restatement of the Azuma's inequality holding for .

For independent random variables

The condition of bounded averaged differences is usually hard to check. This severely limits the usefulness of the method. To overcome this, we introduce a property which is much easier to check, called the Lipschitz condition.

Definition (Lipschitz condition)
A function satisfies the Lipschitz condition, if for any and any ,

In other words, the function satisfies the Lipschitz condition if an arbitrary change in the value of any one argument does not change the value of the function by more than 1.

The diference of 1 can be replaced by arbitrary constants, which gives a generalized version of Lipschitz condition.

Definition (Lipschitz condition, general version)
A function satisfies the Lipschitz condition with constants , , if for any and any ,

The following "method of bounded differences" can be developed for functions satisfying the Lipschitz condition. Unfortunately, in order to imply the condition of averaged bounded differences from the Lipschitz condition, we have to restrict the method to independent random variables.

Corollary (Method of bounded differences)
Let be independent random variables and let be a function satisfying the Lipschitz condition with constants , . Then
For convenience, we denote that for any .

We first show that the Lipschitz condition with constants , , implies another condition called the averaged Lipschitz condition (ALC): for any , ,

And this condition implies the averaged bounded difference condition: for all ,

Then by applying the method of averaged bounded differences, the corollary can be proved.

For any , by the law of total expectation,

Let and , and take the diference. Then

Thus, the Lipschitz condition is transformed to the ALC. We then deduce the averaged bounded difference condition from ALC.

By the law of total expectation,

We can trivially write as

Hence, the difference is

The averaged bounded diference condition is implied. Applying the method of averaged bounded diferences, the corollary follows.


Occupancy problem

Throwing balls uniformly and independently at random to bins, we ask for the occupancies of bins by the balls. In particular, we are interested in the number of empty bins.

This problem can be described equivalently as follows. Let be a uniform random function from . We ask for the number of that is empty.

For any , let indicate the emptiness of bin . Let be the number of empty bins.

By the linearity of expectation,

We want to know how deviates from this expectation. The complication here is that are not independent. So we alternatively look at a sequence of independent random variables , where represents the bin into which the th ball falls. Clearly is function of .

We than observe that changing the value of any can change the value of by at most 1, because one ball can affect the emptiness of at most one bin. Thus as a function of independent random variables , satisfies the Lipschitz condition. Apply the method of bounded differences, it holds that

Thus, for sufficiently large and , the number of empty bins is tightly concentrated around

Pattern Matching

Let be a sequence of characters chosen independently and uniformly at random from an alphabet , where . Let be an arbitrarily fixed string of characters from , called a pattern. Let be the number of occurrences of the pattern as a substring of the random string .

By the linearity of expectation, it is obvious that

We now look at the concentration of . The complication again lies in the dependencies between the matches. Yet we will see that is well tightly concentrated around its expectation if is relatively small compared to .

For a fixed pattern , the random variable is a function of the independent random variables . Any character participates in no more than matches, thus changing the value of any can affect the value of by at most . satisfies the Lipschitz condition with constant . Apply the method of bounded differences,

Combining unit vectors

Let be unit vectors from some normed space. That is, for any , where denote the vector norm (e.g. ) of the space.

Let be independently chosen and .



This kind of construction is very useful in combinatorial proofs of metric problems. We will show that by this construction, the random variable is well concentrated around its mean.

is a function of independent random variables . By the triangle inequality for norms, it is easy to verify that changing the sign of a unit vector can only change the value of for at most 2, thus satisfies the Lipschitz condition with constant 2. The concentration result follows by applying the method of bounded differences: