A monkey types on a 26-letter keyboard that has lowercase letters only. Each letter is chosen independently and uniformly at random from the alphabet. If the monkey types 1,000,000 letters, what is the expected number of times the sequence “proof” appears?
This is exactly a brain teaser in linearity of expectation.
Say are 0-1 random variables indicating if the sequence “proof” appears at alphabet. Then is the random variable for the number of appearances of the sequence “proof”.
By linearity of expectation,
∎
We draw cards uniformly at random with replacement from a deck of cards. What is the expected number of cards we must draw until we have seen all cards in the deck? If we draw cards, what is the expected number of cards in the deck that are not chosen at all? Chosen exactly once?
The problem is a combination of “coupon collection” problem and “indicator” problem.
First one is the “coupon collection” problem, then let be the number of draws to draw different card, which is a geometrically distributed random variable with parameter , and be the total number of draws to draw all different cards. .
Later, we introduce 0-1 random variables indicating if the cards is not drawn once in the draws, then . Let for the number of cards not drawn at all in draws, then
We also introduce 0-1 random variables indicating if the card is drawn only once in the draws, then . Let for the number of cards drawn only once in draws, then
∎
Suppose we flip a coin times to obtain a sequence of flips . A streak of flips is a consecutive subsequence of flips that are all the same.
Let be a power of 2. Show that the expected number of streaks of length is .
Show that, for sufficiently large , the probability that there is no streak of length at least is less than .
We first consider the expected number of streaks of length at least . This is solved by the linearity of expectation, by introducing 0-1 random variables, where , indicating the flip starts a streak of length at least . The probability for can be upper bounded as follows
as streak on either face works. Therefore, number of streaks is , and the expectation is
We now show that the probability of no streaks of length at least is less than . We consider segments of length flips, and thus introduce independent 0-1 random variables indicating if the segment starts a streak of length at least . Therefore .
Though segments is less than the total number of potential segments among flips, it suffices for giving a sufficiently low probability. We now bound the probability of all segments has no streaks of length by
Let . By for any , we lower bound by
Therefore, is at most , and thus completes the proof. ∎
A permutation on the numbers can be represented as a function . A fixed point of a permutation is a value for which . Find the expected number of fixed points for a permutation chosen uniformly at random for all permutations.
This is another indicator counting problem.
We introduce 0-1 random variables indicating if value is a fixed point for the permutation. Then , and thus the expectation of , which is the number of fixed points in , is
∎
If is a convex function, then
If is concave, then
The expression is a random variable that takes on value when .