返回题库

无辜的猴子

Innocent Monkey

专题
Probability / 概率
难度
L4

题目详情

一只猴子掷公平六面骰。

  • 若掷到 1~5,则吃对应数量的香蕉并停止。
  • 若掷到 6,则先吃 5 根香蕉,然后继续掷骰(可能无限次)。

问:猴子最终吃到香蕉的期望数量是多少?

提示:掷到 6 后相当于“重新开始同一个游戏”。

A very innocent monkey throws a fair die. The monkey will eat as many bananas as are shown on the die, from 1 to 5. But if the die shows '6', the monkey will eat 5 bananas and throw the die again. This may continue indefinitely. What is the expected number of bananas the monkey will eat?

Hint

The pattern repeats after the first throw

解析

设期望为 EE。第一次掷到 1~5 的期望香蕉数为 1+2+3+4+56=156=2.5\frac{1+2+3+4+5}{6}=\frac{15}{6}=2.5,掷到 6 的概率为 1/61/6,此时香蕉数为 5+E5+E

因此

E=156+16(5+E)E=4.E=\frac{15}{6}+\frac{1}{6}(5+E) \Rightarrow E=4.

Original Explanation

4

Solution

Method 1

The intuition is that either the die is thrown only once, or more than once. In case of only once, the expected value is 33. In case of more than once, the expected value is 55 + expected value of a new game. We need to find the expected value combining these two.

Let XX be number of bananas eaten overall and YY = number shown on the first dice.

E1=E[Xonly once]=E[XY<6]=15(1+2+3+4+5)=3E_1 = E[X | \text{only once}] = E[X | Y < 6] = \dfrac{1}{5}(1+2+3+4+5) = 3

E2=E[Xmore than once]=E[XY=6]=5+E[X]E_2 = E[ X | \text{more than once}] = E[X | Y=6] = 5 + E[X]

now, E[X]=56E1+16E2E[X] = \dfrac{5}{6}\cdot E_1 + \dfrac{1}{6} \cdot E_2

    E[X]=563+16(5+E[X])\implies E[X] = \dfrac{5}{6} \cdot 3 + \dfrac{1}{6} \cdot (5 + E[X])

Solving this equation gives E[X]=4E[X] = 4

Mathematically, this is called the law of total probability, i.e, E[E[XY]]=E[X]E[ E[X|Y] ] = E[X].

The denominator 5 is not intuitive when solving E1E_1. For this reason, I have written the second method.


Method 2

Here, we will solve with basic algebra, without any special techniques.

Let XX be the total number of banans eaten.

We know that E[X]=P(X=1)1+P(X=2)2+E[X]= P(X=1)\cdot 1 + P(X=2) \cdot 2 + \ldots

For the first 55 terms, the sum is simply 1/6(1+2+3+4+5)=15/61/6 \cdot (1+2+3+4+5) = 15/6

66th term onwards, we can see a pattern:

P(X=6)6+P(X=7)7+P(X=6) \cdot 6 + P(X=7) \cdot 7 + \ldots

Note that X6X\ge 6 occurs when the die is thrown again, i.e, P(X=i)=1/6P(X=i5)P(X=i) = 1/6 \cdot P(X=i - 5) for i6i\ge 6.

Let's substitute these values in the above equation.

16[P(X=1)6+P(X=2)7+] \dfrac{1}{6} [ P(X=1) \cdot 6 + P(X=2) \cdot 7 + \ldots ]

Now, let's move the extra terms aside, to make it look more like E[X]E[X]

16[P(X=1)1+P(X=2)2+]+16[P(X=1)5+P(X=2)5+] \dfrac{1}{6} [ P(X=1) \cdot 1 + P(X=2) \cdot 2 + \ldots ] + \dfrac{1}{6} [P(X=1) \cdot 5 + P(X=2) \cdot 5 + \ldots]

The left part is equal to 16E[X]\dfrac{1}{6} E[X], while the right part is 1/65[1/6 \cdot 5 [ probability of everything ]=5/6] = 5/6

    E[X]=156+16E[X]+56\implies E[X] = \dfrac{15}{6} + \dfrac{1}{6}E[X] + \dfrac{5}{6}

This simplifies to E[X]=4E[X] = 4


Method 3

Another method is to expand all the terms using linearity of expectation and then use GP sum formula.

Let XiX_i denote the number of bananas eaten on the iith throw.

Thus, E[X]=E[i=1Xi]=i=1E[Xi]E[X] = E[\sum_{i=1}^{\infty} X_i] = \sum_{i=1}^{\infty} E[X_i] (using linearity of expectation)

E[X1]=161+...+165+165=206E[X_1] = \frac{1}{6} \cdot 1 + ... + \frac{1}{6} \cdot 5 + \frac{1}{6} \cdot 5 = \frac{20}{6}

E[X2]=P( first die roll was 6)( terms that matchE[X1])E[X_2] = P(\text{ first die roll was 6} ) \cdot (\text{ terms that match} E[X_1])

    E[X2]=16206\implies E[X_2] = \dfrac{1}{6} \cdot \dfrac{20}{6}

    E[X3]=162206\implies E[X_3] = \dfrac{1}{6^2} \cdot \dfrac{20}{6}

This is a Geometric Progression, with a=20/6,r=1/6a = 20/6, r=1/6, the sum of infinite terms will be a(1r)=20/611/6=4\dfrac{a}{(1-r)} = \dfrac{20/6}{1-1/6} = 4

Note: This will not work for a problem that involves a state. For instance, if the monkey could cheat upto 3 times (i.e, re-throw the dice even when it is not a "6"), and the cheating-count was reset to zero when a real "6" appears, then this method will not work.