Você está na página 1de 2

Actually, the average number of guesses required is not 15, but it is pretty close.

Depending on what assumptions we make, we get different answers for the average
number of guesses

Instead of using the numbers 1 to 30, I will use the numbers 1 to 4 to make it
easier to understand.

***Scenario 1***
We ask a friend to randomly select a number from 1 to 4.
They roll a 4 sided die to pick the number, so each number is equally likely to be
be picked by our friend.
i.e. The probability that 1 is picked is 1/4, the probability that 2 is picked is
1/4,
the probability that 3 is picked is 1/4, and the probability that 4 is picked is
1/4

We guess each number from 1 to 4, in order, until we find the number our friend
picked.

If our friend picks 1:


-then we guess 1, and find their number
It takes us 1 guess.

If our friend picks 2:


-then we guess 1,
-then we guess 2, and find their number
It takes us 2 guesses.

If our friend picks 3:


-then we guess 1,
-then we guess 2,
-then we guess 3, and find their number
It takes us 3 guesses.

If our friend picks 4:


-then we guess 1,
-then we guess 2,
-then we guess 3,
The number wasn't 1,2,or 3, and there is only one number left so the number must be
4.
We don't need any more guesses, we know the number is 4.
It takes us 3 guesses.

The average number of guesses required is:


-the sum of: the probability of each number * the number of guesses required for
each number

Which is: 1/4 * 1 + 1/4 * 2 + 1/4 * 3 + 1/4 * 3 = 9/4 = 2.25 guesses

If instead of the numbers 1 to 4 our friend randomly picks the numbers from 1 to n:
-each choice will have a probability of 1/n of being selected
- If our friend picks 1 it takes 1 guess
- If our friend picks 2 it takes 2 guess
- If our friend picks 3 it takes 3 guess
...
- If our friend picks n-2 it takes n-2 guess
- If our friend picks n-1 it takes n-1 guess
- However, if our friend picks n it takes only n-1 guesses since after n-1 guesses
we know the number is n

The average number of guesses required is:


Average_Guesses = [ 1/n * 1 + 1/n * 2 + 1/n * 3 + ... + 1/n * (n-2) + 1/n * (n-1) ]
+ 1/n * (n-1)
We can sum up the terms in the square brackets using the arithmetic series formula
(1/n * 1 + 1/n * (n-1) )/2 * (n-1) = (n * (n-1))/2n
Average_Guesses = (n * (n-1))/2n + 1/n * (n-1)
We can put both terms over a common denominator
Average_Guesses = (n * (n-1) + 2 * (n-1)) / 2n
Average_Guesses = ((n+2) * (n-1))/ 2n

e.g. if n = 4 then
Average_Guesses = ((n+2) * (n-1))/ 2n
Average_Guesses = ((4+2) * (4-1))/(2 * 4)
Average_Guesses = 18/8 = 2.25

e.g. if n = 30 then
Average_Guesses = ((n+2) * (n-1))/ 2n
Average_Guesses = ((30+2) * (30-1))/(2 * 30)
Average_Guesses = 928/60 ~ 15.467

***Scenario 2***
The same as Scenario 1, but now our friend tries to trick us once in a while by not
picking a number

When they don't pick a number we will guess: 1 then 2 then 3,...., then n-1, then n
This will take n guesses

The Average number of guesses when they don't pick a number is n.

When they do pick a number we will guess: 1 then 2 then 3,.... until we find the
number
Unlike Scenario 1, after we guess n-1, if we haven't found the number, we can't
assume that it must be n, because our friend might be trying to trick us by not
picking a number i.e. if they pick n, then it will require n guesses.

The Average number of guesses when they do pick a number is:


Average_Guesses = 1/n * 1 + 1/n * 2 + 1/n * 3 + ... + 1/n * (n-1) + 1/n * n
We can sum up the terms using the arithmetic series formula
Average_Guesses = (1/n * 1 + 1/n * n)/2 * n
Average_Guesses = (n+1)/2

e.g. if n = 4 then
Average_Guesses = (n+1)/2 = 5/2 = 2.5

e.g. if n = 30 then
Average_Guesses = (n+1)/2 = 31/2 = 15.5

In either scenario, if n is large enough, then n/2 is a good approximation for the
average number of guesses

Hope this makes sense

Você também pode gostar