Concepts 8: Combinatorial Analysis – Counting Possible Outcomes AND creating YOUR OWN Casino Game!

We have seen how knowing the expectation enables us to set the odds of games.  If you recall, the formula for calculating the expectation for any wager is :

(Probability of winning x the amount a wager would win) – (Probability of losing x the amount a wager would lose)

So, if you wanted to create your own casino game, you would have to go through the following process:

  1. Calculating Probabilities of outcomes
  2. Calculating the Expectation
  3. Setting the Odds

From the previous posts, you would have already figured out 2 and 3.

How do we then get the probabilities of games?  This is perhaps the most fundamental aspect of casino games.  To do this, we would need to learn about combinatorial analysis.

Combinatorial analysis is about counting possibilities.  This is essential when trying to determine the probabilities of events, such as a pair in Baccarat or a full house in poker.  Knowing how to calculate these probabilities then allows you to derive expectation and from there, you can set the odds.

The 2 basic categories of combinatorial analysis are permutations and combinations.

Dr. James Tanton developed a brilliant method to calculate permutations and combinations.  His use of labelling is highly effective, fast and easy to learn.

 http://gdaymath.com/courses/permutations-and-combinations/

However, if you are keen to learn the slower and conventional method, read on…

Permutations and combinations can be further sub-divided into 2 categories, permutations or combinations with or without repeatable elements.  Ready?

Permutations where you can repeat elements

The alphabet has 26 letters from A to Z.  If you were to make a permutation of 3 REPEATABLE letters, you’d be able to repeat them, like AAA or BBA or BAB or ABB or XDX or DXX or XXD.

In a permutation, ABB would count as 1 outcome, just as BAB would count as 1 and BBA would count as 1.  They contain the same letters, but in a different order.

So, the number of permutations you’d be able to make would be 26 x 26 x 26 = 17,576

A similar example would be 3 dice in 3 separate glasses.  Let’s call them D1, D2 and D3.  The dice are tumbled 3 times with the following results:

D1 D2 D3
1 2 2
2 1 2
2 2 1

Although the number 1 appears once and 2 appears twice in each permutation, they each count as 1 separate outcome by themselves.  The total number of outcomes is then 3.  So, for 3 dice, the total number of permutations would be = 6 x 6 x 6 = 216

Permutation where you can’t repeat

Now, if you were to make a permutation of 3 UNREPEATABLE letters, every time you used a letter, it could not be used again, like ABC, TRF or ZLD.  This means that your pool of letters gets reduced each time you use one.

But remember, just like permutations with repeatable letters, permutations like ABC or CAB or BAC would each count as 1 possible outcome in themselves.  They may contain the same letters, but their difference in order makes them each 1 distinct outcome.

The number of permutations you’d then be able to get for a 3 unrepeatable letter permutation is = 26 x 25 x 24 = 15,600

A similar example would be how many 52-card permutations you could make from a 52-card deck where each time a card is drawn, it is then discarded. The number of permutations for that would be = 52 x 51 x 50 x …x1

= 80,658,175,170,943,900,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000

If you wanted only a 5-card permutation, the formula would be

= 52 x 51 x 50 x 49 x 48

= 311,875,200

Permutations are generally used when we want to compute the total possible outcomes for all events.

Factorials

By now you would have noticed that there are certain formulas that multiply numbers in descending order, like 3 x 2 x 1 or 52 x 51 x 50 x 49…x1.  This is called a factorial number and is symbolised in this fashion 3! – being 3 x 2 x 1.  So, 6! would be 6 x 5 x 4 x 3 x 2 x 1.

Combinations where you can repeat elements

Combinations are sequences where we are only concerned with the appearance of certain elements.  Computing combinations is used mainly for determining the categories of possible outcomes.

Let’s return to the 26-letter alphabet example.  If we wanted a 3-letter combination from the alphabet, sequences like ABB, BBA or BAB would count as 1, just as XXY, XYX and YXX would also count as 1.  The number of times the letters appear is what is important – how they are arranged is not.

