# How a visit to the pub with friends ends up in a sleepless night

Dropped by a pub with some (good) friends for a short while of drinks and games, where this game was introduced for the first time to me.  It’s called the “Guessing Game”, where basically each participant has a cup of five dice each, and after shaking it, looks at his/her own dice combination, comes up with guesses on how many dice there are at least of a certain number (1-6).  Forfeits are dealt accordingly to those who were found to have guessed wrongly, or have wrongly tried to catch someone else’s guess.

The first thing my mind came to was how to win this game?  And being a maths geek it certainly didn’t help when the game involved dice. 😀 Nonetheless I hope I still get invited to go out (drinking or otherwise) with them. :S

(If you do not wish to see how a good social game is ruined/analyzed to death by a geek, you should stop reading here.  And I am not responsible for your shunning if you use this eventually for your “unfair” advantage 🙂 )

The scenario then was set like this: 7 people, holding a cup of 5 dice each, with 6 possibilities per die (duh).

So…let’s start from the simpler case first: If I wanted at least 7 of one number, what’s the probability?

One way I could think of is to split up the number of dice needed per person: meaning 1 die needed per person at least.  So the problem then becomes: If I wanted at least 1 of a particular number in a set of 5 dice, what’s the probability?

Assuming all dice do not affect one another, and are perfectly fair (no such thing for either thing in the real world…), we could take the roll to be the same as rolling each of the 5 dice one by one.  Which means 1/6 + 1/6 + 1/6 + 1/6 + 1/6 = 5/6 probability (83.33%), which is darned high for risk adverse people heh.  Alternatively, based on this you would (statistically) only get one wrong out of six guesses, pretty safe for someone avoiding forfeits 😛

Problem is that this works easily for guessing only one die per set.  (And I’m not too sure whether the reasoning/working for the above is correct or not!)  What if we need to know the probability for at least 2 out of 5 dice to be at a number?  Or at least 10 out of 35 dice?  How do we do such repeated-combinations probability calculations?  And more importantly, how to do it in a way that’s possible to calculate mentally?

For those who’re wondering about the sleepless night part of the title, it’s 3.20am now.

[edited 26 July to add my workings/solution] As said, this exercise is for interest only, so please don’t use it in real life with friends!  That is if you’re able to mentally calculate all these anyway… 😛

[edit 4 Aug] changed greatly after LSC’s corrections in the comments below

## Question/Solution/Formula/Analysis wrap-up

Here’s to wrap up the question:

Assuming all dice rolls are independently fair, given n rolls of dice, what’s the probability of guessing at least r dice’ number correctly?

The solution as follows:

The probability of an event A occuring is defined as “the number of ways event A can occur” divided by “the total number of possible outcomes”.

This means that for n dice rolls, the total number of possible outcomes is always 6^n.

To work out the formula,we define P(a, n) to be the probability of exactly a out of n dice rolls to have the same outcome (i.e. your guess).  Therefore P(0, n) + P(1, n) + P(2, n) + … + P(n, n) = 1 as dictated by the rules of probability.

As an example, starting off with n=3:  The possible ways where a=1 can occur are as follows (note that { g } denotes the die position where the guess was correct, and {1-5} denotes the possible outcomes for dice in those positions):

For n=3, a=1:
```{ g } {1-5} {1-5} {1-5} { g } {1-5} {1-5} {1-5} { g }```

For n=3, a=2:
```{ g } { g } {1-5} { g } {1-5} { g } {1-5} { g } { g }```

The pattern we see here is that  there will always be nCa ways of representing the positions where the guess was right.  Also, since we’re interested in the number of ways where the die rolls can turn out, for every row above  it represents 5^(n-a) possible outcomes.

So, for n=3, a=1: the number of ways for exactly a dice to be guessed right is 3C1 * 5^(3-1)

And for n=1, a=2: the number of ways for exactly a dice to be guessed right is 3C2 * 5^(3-2)

Thus the formula:

Number of ways for exactly a dice to be guessed right out of n die rolls is nCa * 5^(n-a)

