随机算法 (Spring 2013)/Moment and Deviation

From EtoneWiki
Jump to: navigation, search

Stable Marriage

We now consider the famous stable marriage problem or stable matching problem (SMP). This problem captures two aspects: allocations (matchings) and stability, two central topics in economics.

An instance of stable marriage consists of:

  • men and women;
  • each person associated with a strictly ordered preference list containing all the members of the opposite sex.

Formally, let be the set of men and be the set of women. Each man is associated with a permutation of elemets in and each woman is associated with a permutation of elements in .

A matching is a one-one correspondence . We said a man and a woman are partners in if .

Definition (stable matching)
A pair of a man and woman is a blocking pair in a matching if and are not partners in but
  • prefers to , and
  • prefers to .
A matching is stable if there is no blocking pair in it.

It is unclear from the definition itself whether stable matchings always exist, and how to efficiently find a stable matching. Both questions are answered by the following proposal algorithm due to Gale and Shapley.

The proposal algorithm (Gale-Shapley 1962)
Initially, all person are not married;
in each step (called a proposal):
  • an arbitrary unmarried man proposes to the woman who is ranked highest in his preference list among all the women who has not yet rejected ;
  • if is still single then accepts the proposal and is married to ;
  • if is married to another man who is ranked lower than in her preference list then divorces (thus becomes single again and considers himself as rejected by ) and is married to ;
  • if otherwise rejects ;

The algorithm terminates when the last single woman receives a proposal. Since for every pair of man and woman, proposes to at most once. The algorithm terminates in at most proposals in the worst case.

It is obvious to see that the algorithm retruns a macthing, and this matching must be stable. To see this, by contradiction suppose that the algorithm resturns a macthing , such that two men are macthed to two women in respectively, but and prefers each other to their partners and respectively. By definition of the algorithm, would have proposed to before proposing to , by which time must either be single or be matched to a man ranked lower than in her list (because her final partner is ranked lower than ), which means must have accepted 's proposal, a contradiction.


We are interested in the average-case performance of this algorithm, that is, the expected number of proposals if everyone's preference list is a uniformly and independently random permutation.

The following principle of deferred decisions is quite useful in analysing performance of algorithm with random input.

Principle of deferred decisions
The decision of random choice in the random input can be deferred to the running time of the algorithm.

Apply the principle of deferred decisions, the deterministic proposal algorithm with random permutations as input is equivalent to the following random process:

  • At each step, a man choose a woman uniformly and independently at random to propose, among all the women who have not rejected him yet. (sample without replacement)

We then compare the above process with the following modified process:

  • The man repeatedly samples a uniform and independent woman to propose among all women, until he successfully samples a woman who has not rejected him and propose to her. (sample with replacement)

It is easy to see that the modified process (sample with replacement) is no more efficient than the original process (sample without replacement) because it simulates the original process if at each step we only count the last proposal to the woman who has not rejected the man. Such comparison of two random processes by forcing them to be related in some way is called coupling.

Note that in the modified process (sample with replacement), each proposal, no matter from which man, is going to a uniformly and independently random women. And we know that the algorithm terminated once the last single woman receives a proposal, i.e. once all women have received at least one proposal. This is the coupon collector problem with proposals as balls (cookie boxes) and women as bins (coupons). Due to our analysis of the coupon collector problem, the expected number of proposals is bounded by .

Tail Inequalities

When applying probabilistic analysis, we often want a bound in form of for some random variable (think that is a cost such as running time of a randomized algorithm). We call this a tail bound, or a tail inequality.

Besides directly computing the probability , we want to have some general way of estimating tail probabilities from some measurable information regarding the random variables.

Markov's Inequality

One of the most natural information about a random variable is its expectation, which is the first moment of the random variable. Markov's inequality draws a tail bound for a random variable from its expectation.

