8

I have a deck of $20$ different cards.

Each time, a card is pulled randomly, then put back in the deck. We shuffle and proceed to pull another card (thus keeping the randomness of pulls).

The question is this:

After how many pulls the probability of seeing all cards in the deck is $50$$\%$?

joriki
  • 238,052
user406293
  • 81
  • 2
  • 1
    The more general form: In a deck of $n$ cards, after how many random pulls (with replacement) is the probability of having seen all cards $A$? (Where $n$ is a positive integer and $A$ is a real number in the interval $[0,1)$.) – Wildcard Jan 12 '17 at 09:58
  • 6
    This is a variation of Coupon Collector's problem – Alex Jan 12 '17 at 10:19
  • Following on from Alex's comment, setting $m=k=20$ and $p=0.5$ here tells you that the number of pulls is $67$. – lokodiz Jan 12 '17 at 10:34

2 Answers2

4

Suppose a deck consists of $n$ cards $1,...,n$, where $n$ is a fixed positive integer. For $0 \le k \le n$, and $d \ge 0$, let $p(k,d)$ be the probability, with $k$ cards not yet seen in previous draws, of seeing all the unseen cards (each at least once) in the next $d$ draws, where each draw consists of randomly selecting one card with replacement from a shuffled deck. Then $p(k,d)$ can be computed via the following recursion: $$ p(k,d)=\begin{cases} 1, & \text{if $k=0$} \\ 0, & \text{if $0 \le d < k$}\\ \left(\dfrac{k}{n}\right)p(k-1,d-1)+\left(\dfrac{n-k}{n}\right)p(k,d-1) & \text{otherwise} \end{cases} $$

Explanation:

If $k = 0$, there are no cards yet unseen, so the probability of seeing all the unseen cards is $1$.

If $0 \le d < k$, the $d$ remaining draws are not enough to see the $k$ yet unseen cards, so the probability of seeing all the unseen cards is 0.

Otherwise, draw one card. If the drawn card is one of the $k$ unseen cards, that leaves $k-1$ unseen cards; if not, it's still $k$ unseen cards. Either way, the number of remaining draws goes down by $1$, from $d$ to $d-1$.

Setting $n=20$ and applying the above recursion, Maple gets

$$p(20,66) < 1/2 < p(20,67)$$

so the answer is $67$.

quasi
  • 58,772
0

This is the coupon collector’s problem. The probability to have seen all $m$cards after $n$ attempts is

$$ \def\stir#1#2{\left\{#1\atop#2\right\}} \frac{m!}{m^n}\stir nm\;, $$

where $\stir nm$ is a Stirling number of the second kind. (See Probability distribution in the coupon collector's problem.) Thus we want to find $n$ such that

$$ \frac{20!}{{20}^n}\stir n{20}\ge\frac12\;. $$

We can take the expected number of attempts required to see all cards as an estimate. This is $20H_{20}\approx72$ (where $H_{20}$ is the $20$th harmonic number). Then some trial and error shows that $n=67$ is the least value for which the above inequality is fulfilled.

joriki
  • 238,052