Suppose that we can obtain independent samples of a random variable and that we want to use these samples to estimate . Using samples, we use for our estimate of . We want the estimate to be within from the true value of with probability at least . We may not be able to use Chernoff’s bound directly to bound how good our estimate is if is not a 0-1 random variable, and we do not know its moment generating function. We develop an alternative approach that requires only having a bound on the variance of . Let .
Show using Chebyshev’s inequality that samples are sufficient to solve the problem.
Suppose that we need only a weak estimate that is within of with probability at least . Argue that samples are enough for this weak estimate.
Show that, by taking the median of independent weak estimates, we can obtain an estimate within of with probability at least . Conclude that we need only samples.
Let , then and .
By Chebyshev’s inequality,
Now that , thus .
Suppose , then , and thus .
When it comes to using a median of weak estimates to boost the confidence in estimation, we have a trick called Median of Mean (MoM) [JVV86]. The key idea is to take advantage of the “structure” of median value, that half of the weak estimates are smaller, while the other half are greater.
Since we hope with probability at least , the median of weak estimates is within range, then we say the bad event is the median of weak estimates is out of range. Equivalently, a bad event occurs when more than half of the weak estimates are above , or more than half of them are below .
Form each weak estimate from an independent batch of samples, so the weak estimates are independent. In this sense, we introduce independent 0-1 random variables (indicators) and where
only when weak estimate is smaller than ,
only when weak estimate is greater than ,
and , . Since a weak estimate is within range with probability at least , we have both and upper bounded by , and thus both and are at most .
We first bound , and derive by symmetry. By Chernoff’s bound,
Then we have , and derive that min by for a positive . Now that
we have , thus .
We thus conclude that we need samples in total. ∎
Consider a collection of independent geometrically distributed random variables with mean 2. Let and .
Derive a bound on by applying Chernoff’s bound to a sequence of fair coin tosses.
Directly derive a Chernoff’s bound on using the MGF for geometric random variables.
Compare these 2 bounds derived above.
A way to model the “Coupon Collection” alike problem for bounding the sum of geometrically distributed random variables is transforming to an upper bound to the sum of a sequence of Bernoulli trials.
Since a geometrically distributed random variable can be seen as the number of Bernoulli trials until one success, then for event , there are at most successes among independent Bernoulli trials (in the worst case, the last trial must be success among successes in total trials).
We write as independent Bernoulli trial with success probability being among trials, we write , and . We thus can upper bound by , as we can loosen the boundary condition on the worst case, where last trial must be successful among successes.
By Chernoff’s bound for bounding the deviation below the mean, we have
with , and min by deriving a upper bound .
If we brute force for a bound on , the MGF of is . When , . Again by Chernoff’s bound for bounding the deviation above the mean,
and , and thus max by ,
By section 1.5.1, we know the first one is looser. ∎
We show how to construct a random permutation on , given a black box that outputs numbers independently and uniformly at random from where . If we compute a function with for , this yields a permutation, by outputting according to the order of . To construct such a function , do the following for : choose by repeatedly drawing number from the black box and set to the first number that is for .
Prove that this approach gives a permutation chosen uniformly at random for all permutations. Find the expected number of calls to the black box that are needed when and . For the case , argue that the probability that each call to the black box assigns a value of to some is at least . Based on this, use a Chernoff bound to bound the probability that the number of calls to the black box is at least .
At the first sight, this is a “Coupon Collection” problem, where we can introduce independent geometrically distributed random variables each with success probability , and we write . When , each as .
For expectation of , by linearity of expectation. For , by conditional expectation and memoryless of geometric distribution,
. Thus when , when .
For upper bounding , we first upper bound by , where are independent geometrically distributed random variables, each with success probability , and we write . Then we upper bound by through the previous trick of turning sum of geometrically distributed random variables into sum of a sequence of Bernoulli trials. We introduce independent Bernoulli distributed random variables with , and we write .
By Chernoff’s bound, we have
with min at , thus derives an upper bound by . ∎
Let be independent Poisson trials such that . Let so that . Let
Show that, for ,
Show that, when , we have .
Argue that
For Chernoff’s bound on , we typically turn to for , then
to derive an upper bound by choosing . A different bound can be derived by avoiding the trick we often apply,
then we have
When , min by
By taking both sides, we have
thus deriving a bound for . Finally, when bounding ,
Taking partial derivative against in , we have
and it is when , taking second order partial derivative against , we have
and therefore by Taylor expansion.
We can plug in the result , and derive
When and we upper bound , gives , then . Thus,
Eventually, we derive bounds on both sides by
is exactly the KL divergence [KL51] between Bernoulli distributions with parameters and .
∎
Let be independent Poisson trials such that , and let be real numbers in . Let and . Then the following Chernoff bound holds: for any ,
Prove a similar bound for the probability that for .
By Jensen’s inequality over concave functions,
for all , as is concave if .
By Chernoff’s upper tail and lower tail bound,
By Chernoff’s bound and Jensen’s inequality, for upper tail bound, given and ,
and right hand side is minimized by
Symmetrically, for lower tail bound, given and ,
with right hand side minimized by
∎
Let , where are independent 0-1 random variables. Let . Choose any and such that . Then, for any ,
Similarly, for any ,
The MGF of can be relaxed in following manner
Given ,
When , .
When , .
Then for upper tail with and ,
the right hand side is minimized by
For lower tail with and ,
the right hand side is minimized by
Moreover, for lower tail bound,
The first inequality holds from , the second one holds from Chernoff’s bound, and the third one holds from the fact that for ,
This chain of inequality comes in handy when we cannot compute the exact expectation, yet we can still derive a lower bound for the expectation, and give a looser version of tail bound. The sandwiched inequality chain can even be applied with previous weighted version of Chernoff bound with weights in . ∎
Hoeffding’s bound says that a sum of independent bounded random variables concentrates around the sum of their expectations. The probability of being far deacays exponentially fast in the squared deviation, namely .
Let be a random variable with and , then for any ,
Since is convex, then
For , let , then .
Since , then by linearity of expectation,
Let , and
then when ,
Since ,
means , and
By the Taylor expansion and the Taylor remainder theorem in Lagrange form, there is between and such that
Therefore,
∎
Let be independent random variables such that for all , and . Then
Let , then and for . Let . For ,
where the second inequality is from Markov inequality over MGF, the third equality is from being independent, the fourth inequality is from lemma 1.4.8, and the last inequality is by minimizing at .
The lower bound argument is similar, for ,
where the last inequality is by minimizing at . ∎
Let be independent random variables such that for all , and , then
Let , then and for . Let . For ,
where the last inequality is by minimizing at .
The lower bound argument is similar, for ,
where the last inequality is by minimizing at . ∎
We prove that the Randomized Quicksort algorithm sorts a set of numbers in time with high probability. Consider the following view of Randomized Quicksort. Every point in the algorithm where it decideds on a pivot element is called a node. Suppose the size of the set to be sorted at a particular node is . The node is called good if the pivot element divides the set into two parts, each of size not exceeds . Otherwise the node is called bad. The nodes can be thought of as forming a tree in which the root node has the whole set to be sorted and its children have the two sets formed after the first pivot step and so on.
Show that the number of good nodes in any path from the root to a leaf in this tree is not greater than , where is some positive constant.
Show that, w.h.p. (greater than ), the number of nodes in a given root to leaf path of the tree is not greater than , where is another constant.
Show that, w.h.p. (greater than ), the number of nodes in the longest root to leaf path is not greater than .
Show that the running time of Quicksort is with probability at least .
Suppose a given node with all the internal nodes being good nodes, then the longest such path gives the upper bound on the number of good nodes in any path of the tree. This can be proven by contradiction.
Suppose the path with the largest number of good nodes is not with all good nodes, looking like , where is a not good node. Then the suffix path has to be the path with the largest number of good nodes among the subtree with root ; otherwise there exists a path in subtree with root with more good nodes, then has less good nodes than , contradicting with being the path with the most good nodes among the tree.
We assume being the path with the largest number of good nodes among the subtree rooted by , then the largest number of good nodes under subtree rooted by is , so is the subtree rooted by . Since the subtree rooted by as strictly more nodes than the subtree rooted by , then the largest number of good nodes of subtree rooted by is lower bounded by . Thus we complete the proof that the largest number of good nodes from a tree is from the longest path with all nodes being good nodes.
The longest path full of good nodes has length , by partition on boundary of good node condition, and choose the big piece side.
One observation: a path has at most good nodes.
Let be the length of a path, and we want to upper bound . By prior observation, the path can have at most good nodes, and we can turn the bound on path length into the bound on the number of good nodes. If the path survives levels, then among those first levels we have seen at most good nodes (since too many of good nodes stops a path from growing). Therefore , where are independent Bernoulli trials with parameter , and .
We want for lower tail bounding, and sufficiently large. By Chernoff’s bound,
where and .
For bounding the longest path is no longer than , we union bound against all leaves (at most ), that the probability of existing a path longer than is at most , hence the path is at most long with probability .
Each row of partition is dominated by runtime in , and the tree height is at most with probability at least , hence that the runtime of the algorithm is with probability greater than . ∎
Consider the bit-fixing routing algorithm for routing a permutation on the -cube. Suppose that is even. Write each source node as , with and of length . Let the destination of ’s packet be . Show that this permutation causes the bit-fixing routing algorithm to take steps.
Since the permutation is , we can view the algorithm as 2 phases by fixing and . WLOG we analyze the property from phase 1, as the 2 phases are symmetric.
We write address format in , where and . During the bit fixing, the packet from traverses to . Eventually, when all bits are fixed to , the packet arrives .
We notice that there are up to such intermediate addresses , yet in the -cube there are packets. Thus, nodes with addresses will be traversed by packets in total.
Another interesting observation is: the packet routing in such permutation is not “load-balancing”.
View each bit being fixed as a packet traversing from one half-hypercube to another half-hypercube. By prior discussion, we noticed that the first phase bit fixing is “localized”, namely all packets from go to , and it takes no other packets. To be more generalized, all packets from go to . The earlier the bit being fixed, the less packets traversing through half-hypercubes. With more bits fixed in the front () and less bits flexible in the back (), more packets aggregated from sub-hypercubes are forced to take 1 path to merge sub-hypercubes (Think of 8 packets over 3 bit hypercube, the edge will take 4 packages). Therefore, right before bit being fixed, where , there are packets aggregated for 1 bit fix to , that the edge will be used by packets, and thus the edge has an delay.
We conclude that the deterministic bit-fixing algorithm takes steps to route in this permutation. ∎
Consider the following modification to the bit-fixing routing algorithm for routing a permutation on the -cube. Instead of fixing the bits in order from to , each packet chooses a random order (independent of other packet’s choices) and fixes the bits in that order. Show that there is a permutation for which this algorithm requires steps with high probability.
We use the previous permutation , and special cases, and , are interesting. For these permutations, we would like to lower bound the number of packets that traverse .
To reach , the non-zero side should be fixed to zero first, before any bit on zero side being fliped to non-zero. WLOG we discuss the case that non-zero on the left side, the non-zero on right side follows from symmetry. We introduce 0-1 independent random variables where and , indicating if packet with ones traverses . The routing should fix one bits first, thus .
Before moving to the lower bound the packet numbers, we need to derive the expectation of ,
the relaxation on follows
The previous lower tail bound inequality chain comes in handy, that
Since , we conclude that the algorithm on this permutation has runtime time steps. ∎
Assume we use the randomized routing algorithm for -cube network to route a total of up to packets, where each node is the source of no more than packets, and each node is the destination of no more than packets.
Give a high probability bound on the runtime of the algorithm.
Give a high probability bound on the maximum number of packets at any nodes at any step of the execution of the routing algorithm.
The analysis follows from the runtime analysis for randomized bit-fixing routing [VB81], but the number of packets increase from to . There are 2 phases, by first routing packets to random intermediate nodes, then route these nodes to their destinations. WLOG we analyze the first phase’s runtime, as they are symmetric.
Follow from the proof structure, we first bound the number of “active packets” over certain path, then upper bound the probability of the path with not many “active packets” yet runs slow, finally we derive a probability upper bound by union bounding all paths over the -cube.
We recall the notion of “active packets”, that a packet is “active” at a node on the path. If and are adjacent on path, and diff by bit, in order for a packet to be “active”, its bits should be fixed before bit when it reaches . With that said, there are packets sharing same suffix as from bit, while the probability of sampling a random intermediate address with prefixed bits matching is . Thus, the expected number of “active packets” at a node on an edge is .
Given a path of length , the path is at most as there are bits to fix. Let be the number of “active packets” on this path, then the expected number of “active packets” is upper bounded by . By Chernoff’s bound, the probability of having too many “active packets” is upper bounded as follows
By conditional probability, we derive the following upper bound by sums of (conditional) probabilities
We upper bound the probability of the runtime of the path being at least time steps by either “too many active packets” or “not many active packets but running slow” as follows
For “not many active packets but running slow” case, the runtime of the path is measuring how many packets stay on the path, turns into the time steps used to route all the packets. Only “active packets” can stay on the path, with probability to branch into the next node on path. An “active packet”’s stay on the path can be modeled by the number of failures in a geometrically distributed random variable, and it leaves the path on a successful trial with probability . Upper bound on the sum of geometrically distributed random variables can be relaxed by upper bounding the sum of a serial of Bernoulli trials with parameter here
Therefore, the probability for the path’s runtime being at least is upper bounded by
Union bounding over paths, the probability of the first phase runtime exceeding is at most .
On the number of packets at any nodes at any time step, we can upper bound by the number of packets that will traverse the node. Let be the number of packets arriving the node on bit, be the number of packets using the node. Since by source packets and probability in random address prefix matching the node’s address’s prefix, by linearity of expectation, .
Once we have an expectation, by Chernoff’s bound we have for this node at a certain step. By union bound over all nodes and time steps, the queue exceeding has probability at most . ∎
Given a network that is an undirected graph , where nodes represent processors and the edges between the nodes represent wires. We are also given a set of packets to route. For each packet we are given a source node, a destination node, and the exact route that the packet should take from source to destination. In each time step, at most one packet can traverse an edge. A packet can wait at any node during any time step, and we assume unbounded queue sizes at each node.
A schedule for a set of packets specifies the timing for the movement of packets along their respective routes. That is, it specifies which packet should move and which should wait at each time step. Our goal is to produce a schedule for the packets that tries to minimize the total time and the maximum queue size needed to route all the packets to their destination.
The dilation is the maximum distance traveled by any packet. The congestion is the maximum number of packets that must traverses a single edge during the entire course of the routing. Argue that the time required for any schedule should be at least .
Consider the following unconstrained schedule, where many packets may traverse an edge during a single time step. Assign each packet an integral delay , chosen randomly, independently, and uniformly from the interval , where is a constant. A packet waits in its source node for time steps, then it moves on to its final destination through its specified route without ever stopping. Give an upper bound on the probability that more than packets use a particular edge at a particular time step .
Again using the unconstrained schedule, show that the probability that more than packets pass through any edge at any time step is at most for a positive constant .
Use the unconstrained schedule to devise a simple randomized algorithm that, with high probability, produces a schedule of length using queues of size and following the constraint that at most one packet crosses an edge per time step.
The length of the schedule is the runtime of the routing algorithm, and it is lower bounded by: the maximum distance a packet can traverse in the network, and the maximum congestion that delays the package traversal. Therefore, let denotes the time steps of the routing algorithm, and , and we conclude that .
Considering how many packets traverse edge at the time step, we introduce independent 0-1 random variables, where stands for packet traverses at time step. Since there are at most packets traverse , and if they traverse at the time step, they had to be starting by one of the delays, we here upper bound the expectation of by
By 1.4.7, given ,
we have probability upper bounded by .
Bounding the number of packets traverses any edge at any time step is equivalent to bounding the congestion of the schedule, which can be achieved by union bounding through all the time steps and all the edges. Each packet can go as far as edges, and the packet arrives destination with at most time steps (by assumption that it does not stop once). If and , the upper bounded probability is
If the tuned algorithm has schedule of length with queue size , try scale the schedule by . By previous result, with the assumption that multiple packets crossing an edge at a time with no stop, the probability of more than packets passing through any edge at any time step is at most . In the prior model, each time step the edge let packets crossing in a batch, and the batch is at most .
Now removing the assumption of multiple packets crossing an edge at a time, by scaling to the schedule and queue of size , given an edge allowing only 1 packet at a time, the batched moving can be simulated with the devised algorithm. ∎
The intuition is: we first let everyone run non-stop with random starts, count how bad the pileups get, then spread those pileups thin by stretching time proportionally, and leading to an average case non stop routing. This is the Leighton-Maggs-Rao trick [LMR94].