The number of 3 letter combinations from a 26 letter alphabet is

= (total number of letters + 3 letters -1)! / (3 letters! X  26-1 letters!)

= (26 + 3 – 1)! / (3! x 26-1!)

= 28! / (3! X 25!) = 3,276

A similar example would be the 3 dice in 3 glasses example.  If we just wanted to find the number of 3-dice combinations, the following sequences from 3 trials would count as 1 combination:

D1 D2 D3
1 2 2
2 1 2
2 2 1

The number of times the numbers appear, number 1 once and number 2 twice, is all that matters.

So, the number of 3-number combinations from a 3-dice roll would be =

= (total number of numbers on 1 die + 3 dice -1)! / (3 dice! X  6-1 numbers!)

=(6+3-1)! / (3! X 6-1!)

= 8! / (3! X 5!) = 56

Which, if you look at the table below, showing the possible combinations from a 3-dice roll, is accurate:

S/No Combination
1 111
2 112
3 113
4 114
5 115
6 116
7 122
8 123
9 124
10 125
11 126
12 133
13 134
14 135
15 136
16 144
17 145
18 146
19 155
20 156
21 166
22 222
23 223
24 224
25 225
26 226
27 233
28 234
29 235
30 236
31 244
32 245
33 246
34 255
35 256
36 266
37 333
38 334
39 335
40 336
41 344
42 345
43 346
44 355
45 356
46 366
47 444
48 445
49 446
50 455
51 456
52 466
53 555
54 556
55 566
56 666

Remember that computing the combinations where elements can be repeated ALSO counts in combinations where elements can’t be repeated.  They will all be counted.  This is essential to remember when you are designing your own games.

Knowing how to count the possible combinations of events is helpful in planning the layout of a table game.

Combinations where you can’t repeat elements

A good example for this is when you want to determine how many 3-dice combinations there are when you cannot repeat numbers.  In Sic-Bo, this is known as a 3-Single-Dice Combination.  This counts 123, 321 and 231 as 1 possible outcome only.

The formula for this is

= number of numbers on 1 die! / number of dice! x (number of numbers on 1 die- number of dice)!

= 6! / 3! X (6-3)!

=6! / 3! X 3!

= 20

Which again, if you examine the table below, is accurate:

S/No Combination
1 123
2 124
3 125
4 126
5 134
6 135
7 136
8 145
9 146
10 156
11 234
12 235
13 236
14 245
15 246
16 256
17 345
18 346
19 356
20 456

These are foundational principles in combinatorial analysis.

So, how do you count permutations and combinations in a practical way?

A great example is the calculation of how many 3-of-a-kinds are possible from a 52-card deck in a 5-card poker hand.

This will be deemed as a combination question as the order in which the cards appear is irrelevant – the casino pays if the hand contains a 3-of-a-kind, regardless of the order in which it appears in your hand.

Dr. Tanton’s model solves this question easily (his model is so versatile, it ignores the permutation-combination issue entirely!  If you haven’t watched it, please do) :

The issue is a matter of labelling the cards.  We have 52 cards and 5 are to be labelled as your hand and the other 47 as not, so:

52! / (5! X 47!) = 2,598,960 possible combinations from a 52-card deck where your hand contains 5 cards.

Now, we know that the 52-card deck is really 13 numbers from Ace to King, with 4 copies in the form of suits, Hearts, Clubs, Diamonds and Spades.

So, following the labelling technique, we have 13 numbers in total.  Any one of these could be the 3-of-a-kind, so we label 1 number as the 3-of-a-kind, 2 numbers as the remaining cards in the hand (remember, that these 2 numbers should not form a pair, or we’d get a Full House!) and the remaining 10 numbers as those not included in the hand.

Part 1 of the calculation looks like this:

= 13!/(1! X 2! X 10!) = 858 (this determines the combinations by numbers only)

