medium | probability |
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?
The pattern repeats after the first throw
4
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 . In case of more than once, the expected value is + expected value of a new game. We need to find the expected value combining these two.
Let be number of bananas eaten overall and = number shown on the first dice.
now,
Solving this equation gives
Mathematically, this is called the law of total probability, i.e, .
The denominator 5
is not intuitive when solving . For this reason, I have written the second method.
Method 2
Here, we will solve with basic algebra, without any special techniques.
Let be the total number of banans eaten.
We know that
For the first terms, the sum is simply
th term onwards, we can see a pattern:
Note that occurs when the die is thrown again, i.e, for .
Let's substitute these values in the above equation.
Now, let's move the extra terms aside, to make it look more like
The left part is equal to , while the right part is probability of everything
This simplifies to
Method 3
Another method is to expand all the terms using linearity of expectation and then use GP sum formula.
Let denote the number of bananas eaten on the th throw.
Thus, (using linearity of expectation)
This is a Geometric Progression, with , the sum of infinite terms will be
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.