Q.7.19

Question

There are n items in a box labeled H and m in a box labeled T. A coin that comes up heads with probability p and tails with probability 1 − p is flipped. Each time it comes up heads, an item is removed from the H box, and each time it comes up tails, an item is removed from the T box. (If a box is empty and its outcome occurs, then no items are removed.) Find the expected number of coin flips needed for both boxes to become empty. Hint: Condition on the number of heads in the first n + m flips.

Step-by-Step Solution

Verified
Answer

The expected number of coin flips needed for both boxes to become empty is E[X]=i=0nnipn+mCipi(1p)n+mi+i=n+1n+min1pn+mCipi(1p)n+mi.

1Step 1: Given information

A coin that comes up heads with probability p and tails with probability 1 − p is flipped.

It comes up heads, an item is removed from the H box, and each time it comes up tails 

Item is removed from the T box 

2Step 2: Solution

The solution will be shown below,

E[X]=i=1n+mE[XY=i]P{Y=i}

=i=0n+mE[XY=i]n+mCipi(1p)n+mi

If the numeral of Heads in the first n+m flips is i,in, Then many more flips is the numeral of flips needed to receive additional (n-i) Heads. Similarly, if the number of Heads in the first n+m flips is i, j>n, then because there would keep existed a total of n+m-i<m tails, the numeral of more flips is the number required to receive an additional (i-n) Heads. Since the number of flips needed for j outcomes of a particular type is a negative Binomial Random variable whose mean is j divided by the probability of that outcome,

Therefore,

E[X]=i=0nnipn+mCipi(1p)n+mi+i=n+1n+min1pn+mCipi(1p)n+mi

3Step 3: Final answer

The expected number of coin flips needed for both boxes to become empty is E[X]=i=0nnipn+mCipi(1p)n+mi+i=n+1n+min1pn+mCipi(1p)n+mi.