We have to settle the suit portion.  So, we’ll decide the suits of the 3-of-a-kind as well as the other 2 cards. We have 4 suits, of which the 3-of-a-kind must have 3.  The other 2 cards will be of any suit as well.

Part 2 of the calculation looks like this:

= 4!/(3! X 1!) x 4!(1!/3!) x 4!(1!/3!) = 64

Finally, the total combinations containing a 3-of-a-kind is =

858 x 64 = 54,912.

To determine the probability, we divide the possible outcomes for a 3-of-a-kind by the total possible outcomes of 2,598,960

= 54,912/2,598,960 = 0.021128 or 2.1128%

What is the expectation of a 3-of-a-kind, then?

= 0.021128 – (1-0.021128) = 0.021128 – 0.978872 = -0.95774

And our break-even payment would be:

The losing probability / the winning probability

= 0.978872 /0.021128 = 46.33 (this is the point in terms of odds at which the expectation would be 0)

This is a huge edge for the house.  Most poker games pay out 3:1 for a 3-of-a-kind!  The expectation would be 0 if the house paid 46.33 times!  So, if you are looking for an edge over the competition, perhaps it wouldn’t hurt to pay a little higher?

Of course, most poker games pay a jackpot for a straight flush or royal flush.

A royal flush has 4 combinations, with the following calculation:

Total outcomes = 52!/(5! X 47!) = 2,598,960

There are only 5 cards out of 13 that can be used for a royal flush (A,K,Q,J,10)  = 5!/5! = 1

1 suit out of 4 = 4!/(1! X 3!) = 4

Total outcomes for a royal flush = 1 x 4 = 4

Probability = 4 / 2,598,960 = 0.000001539 or 0.0001539%

Expectation = 0.000001539 – (1-0.000001539) = 0.000001539 – 0.999998461 = -0.999996922

Break-even odds = 0.999998461 /0.000001539 = 649,739 times (most casinos pay 250 – 100 times the wager)

Jackpots

BUT!  The jackpot has to be paid out as well.

So, as long as the jackpot + wager payout for a royal flush does not exceed 649,739 times of the original wager, expectation should still be in favour of the house.

If the original back bet is $10 and assuming the payment for a royal flush is 100 times, then so long as the jackpot payout is LESS THAN 649,739 – 100 = 649,639 times the $10 wager or $6,496,390, the expectation should still be in the favour of the house.  Of course, there’s no need to do this, but this establishes the upper limits of the maths.

Now, why is this even useful?

  1. Knowing the total possible outcomes for an event allows us to calculate its probability.
  2. Being able to do that then allows us to calculate the expectation of an event and to match payment odds according to the level of house edge desired.
  3. We would also know how much further we’d be able to calibrate the odds in our payments

Now, the most important question

How much can I increase my payment odds before the expectation goes against the house?

The answer is simple = probability of losing / probability of winning

You can test this in a simple manner.  Let’s have a single die roll. The probability of winning on number 1 is 1/6.  The probability of losing is 5/6.  Let’s assume a 1:1 payment.

Our expectation for this kind of wager would be = (1/6 x 1) – (5/6 x 1) = -0.667

If we divide 5/6 by 1/6, we get =0.833333 / 0.166667 = 5 (at this point, the expectation for the house would be 0)

Let’s test this out.  Assuming now that we make our payment odds 5:1 for winning on number 1, our expectation would be = (0.166667 x 5) – (0.833333 x 1) = 0

As long as you keep your payment odds below this level, the expectation will always be in favour of the house.

Trust me, the players know this too.

The odds for many games have already been optimized to their limit – any higher and the advantage would go to the player!

Of, course the edge for the house has to be balanced with the ability to entice a player to wager in the first place.  Understanding the mechanics underpinning your casino’s games goes a long way to maximising their profitability.

Who knows, you may even create your own best-selling game!

Appendix:

Sic-Bo Calculations

