赠券收集问题(Coupon collector's problem) 是概率论中的著名题目,其目的在解答以下问题:
- 假设有n种赠券,每种赠券获取概率相同,而且赠券亦无限供应。若取赠券t张,能集齐n种赠券的概率多少?
计算得出,平均需要
次才能集齐n种赠券——这就是赠券收集问题的时间复杂度。例如n = 50时大约要取
次才能集齐50种赠券。
赠券收集问题的特征是开始收集时,可以在短时间内收集多种不同的赠券,但最后数种则要花很长时间才能集齐。例如有50种赠券,在集齐49种以后要约多50次收集才能找到最后一张,所以赠券收集问题的答案t的期望要比50要大得多。
假设T是收集所有n种赠券的次数,
是在收集了第i-1种赠券以后,到收集到第i种赠券所花的次数,那么T和
都是随机变量。在收集到i-1种赠券后能再找到“新”一种赠券的概率是
,所以
是一种几何分布,并有期望
。根据期望的线性性质,

其中
是调和数,根据其近似值,可化约为:

其中
是欧拉-马歇罗尼常数.
那么,可用马尔可夫不等式求取概率的上限:

基于
相互独立的特性,则有:

最末一行的等式来自黎曼ζ函数的巴塞尔问题。此式继而可用切比雪夫不等式求取概率上限:

我们亦可用以下方法求另一个的上限:假设
表示在首r次收集中未有见到第i种赠券,则
![{\displaystyle {\begin{aligned}P\left[{Z}_{i}^{r}\right]=\left(1-{\frac {1}{n}}\right)^{r}\leq e^{-r/n}\end{aligned}}}](https://wikimedia.org/api/rest_v1/media/math/render/svg/67a53982df76dc7d07840b856926f1e1c66f71d8)
所以,若
,则有
.
![{\displaystyle {\begin{aligned}P\left[T>\beta n\log n\right]\leq P\left[\bigcup _{i}{Z}_{i}^{\beta n\log n}\right]\leq n\cdot P[{Z}_{1}]\leq n^{-\beta +1}\end{aligned}}}](https://wikimedia.org/api/rest_v1/media/math/render/svg/fb8eeb1aa9b184794402e9a32f0b74d40135734a)
另一种解决赠券收集问题的方法是用生成函数。
观察得出,赠券收集的过程必然如下:
- 收集第一张赠券,其出现的概率是

- 收集了若干张第一种赠券
- 收集到一张第二种赠券,其出现的概率是

- 收集了若干张第一种或第二种赠券
- 收集到一张第三种赠券,其出现的概率是

- 收集了若干张第一种、第二种或第三种赠券
- 收集到一张第四种赠券,其出现的概率是


- 收集到一张最后一种赠券,其出现的概率是

若某一刻已若干种赠券,再收集到一张已重复的赠券的概率是p,那么,再收集到m张已重复的赠券的概率就是
。则就此部分而言,有关m的概率母函数(PGF)是

若将上述收集过程分割为多个阶段,则整个收集过程所花的时间的概率母函数为各部分的乘积,亦即

那么,根据概率生成函数的特性,总收集次数T的期望是

而某一T的概率则是

计算E(T)可先化简
为

因为

所以

故此可得出

其中的连加部分可化简:

所以得出:
用概率生成函数可同时求取变异量。变异量可写作

其中
![{\displaystyle {\begin{aligned}\operatorname {E} (T(T-1))=&\left.{\frac {\mathrm {d} ^{2}}{\mathrm {d} z^{2}}}G(z)\right|_{z=1}\\=&\left[G(z)\left({\frac {n}{z}}+{\frac {1}{n-z}}+{\frac {2}{n-2z}}+{\frac {3}{n-3z}}\cdots +{\frac {n-1}{n-(n-1)z}}\right)^{2}\right.\\&\;\left.\left.+G(z)\left(-{\frac {n}{z^{2}}}+{\frac {1^{2}}{(n-z)^{2}}}+{\frac {2^{2}}{(n-2z)^{2}}}+{\frac {3^{2}}{(n-3z)^{2}}}\cdots +{\frac {(n-1)^{2}}{(n-(n-1)z)^{2}}}\right)\right]\right|_{z=1}\\=&n^{2}H_{n}^{2}-n+\sum _{k=1}^{n-1}{\frac {k^{2}}{(n-k)^{2}}}\\=&n^{2}H_{n}^{2}-n+\sum _{k=1}^{n-1}{\frac {(n-k)^{2}}{k^{2}}}\\=&n^{2}H_{n}^{2}-n+n^{2}H_{n-1}^{(2)}-2nH_{n-1}+(n-1).\end{aligned}}}](https://wikimedia.org/api/rest_v1/media/math/render/svg/a5676a52167ca8fdc95c974d97eef3f8aaea8c2d)
故得出:

- Paul Erdős and Alfréd Rényi, On a classical problem of probability theory, Magyar Tud. Akad. Mat. Kutato Int. Kozl, 1961.
- William Feller, An introduction to Probability Theory and its Applications, 1957.
- Michael Mitzenmacher and Eli Upfal, Probability and Computing: Randomized Algorithms and Probabilistic Analysis, Cambridge University Press, 2005
- Donald J. Newman and Lawrence Shepp, The Double Dixie Cup Problem, American Mathematical Monthly, Vol. 67, No. 1 (Jan., 1960), pp. 58–61.
- Philippe Flajolet, Danièle Gardy, Loÿs Thimonier Birthday paradox, coupon collectors, caching algorithms and self-organizing search. (页面存档备份,存于互联网档案馆), Discrete Applied Mathematics, Vol. 39, (1992), pp. 207–229