Saturday 4 October 2008

Not More Yahtzee Maths

It has been a while since I lasted blogged. In the intervening time I have made a few more discoveries about Mathematics of Yahtzee. So for completeness I thought I'd put the electronic pen to internet paper and note down my conclusions. By advertising it in this way I can virtually guarantee that my discoveries will be kept as secret as the true identity of JFK's assassin, the formula for everlasting youth etc.

The route to my conclusion was far more tortuous that I will outline here. I used about 100 sheets of paper proving what could be written down in only a few lines. So I will now present the shortcut solution... But first the question..... Oh Guru Tim please can you provide me with a formula to give me the probability of getting a specific 5-of-a-kind, 4-of-a-kind, 3-of-a-kind and so on when playing Yahtzee.


Throwing One Dice Three Times
To answer the question we need to realize that you need three attempts (see www.yahtzee.org.uk for the rules). So lets start there, and only consider throwing one dice... regular dice p=1/6 (successful throw) q=5/6 (unsuccessful throw)
1st Attempt, success p, failure q
2nd Attempt, success qp, failure q2
3rd Attempt, success q2p, failure q3

So adding this up p + pq + pq2 + q3 ==> p(1+q+q2) + q3 which is == 1
And
Extending this further for n throws 1 = p(1+q+q2+ .. +q(n-1)) + qn

The first thing to note is that is not normally how one would write it. Normally one would expect a binomial expansion e.g.
(p+q)3 = p3+3pq2+3p2q+q3 == 1

However, the way in which we progress is different. The binomial expansion means that you would throw the dice 3 times no matter what you got, hence there is an option for throwing 3 correct dice in a row. So what the new expansion does for us is to allow us to stop throwing when the target is reached. The expansion is no less valid than the binomial, but it simply describes a different set of mechanics.

Throwing Five Dice Three times


OK Now we have a simple expression for throwing 1 dice three times, lets use five dice, and have 3 attempts. We are now armed with a new set of formula which is expressed like so

Probability of getting target number P = p(1+q+q2)
Probability of failing to get Target number Q = q3

Now remember that P+Q = 1 (and also p+q=1, p=1/6, q=5/6), Throwing the 5 dice with 3 attempts will yield a binomial expansion of (P+Q)5 = 1

So
Throwing 5-of-a-kind is P5 or p5(1+q+q2)5 or 1.33%
Throwing 4-of-a-kind is 5P4Q or 5p4(1+q+q2)4q3 or 9.12%
Throwing 3-of-a-kind is 10P3Q2 or 10p3(1+q+q2)3q6 or 25.04%
Throwing 2-of-a-kind is 10P2Q3 or 10p2(1+q+q2)2q9 or 34.40%
Throwing 1-of-a-Kind is 5PQ4 or 5p(1+q+q2)q12 or 23.63%
Throwing 0-of-a-kind is Q5 or q15 or 6.49%

The Long Way 'round

So taking a look at the above, one might say .. hey this is way too simple, I don't believe it. Well the as I said at the start I used up a small forest working the above through the long way round. If you wish to do it feel free. The long way round is to simply look at the binomial expansion for all the permutations (you can get a flavor from my previous posts), but remember that when you get the target number you stop. So look at the chances of getting 5 in one go (5M), then 5 in two goes, (4M:5M 3M:5M; 2M;5M; 1M:5M; 0M;5M), then in three goes (4M:4M;5M 3M:4M:5M 3M:3M:5M etc.... ) .. This will give you 5-of-a-kind, then repeat whole process for 4-of-a-Kind
etc... after a few forests and a couple of pencils you should end up with the above set of simple formulas.....

Time to go now, kids are suspiciously quiet...