
In probability theory, the coupon collector's problem refers to mathematical analysis of "collect all coupons and win" contests. It asks the following question: if each box of a given product (e.g., breakfast cereals) contains a coupon, and there are different types of coupons, what is the probability that more than boxes need to be bought to collect all coupons? An alternative statement is: given coupons, how many coupons do you expect you need to draw with replacement before having drawn each coupon at least once? The mathematical analysis of the problem reveals that the expected number of trials needed grows as
\Theta(nlog(n))
Let time be the number of draws needed to collect all coupons, and let be the time to collect the -th coupon after coupons have been collected. Then
T=t1+ … +tn
pi=
| n-(i-1) | |
| n |
=
| n-i+1 | |
| n |
ti
| 1 | |
| pi |
=
| n{n | |
| - |
i+1}
\begin{align} \operatorname{E}(T)&{}=\operatorname{E}(t1+t2+ … +tn)\\ &{}=\operatorname{E}(t1)+\operatorname{E}(t2)+ … +\operatorname{E}(tn)\\ &{}=
| 1 | |
| p1 |
+
| 1 | |
| p2 |
+ … +
| 1 | |
| pn |
\\ &{}=
| n | |
| n |
+
| n | |
| n-1 |
+ … +
| n | |
| 1 |
\\ &{}=n ⋅ \left(
| 1 | |
| 1 |
+
| 1 | |
| 2 |
+ … +
| 1 | |
| n |
\right)\\ &{}=n ⋅ Hn. \end{align}
Here is the -th harmonic number. Using the asymptotics of the harmonic numbers, we obtain:
\operatorname{E}(T)=n ⋅ Hn=nlogn+\gamman+
| 1 | |
| 2 |
+O(1/n),
\gamma ≈ 0.5772156649
Using the Markov inequality to bound the desired probability:
\operatorname{P}(T\geqcnHn)\le
| 1 | |
| c |
.
The above can be modified slightly to handle the case when we've already collected some of the coupons. Let be the number of coupons already collected, then:
\begin{align} \operatorname{E}(Tk)&{}=\operatorname{E}(tk+1+tk+2+ … +tn)\\ &{}=n ⋅ \left(
| 1 | |
| 1 |
+
| 1 | |
| 2 |
+ … +
| 1 | |
| n-k |
\right)\\ &{}=n ⋅ Hn-k\end{align}
And when
k=0
Using the independence of random variables, we obtain:
\begin{align} \operatorname{Var}(T)&{}=\operatorname{Var}(t1+ … +tn)\\ &{}=\operatorname{Var}(t1)+\operatorname{Var}(t2)+ … +\operatorname{Var}(tn)\\ &{}=
| 1-p1 | ||||||
|
+
| 1-p2 | ||||||
|
+ … +
| 1-pn | ||||||
|
\\ &{}=\left(
| n2 | |
| n2 |
+
| n2 | |
| (n-1)2 |
+ … +
| n2 | |
| 12 |
\right)-\left(
| n | |
| n |
+
| n | |
| n-1 |
+ … +
| n | |
| 1 |
\right)\\ &{}=n2 ⋅ \left(
| 1 | |
| 12 |
+
| 1 | |
| 22 |
+ … +
| 1 | |
| n2 |
\right)-n ⋅ \left(
| 1 | |
| 1 |
+
| 1 | |
| 2 |
+ … +
| 1 | |
| n |
\right)\\ &{}<
| \pi2 | |
| 6 |
n2 \end{align}
since
| \pi2 | + | ||
|
| 1 | + … + | |
| 22 |
| 1 | |
| n2 |
+ …
Bound the desired probability using the Chebyshev inequality:
\operatorname{P}\left(|T-nHn|\geqcn\right)\le
| \pi2 | |
| 6c2 |
.
Let the random variable be the number of dice rolls performed before all faces have occurred.
The subpower is defined
a\{b\
\left\{{b\atopa}\right\}
Sequences of
k
k → n
nk
n\{k\
P(X\lek)=
| n\{k\ | |
| P(X=k)= | n\{k\ |
Replacing
z
1+z
E\left[{X\choosek}\right]
| { | 1x-1\choose |
| n} |
-1
| n{n\choose | ||
| =\sum | k} | |
| k=0 |
| (-1)n-k | |
| 1-kx |
| \begin{aligned}&{ | n{x+1}\choose |
| n} |
-1
| n{n\choose | ||
| \\ =&\sum | i} | |
| i=0 |
| (-1)n-i | |||
|
| n{n\choose | |
| )}\\ =&\sum | |
| i=0 |
i}(-1)n-i\left(
| 1+n | |
| 1+n-i |
| ||||
| +in\sum | ||||
| k=1 |
xk\right)\end{aligned}
k>0
E\left[{X\choose
| n{n\choose | |
| k}\right]=n\sum | |
| i=0 |
i}(-1)n-ii
| (i-1)k-1 | |
| (n+1-i)k+1 |
| \left( | x{1-x}\right) |
| i=\sum |
| infty{k-1\choose | |
| n=0 |
i-1}xk
| ||||
| [x |
k{k-1\choosei-1}(-1)k-i[xi]f(x)
| { | n{x+1}\choose |
| n} |
-1=f\left(
| x{1+x}\right) | |
f(x)={n-nx\choosen}-1
Rewriting the binomial coefficient via the gamma function and expanding as the
\exp
| \left[ | xi |
| i! |
\right]{n-x\choosen}-1=\sumP\inperms(i)\prodc\in
| (|c|) | |
| H | |
| n |
E\left[{X\choose
| k{k-1\choose | |
| k}\right]=\sum | |
| i=0 |
i-1}(-1)k-i
| ni | |
| i! |
\sumP\inperms(i)\prodc\in
| (|c|) | |
| H | |
| n |
E[x\underline
| kL(k,i)(-1) | |
| k]=\sum | |
| i=0 |
k-i
| i\sum | |
| n | |
| P\inperms(i) |
\prodc\in
| (|c|) | |
| H | |
| n |
\left\{{K\atop
| K\left\{{K\atop | |
| i}\right\}(-1) | |
| k=0 |
k}\right\}L(k,i)(-1)k
| k\left\{{k\atop | |
| E[x | |
| i=0 |
i}\right\}(-1)k-i
| i\sum | |
| n | |
| P\inperms(i) |
\prodc\in
| (|c|) | |
| H | |
| n |
A stronger tail estimate for the upper tail can be obtained as follows. Let
| r | |
| {Z} | |
| i |
i
r
\begin{align} P\left[
| r | |
| {Z} | |
| i |
\right]=\left(1-
| 1 | |
| n |
\right)r\lee-r. \end{align}
Thus, for
r=\betanlogn
P\left[
| r | |
| {Z} | |
| i |
\right]\lee(-\beta=n-\beta
n
\begin{align} P\left[T>\betanlogn\right]=P\left[cupi
| \betanlogn | |
| {Z} | |
| i |
\right]\len ⋅ P[
| \betanlogn | |
| {Z} | |
| 1 |
]\len-\beta. \end{align}
\operatorname{P}(T<nlogn+cn)\to
| -e-c | |
| e |
,asn\toinfty.
\operatorname{E}(Tm)=nlogn+(m-1)nloglogn+O(n),asn\toinfty.
Here is fixed. When we get the earlier formula for the expectation.
\operatorname{P}\left(Tm<nlogn+(m-1)nloglogn+cn\right)\to
| -e-c/(m-1)! | |
| e |
,asn\toinfty.
| infty | |
| \operatorname{E}(T)=\int | |
| 0 |
\left(1-
| m | |
| \prod | |
| i=1 |
| -pit | |
| \left(1-e |
\right)\right)dt.
This is equal to
| m-1 | |
| \operatorname{E}(T)=\sum | |
| q=0 |
(-1)m-1-q\sum|J|=q
| 1 | |
| 1-PJ |
,
where denotes the number of coupons to be collected and denotes the probability of getting any coupon in the set of coupons .
nlogn+\gamman+1/2
50log50+50\gamma+1/2 ≈ 195.6011+28.8608+0.5 ≈ 224.9619