Theorem (Markov's Inequality)
Let be a random variable assuming only nonnegative values. Then, for all ,
Proof.
Let be the indicator such that

It holds that . Since is 0-1 valued, . Therefore,

Example (from Las Vegas to Monte Carlo)

Let be a Las Vegas randomized algorithm for a decision problem , whose expected running time is within on any input of size . We transform to a Monte Carlo randomized algorithm with bounded one-sided error as follows:

:
  • Run for long where is the size of .
  • If returned within time, then return what just returned, else return 1.

Since is Las Vegas, its output is always correct, thus only errs when it returns 1, thus the error is one-sided. The error probability is bounded by the probability that runs longer than . Since the expected running time of is at most , due to Markov's inequality,

thus the error probability is bounded.

Generalization

For any random variable , for an arbitrary non-negative real function , the is a non-negative random variable. Applying Markov's inequality, we directly have that

This trivial application of Markov's inequality gives us a powerful tool for proving tail inequalities. With the function which extracts more information about the random variable, we can prove sharper tail inequalities.

Variance

Definition (variance)
The variance of a random variable is defined as
The standard deviation of random variable is

We have seen that due to the linearity of expectations, the expectation of the sum of variable is the sum of the expectations of the variables. It is natural to ask whether this is true for variances. We find that the variance of sum has an extra term called covariance.

Definition (covariance)
The covariance of two random variables and is

We have the following theorem for the variance of sum.

Theorem
For any two random variables and ,
Generally, for any random variables ,
Proof.
The equation for two variables is directly due to the definition of variance and covariance. The equation for variables can be deduced from the equation for two variables.

We will see that when random variables are independent, the variance of sum is equal to the sum of variances. To prove this, we first establish a very useful result regarding the expectation of multiplicity.

Theorem
For any two independent random variables and ,
Proof.

With the above theorem, we can show that the covariance of two independent variables is always zero.

Theorem
For any two independent random variables and ,
Proof.

We then have the following theorem for the variance of the sum of pairwise independent random variables.

Theorem
For pairwise independent random variables ,
Remark
The theorem holds for pairwise independent random variables, a much weaker independence requirement than the mutual independence. This makes the variance-based probability tools work even for weakly random cases. We will see what it exactly means in the future lectures.

Variance of binomial distribution

For a Bernoulli trial with parameter .

The variance is

Let be a binomial random variable with parameter and , i.e. , where 's are i.i.d. Bernoulli trials with parameter . The variance is

Chebyshev's inequality

With the information of the expectation and variance of a random variable, one can derive a stronger tail bound known as Chebyshev's Inequality.

Theorem (Chebyshev's Inequality)
For any ,
Proof.
Observe that

Since is a nonnegative random variable, we can apply Markov's inequality, such that

Median Selection

The selection problem is the problem of finding the th smallest element in a set . A typical case of selection problem is finding the median.

Definition
The median of a set is the th element in the sorted order of .

The median can be found in time by sorting. There is a linear-time deterministic algorithm, "median of medians" algorithm, which is quite sophisticated. Here we introduce a much simpler randomized algorithm which also runs in linear time.

The LazySelect algorithm

We introduce a randomized median selection algorithm called LazySelect, which is a variant on a randomized algorithm due to Floyd and Rivest

The idea of this algorithm is random sampling. For a set , let denote the median. We observe that if we can find two elements satisfying the following properties:

  1. The median is between and in the sorted order, i.e. ;
  2. The total number of elements between and is small, specially for , .

Provided and with these two properties, within linear time, we can compute the ranks of in , construct , and sort . Therefore, the median of can be picked from in linear time.

So how can we select such elements and from ? Certainly sorting would give us the elements, but isn't that exactly what we want to avoid in the first place?

Observe that and are only asked to roughly satisfy some constraints. This hints us maybe we can construct a sketch of which is small enough to sort cheaply and roughly represents , and then pick and from this sketch. We construct the sketch by randomly sampling a relatively small number of elements from . Then the strategy of algorithm is outlined by:

  • Sample a set of elements from .
  • Sort and choose and somewhere around the median of .
  • If and have the desirable properties, we can compute the median in linear time, or otherwise the algorithm fails.

The parameters to be fixed are: the size of (small enough to sort in linear time and large enough to contain sufficient information of ); and the order of and in (not too close to have between them, and not too far away to have sortable in linear time).

We choose the size of as , and and are within range around the median of .

LazySelect

Input: a set of elements over totally ordered domain.

  1. Pick a multi-set of elements in , chosen independently and uniformly at random with replacement, and sort .
  2. Let be the -th smallest element in , and let be the -th smallest element in .
  3. Construct and compute the ranks and .
  4. If or or then return FAIL.
  5. Sort and return the th element in the sorted order of .

"Sample with replacement" (有放回采样) means that after sampling an element, we put the element back to the set. In this way, each sampled element is independently and identically distributed (i.i.d) (独立同分布). In the above algorithm, this is for our convenience of analysis.

Analysis

The algorithm always terminates in linear time because each line of the algorithm costs at most linear time. The last three line guarantees that the algorithm returns the correct median if it does not fail.

We then only need to bound the probability that the algorithm returns a FAIL. Let be the median of . By Line 4, we know that the algorithm returns a FAIL if and only if at least one of the following events occurs:

  • ;
  • ;
  • .

directly follows the third condition in Line 4. and are a bit tricky. The first condition in Line 4 is that , which looks not exactly the same as , but both and that are equivalent to the same event: the -th smallest element in is greater than , thus they are actually equivalent. Similarly, is equivalent to the second condition of Line 4.

We now bound the probabilities of these events one by one.

Lemma 1
.
Proof.
Let be the th sampled element in Line 1 of the algorithm. Let be a indicator random variable such that

It is obvious that , where is as defined in . For every , there are elements in that are less than or equal to the median. The probability that is

which is within the range of . Thus

The event is defined as that .

Note that 's are Bernoulli trials, and is the sum of Bernoulli trials, which follows binomial distribution with parameters and . Thus, the variance is

Applying Chebyshev's inequality,

By a similar analysis, we can obtain the following bound for the event .

Lemma 2
.

We now bound the probability of the event .

Lemma 3
.
Proof.
The event is defined as that , which by the Pigeonhole Principle, implies that at leas one of the following must be true:
  • : at least elements of is greater than ;
  • : at least elements of is smaller than .

We bound the probability that occurs; the second will have the same bound by symmetry.

Recall that is the region in between and . If there are at least elements of greater than the median of , then the rank of in the sorted order of must be at least and thus has at least samples among the largest elements in .

Let indicate whether the th sample is among the largest elements in . Let be the number of samples in among the largest elements in . It holds that

.

is a binomial random variable with

and

Applying Chebyshev's inequality,

Symmetrically, we have that .

Applying the union bound


Combining the three bounds. Applying the union bound to them, the probability that the algorithm returns a FAIL is at most

Therefore the algorithm always terminates in linear time and returns the correct median with high probability.