📜  直至成功的预期试验次数

📅  最后修改于: 2021-04-24 04:05:07             🧑  作者: Mango

考虑以下著名的难题。

在一个国家,所有家庭都想要一个男孩。他们一直生孩子,直到男孩出生。该国男孩和女孩的预期比例是多少?

如果我们知道在概率和期望中得出以下有趣的结果,则可以轻松解决此难题。

如果每个试验中成功的概率为p,则直到成功的预期试验次数为1 / p

证明:令R为一个随机变量,表示成功之前的试验次数。

The expected value of R is sum of following infinite series
E[R] = 1*p + 2*(1-p)*p + 3*(1-p)2*p + 4*(1-p)3*p + ........ 

Taking 'p' out
E[R] = p[1 + 2*(1-p) + 3*(1-p)2 + 4*(1-p)3 + .......] ---->(1)

Multiplying both sides with '(1-p)' and subtracting 
(1-p)*E[R] = p[1*(1-p) + 2*(1-p)2 + 3*(1-p)3 + .......] --->(2)

Subtracting (2) from (1), we get

p*E[R] = p[1 + (1-p) + (1-p)2 + (1-p)3 + ........] 

Canceling p from both sides
E[R] = [1 + (1-p) + (1-p)2 + (1-p)3 + ........] 

Above is an  infinite geometric  progression with ratio (1-p). 
Since (1-p) is less than, we can apply sum formula.
  E[R] = 1/[1 - (1-p)]
       = 1/p

男孩女孩比例难题的解决方案:
让我们使用以上结果来解决这个难题。在给定的难题中,每次试验成功的概率为1/2(假设女孩和男孩的可能性均等)。

Let p be probability of having a baby boy.
Number of kids until a baby boy is born = 1/p 
                                        = 1/(1/2)
                                        = 2 
Since expected number of kids in a family is 2,
ratio of boys and girls is 50:50. 

让我们讨论使用以上结果的另一个问题。

优惠券收集器问题:
假设彩票中有n种类型的优惠券,并且每个批次包含一张优惠券(概率为1 = n)。直到我们每种类型的至少有一张优惠券,才需要购买(预期)多少手。

这个问题的解决方案也基于上述结果。

令X i为收集新优惠券之前购买的手数。

请注意,X 1为1,因为第一个优惠券始终是新的优惠券(之前未收集)。

假设“ p”是下次购买时收集到第二张优惠券的概率。 p的值为(n-1)/ n。因此,在选择第二张新优惠券之前需要进行的试验次数为1 / p,这意味着n /(n-1)。 [这是我们使用以上结果的地方]

同样,收集第3张新优惠券之前需要进行的试验次数为n /(n-2)

Using Linearity of expectation, 
we can say that the total number of expected trials = 
                  1 + n/(n-1) + n/(n-2) + n/(n-3) + .... + n/2 + n/1
               = n[1/n + 1/(n-1) + 1/(n-2) + 1/(n-3) + ....+ 1/2 + 1/1]
               = n * Hn
Here Hn is n-th Harmonic number

Since Logn <= Hn <= Logn + 1, we need to buy around 
nLogn lots to collect all n coupons. 

锻炼:
1)投掷6个面临的公平骰子,直到掷骰子结果为“ 5”为止。预期的投掷次数是多少?

2)如果男婴的概率是1/3,则上述拼图中男孩和女孩的比例是多少?

参考:
http://www.cse.iitd.ac.in/~mohanty/col106/Resources/linearity_expectation.pdf

http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-042j-mathematics-for-computer-science-fall-2010/video-lectures/lecture-22-expectation-i/