And since we’re interested in the probability:

P(a, n) = nCa * 5^(n-a) / 6^n

For the original problem statement, we want to find out the probabilities where we can “guess” at least r out of n dice rolls correctly.  So in order to do so, we only need to sum them accordingly (basically is the reverse of a CDF that we usually do):

P(at least r out of n dice guessed correctly)
= P(r, n) + P(r+1, n) + P(r+2, n) + … + P(n, n)

Which is absolutely horrid for mental calculations! D:

Let’s analyze this a bit: putting this formula into n=5 for each person’s set only:

Looking at the orange line, this shows that to get at least 1 out of 5 would be still pretty safe (0.6 probability), but to get at least 2 out of 5 would be pretty dangerous already (0.2 probability),  and the chances go down south with 3 and onwards…

Now for n=35, simulating everybody’s dice rolls…

The chances of getting at least 6 out of 35 guessed right is about 0.53, and degrades pretty quickly with at least 7 to be about 0.37, and 8 at slightly above 0.2 (1 in 5!).

So the only “real” guesses for that game would be 5-6 (pretty ok), 7 (if you want some extra drinks by losing), and 8 (if you’re feeling really adventurous due to the alcohol). 😛

## 6 thoughts on “How a visit to the pub with friends ends up in a sleepless night”

1. ray says:

Lol, lucky (for me) I couldn’t remember the formulae involved on the spot, else the game might have been destroyed real quick.

1. LSC says:

Er, probability of greater than 1 kind of runs counter to statistics leh.

How about the following:

c=Total permutation = 6^35

a1=Permutations with only 0 dice with r = 35C0*5^(35-0) = 5^35
a1=Permutations with only 1 dice with r = 35C1*5^(35-1) = 5^34
a2=Permutations with only 2 dice with r = 35C2*5^(35-2) = 5^33
a3=Permutations with only 3 dice with r = 35C3*5^(35-3) = 5^32
a4=Permutations with only 4 dice with r = 35C4*5^(35-4) = 5^31
a5=Permutations with only 5 dice with r = 35C5*5^(35-5) = 5^30
a6=Permutations with only 6 dice with r = 35C6*5^(35-6) = 5^29

b=Probability of only 6 or less dice with r = (a0=a1+a2+a3+a4+a5+a6)/c

Probability of at least 7 dice with r = 1-b = 218/599 = 0.36393992184419

If 35 dice is complicated, try just 2 dice.
Total permutations = 6^2 = 36
Permutations for zero dice with r = 2C0 * 5^2 (ie choosing zero from two dice, and the remaining two dice will be of any of the 5 numbers beside r) = 1*25 = 25
Permuations for one dice with r = 2C1 * 5^1 (ie choosing one from two dice, and the other dice will be of any of the 5 numbers beside r) = 2*5 = 10
Permuations for two dice with r = 2C2 * 5^0 (ie choosing two from two dice, and the remaining zero dice will be of any of the 5 numbers beside r) = 1*1 = 1
If you add up the permutations for zero, one and two dice with r, the total permutations will be 36, the same as 6^2.
This means the probability for each of the permutations will add up to 1:
probability of zero dice with r = 25/36
probability of only one dice with r = 10/36
probability of two dice with r = 1/36
25/36 + 10/36 + 1/36 = 36/36 = 1

By extension, probability of at least one dice with r = probability of one dice with r + probability of two dice with r
which is also = 1 – (probability of zero dice with r)

1. ray says:

Wow thanks, I see my mistake now. Should have used 5^(n-r) instead of 6^(n-r) for the permutations of the remaining dice, then added/subtracted each probability accordingly rather than just calculating all in one shot!

Will be correcting my post accordingly at a later time..

On a side note, I’m quite surprised you actually bothered to take the time to write all that! 🙂

2. lsc says:

Beer is the driving force for great statistics… question best attempted when intoxicated 😉

1. ray says:

Updated!

Yeah. The more beer, the better the mathematics 😛