Wager Combinations Permutations
Specific Triples 6! / (1! X5!)

= 720 / 1 x 120

= 720 / 120

= 6 (6/6 numbers = 1 combination per number from 1 to 6.)

3! / (3!)

= 6 / 6

= 1 per combination

Specific Doubles

(this excludes specific triples)

6! / (1! X 1! X 4!)

= 720 / 24

= 30 ((30/6 numbers = 5 combinations per number from 1 to 6.)

3! / (2! X 1!)

= 6 / 2

= 3 per combination

2 Dice and Single Die Combination 6! / (1! X 1! X 4!)

= 720 / 24

= 30

3! / (2! X 1!)

= 6 /2

= 3 per combination

3 Single Die Combination 6! / (3! X 3!)

= 720 / 6 x 6

=720 / 36

=20

3! / (1! X 1! X 1!)

= 6 / 1

= 6 per combination

2 Dice Combination 6! / (2! X 4!)

= 720 / 2 x 24

= 720 / 48

= 15

Each combination would have 4 combinations where all 3 numbers are unique and 2 combinations where one of the numbers is a repeat, so:

4 x 6 = 24

2 x 3 = 6

24 + 6 = 30 per combination

Single Die Single:  6! / (3! X 3!) = 720 / 36 = 20 (each number appears in 10 of these 20 combinations)

Double:6! / (1! X 1! X 4!) = 720 / 24 = 30/6 numbers = 5 combinations per number

Triple:   6! / (1! X 5!) = 720 / 120 = 6/6 = 1 combination per number

Single:    3! / (1! X 1! X 1!) = 6 x 10 = 60 + 15 (from the combinations where other numbers appear twice) = 75

Double:  3! / (2! X 1!) = 3 x 5 = 15

Triple:     3! / 3! = 1 x 1 =1

Total (6+3-1)!/3! X (6-1)!

= 40,320 / 720

= 56

6 x 6 x 6 = 216

Poker Calculations:

Hand Face Value Suit Total Combinations
Royal Flush 5! / 5! = 1

There are only 5 possible cards that can form a royal flush (A,K,Q,J and 10)

4! / (1! X 3!) = 4 1 x 4 = 4
Straight Flush (excluding Royal Flushes) 9 possible cards that can form a straight flush without being a royal flush (K,Q,J,10,9 – 5) 4! / (1! X 3!) = 4 9 x 4 = 36
4 of a Kind 13! / (1! X 1! X 11!) = 156 (4! / 4!) x (4! / (1! X 3!))  = 1 x 4 = 4 156 x 4 = 624
Full House 13! / (1! X 1! X 11!) = 156 (4! / (3! X 1!)) x (4! / (2! X 2!)) = 4 x 6 = 24 156 x 24 = 3,744
Flush 13! / (5! X 8!) = 1287 4! / (1! X 3!) = 4 1287 x 4 = 5148 – 36 (straight flushes) and – 4 (royal flushes)

= 5,108

Straight There are 10 possible cards that can start a straight (in descending order of value), from A to 5. (4! / (1! X 3!))5 = 1024 10 x 1024 = 10,240 – 36 (straight flushes) – 4 (royal flushes) = 10,200
3 of a Kind 13! / (1! X 2! X 10!) = 858 4! / (3! X 1!) x (4! / (1! X 3!)) x (4! / (1! X 3!)) = 64 858 x 64 = 54,912
2 Pairs 13! / (2! X 1! X 10!) = 858 4! / (2! X 2!) x (4! / (2! X 2!)) x (4! / (1! X 3!)) = 144 858 x 144 = 123,552
1 Pair 13! / (1! X 3! X 9!) = 2860 4! / (2! X 2!) x (4! / (1! X 3!)) x (4! / (1! X 3!)) x (4! / (1! X 3!)) = 384 2860 x 384 = 1,098,240
Total 52! / (5! X 47!) = 2,598,960

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s

"Be an Excel Star!"

%d bloggers like this: