Chapter 5
Exercise 5.1-1
We prove the contrapositive, if we don't have total order on the ranks of the candidates, then we cannot always determine which candidate is best, in line 4 of procedure Hire-Assistant.
A lack of total order implies that there are incomparable candidates. Assume one such pair is denoted by indices and currently . When we reach candidate , we cannot evaluate the condition in line 4. Consequently, we are unable to decide should we keep or switch to .
Exercise 5.1-2
We can employ an algorithm similar to binary search. Let be a size of the interval and assume that one call to Random(0,1) takes a constant amount of time.
Each iteration splits the current range of size into and sized chunks, randomly discards one part of it, and continues until the size of the range drops to 1. The number of iterations (expected running time) is . The probability of being selected is , since calls to Random(0,1) can be regarded as Bernoulli trials with probability of success 1/2. Therefore, Random(a,b) ensures uniform distribution over returned values.
Exercise 5.1-3
Available in the latest revision of the IM.
Exercise 5.2-1
Available in the latest revision of the IM.
Exercise 5.2-2
Available in the latest revision of the IM.
Exercise 5.2-3
Available in the latest revision of the IM.
Exercise 5.2-4
Available in the latest revision of the IM.
Exercise 5.2-5
Available in the latest revision of the IM.
Exercise 5.2-6
Available in the latest revision of the IM.
Exercise 5.3-1
Available in the latest revision of the IM.
Exercise 5.3-2
Available in the latest revision of the IM.
Exercise 5.3-3
Available in the latest revision of the IM.
Exercise 5.3-4
Available in the latest revision of the IM.
Exercise 5.3-5
Available in the latest revision of the IM.
Exercise 5.4-1
In both subproblems we assume that birthdays are independent and uniformly distributed.
Subproblem 1
We follow a similar analysis as for the birthday paradox from the book. Let be the event that person has a different birthday than I do. We have that . Let be the event that none of the people has the same birthday as I do. Observe that . We iteratively apply the recurrence (5.8) to obtain
We need to find such that , or . This gives . For it is .
Subproblem 2
Let the random variable denote the number of people (out of ) having a birthday on July 4. This variable follows the binomial distribution, so . We are looking for the smallest such that . For this gives .
Exercise 5.4-2
We need to find such that . Solving for gives
For it is . Plugging these values into the formula we get, that the the expected number of pairs of people with the same birthday is approximately 4.69.
Exercise 5.4-3
Observe that the first toss will land in an empty bin. Let be a random variable denoting how many additional tosses are needed until some bin contains two balls. Obviously , as we surely need at least one extra toss. , since we must have 1 miss. In general, at least tosses are required, when none of the first balls ended up in an occupied bin, so
We know that and . When a random variable takes on values from the set of natural numbers, then we have a nice formula for its expectation (see equation (C.28) on page 1193 in the book). Therefore, the expected number of tosses is
Exercise 5.4-4
It is important that the birthdays be mutually independent.
The conditional probability chain, obtained by iteratively applying the recurrence (5.8), depends on ensuring that, at each step, the birthday variable has the same uniform distribution, unaffected by the previous choices apart from not colliding with earlier birthdays. This chain is only valid when the entire joint assignment is described by uniform, mutually independent random variables. Pairwise independence does not ensure that, once several variables have been assigned, the distribution of the next variable is still as required for the calculation: dependencies among larger groups can profoundly alter probabilities for intersections and unions of events. On page 1188 of the book, you have a concrete example about the difference between pairwise and mutual independence.
Exercise 5.4-5
This sequence lists solutions for variations of the birthday problem depending on how many people should share the same birthday. For this exercise it is . Let us see how we can derive it analytically.
We assume that birthdays are mutually independent and uniformly distributed, so any sequence of birthdays occurs with probability . For and , let be the probability that among people exactly pairs of people have matching birthdays, which implies that no triples of people share birthdays. Our probability that among people there are triples sharing birthdays is given by
We can select days out of , and assign these to unallocated pairs of people, in ways. The remaining days can be assigned to the remaining people in ways. Since people are distinguishable, the total number of allocations should be multiplied by . We also need to divide the resulting number by , since people sharing the same birthday are relatively unordered. After combining these pieces, we get
You can verify that entails .
Exercise 5.4-6
We can form -strings over a set of size . Any -string with distinct elements is a -permutation. By equation (C.1), there are possible -permutations. If we denote by the event that people have distinct birthdays, then the probability that a -string over a set of size forms a -permutation equals ; on page 141 of the book you have this in expanded form.
Exercise 5.4-7
Available in the latest revision of the IM.
Exercise 5.4-8
Let's partition the coin flips into at least groups of consecutive flips and bound the probability that no group comes up all heads. By equation (5.9), the probability that the group starting in position comes up all heads is
The probability that a streak of heads of length at least does not begin in position is therefore at most . Since the groups are formed from mutually exclusive, independent coin flips, the probability that everyone of these groups fails to be a streak of length is at most
Using the same reasoning as for deriving equation (5.13) (see page 148 in the book), the probability that the longest streak equals or exceeds is .
Problem 5-1
Available in the latest revision of the IM.
Problem 5-2
Available in the latest revision of the IM.
A more rigorous treatment of tasks (e) and (f) is based on conditional expectation. Let and equal the number of indices of A that are examined. Define and , so that and . A position is examined only if it’s the first position in , which occurs with probability . A position is examined only if, out of position and all positions in , is the first position, which occurs with probability . Let be an event that the indices of elements we are searching for belong in . We have
Last updated