Coupon collector's problem

From testwiki
Jump to navigation Jump to search

Template:Short description Template:Probability distribution

Graph of number of coupons, Template:Mvar vs the expected number of trials (i.e., time) needed to collect them all Template:Math

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 Template:Mvar different types of coupons, what is the probability that more than Template:Mvar boxes need to be bought to collect all Template:Mvar coupons? An alternative statement is: given Template:Mvar 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 Θ(nlog⁡(n)).Template:Efn For example, when Template:Math it takes about 225[lower-alpha 1] trials on average to collect all 50 coupons. Sometimes the problem is instead expressed in terms of an Template:Mvar-sided die.

Solution

Calculating the expectation

Let time Template:Mvar be the number of draws needed to collect all Template:Mvar coupons, and let Template:Math be the time to collect the Template:Mvar-th coupon after Template:Math coupons have been collected. Then T=t1+⋯+tn. Think of Template:Mvar and Template:Math as random variables. Observe that the probability of collecting the Template:Mvar-th Template:Em coupon is pi=n−(i−1)n=n−i+1n. Therefore, ti has geometric distribution with expectation 1pi=nn−i+1. By the linearity of expectations we have:

E⁡(T)=E⁡(t1+t2+⋯+tn)=E⁡(t1)+E⁡(t2)+⋯+E⁡(tn)=1p1+1p2+⋯+1pn=nn+nn−1+⋯+n1=n⋅(11+12+⋯+1n)=n⋅Hn.

Here Template:Math is the Template:Mvar-th harmonic number. Using the asymptotics of the harmonic numbers, we obtain:

E⁡(T)=n⋅Hn=nlog⁡n+γn+12+O(1/n),

where γ≈0.5772156649 is the Euler–Mascheroni constant.

Using the Markov inequality to bound the desired probability:

P⁡(T≥cnHn)≤1c.

The above can be modified slightly to handle the case when we've already collected some of the coupons. Let Template:Mvar be the number of coupons already collected, then:

E⁡(Tk)=E⁡(tk+1+tk+2+⋯+tn)=n⋅(11+12+⋯+1n−k)=n⋅Hn−k

And when k=0 then we get the original result.

Calculating the variance

Using the independence of random variables Template:Math, we obtain:

Var⁡(T)=Var⁡(t1+⋯+tn)=Var⁡(t1)+Var⁡(t2)+⋯+Var⁡(tn)=1−p1p12+1−p2p22+⋯+1−pnpn2=(n2n2+n2(n−1)2+⋯+n212)−(nn+nn−1+⋯+n1)=n2⋅(112+122+⋯+1n2)−n⋅(11+12+⋯+1n)<π26n2

since π26=112+122+⋯+1n2+⋯ (see Basel problem).

Bound the desired probability using the Chebyshev inequality:

P⁡(|T−nHn|≥cn)≤π26c2.

Stirling numbers

Let the random variable Template:Mvar be the number of dice rolls performed before all faces have occurred.

The subpower is defined a{b}=a!{ba}, where {ba} is a Stirling number of the second kind.[1]

Sequences of k die rolls are functions k→n counted by nk, while surjections (that land on each face at least once) are counted by n{k}, so the probability that all faces were landed on within the Template:Mvar-th throw is P(X≤k)=n{k}nk. By the recurrence relation of the Stirling numbers, the probability that exactly Template:Mvar rolls are needed is P(X=k)=n{k}nk−n{k−1}nk−1=(n−1){k−1}nk−1

Generating functions

Replacing z with 1+z in the probability generating function produces the o.g.f. for E[(Xk)]. Using the partial fraction decomposition (1x−1n)−1=∑k=0n(nk)(−1)n−k1−kx, we can take the expansion

(nx+1n)−1=∑i=0n(ni)(−1)n−i1−i(1−nx+1+n)=∑i=0n(ni)(−1)n−i(1+n1+n−i+in∑k=1∞(i−1)k−1(n+1−i)k+1xk)

revealing that for k>0,

E[(Xk)]=n∑i=0n(ni)(−1)n−ii(i−1)k−1(n+1−i)k+1

Given an o.g.f. Template:Mvar, since (x1−x)i=∑n=0∞(k−1i−1)xk, a variation of the binomial transform is [xk]f(x1+x)=∑i=0k(k−1i−1)(−1)k−i[xi]f(x). (Specifically, if (nx+1n)−1=f(x1+x), f(x)=(n−nxn)−1.)

Rewriting the binomial coefficient via the gamma function and expanding as the exp of the polygamma series (in terms of generalised harmonic numbers), we find [xii!](n−xn)−1=∑P∈perms(i)∏c∈PHn(|c|), so

E[(Xk)]=∑i=0k(k−1i−1)(−1)k−inii!∑P∈perms(i)∏c∈PHn(|c|)

which can also be written with the falling factorial and Lah numbers as

E[xk_]=∑i=0kL(k,i)(−1)k−ini∑P∈perms(i)∏c∈PHn(|c|)

The raw moments of the distribution can be obtained from the falling moments via a Stirling transform; due to the identity {Ki}(−1)K=∑k=0K{Kk}L(k,i)(−1)k, this provides

E[xk]=∑i=0k{ki}(−1)k−ini∑P∈perms(i)∏c∈PHn(|c|)

Tail estimates

A stronger tail estimate for the upper tail can be obtained as follows. Let Zir denote the event that the i-th coupon was not picked in the first r trials. Then

P[Zir]=(1−1n)r≤e−r/n.

Thus, for r=βnlog⁡n, we have P[Zir]≤e(−βnlog⁡n)/n=n−β. Via a union bound over the n coupons, we obtain

P[T>βnlog⁡n]=P[⋃iZiβnlog⁡n]≤n⋅P[Z1βnlog⁡n]≤n−β+1.

Extensions and generalizations

P⁡(T<nlog⁡n+cn)→e−e−c, as n→∞. which is a Gumbel distribution. A simple proof by martingales is in .[3]

.

E⁡(Tm)=nlog⁡n+(m−1)nlog⁡log⁡n+O(n), as n→∞.
Here Template:Mvar is fixed. When Template:Math we get the earlier formula for the expectation.
  • Common generalization, also due to Erdős and Rényi:
P⁡(Tm<nlog⁡n+(m−1)nlog⁡log⁡n+cn)→e−e−c/(m−1)!, as n→∞.
  • In the general case of a nonuniform probability distribution, according to Philippe Flajolet et al.[4]
E⁡(T)=∫0∞(1−∏i=1m(1−e−pit))dt.
This is equal to
E⁡(T)=∑q=0m−1(−1)m−1−q∑|J|=q11−PJ,
where Template:Mvar denotes the number of coupons to be collected and Template:Math denotes the probability of getting any coupon in the set of coupons Template:Mvar.

See also

  • Cover time – a generalization of the coupon collector's problem to Markov chains and random walks on graphs
  • McDonald's Monopoly – an example of the coupon collector's problem that further increases the challenge by making some coupons of the set rarer
  • Complete gacha – a game monetization practice now outlawed in Japan, that exploited the coupon collector's problem
  • Watterson estimator
  • Birthday problem

Notes

Template:Notelist

References

Citations

Template:Reflist

Bibliography

Template:Refbegin

Template:Refend

Template:Probability problems


Cite error: <ref> tags exist for a group named "lower-alpha", but no corresponding <references group="lower-alpha"/> tag was found.