# 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%

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%

Now, the following calculations are for a hypothetical situation where a wager wins on a 3-of-a-kind and loses on every other result – this part will help to explain a more complicated situation later on!

Expectation

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

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

Break-Even Payment

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)

Remember to add a 1 to this number if the wager is consumed whether the wager wins or not as is the case with jackpots. Alternatively, just take 1/0.021128 = 47.33. This works too.

And now, the complicated situation I mentioned earlier…

The above situation would be accurate if your wager only wins on a 3-of-a-kind and loses on every other result, but remember that your poker wager pays on other results as well! For this, we would need to table all the possible win and loss results:

 Player Wins With A… Combinations Permutations Outcomes Probability 1 Royal Flush 1 4 4 0.0000015391 2 Straight Flush 9 4 36 0.0000138517 3 4 of A Kind 156 4 624 0.0002400960 4 Full House 156 24 3,744 0.0014405762 5 Flush 1,287 4 5,108 0.0019654015 6 Straight 10 1,024 10,200 0.0039246468 7 3 of A Kind 858 64 54,912 0.0211284514 8 2 Pairs 858 144 123,552 0.0475390156 9 Pair 2,860 384 1,098,240 0.4225690276 Nothing 1,287 1,024 1,302,540 0.5011773940

Step 1:

An approach to determining a break-even payout for each winning result would be as follows:

 Player Wins With A… Probability Win/Loss Multiple Expectation 1 Royal Flush 0.00000154 36,181.67 0.05568638 2 Straight Flush 0.00001385 4,020.19 0.05568638 3 4 of A Kind 0.00024010 231.93 0.05568638 4 Full House 0.00144058 38.66 0.05568638 5 Flush 0.00196540 28.33 0.05568638 6 Straight 0.00392465 14.19 0.05568638 7 3 of A Kind 0.02112845 2.64 0.05568638 8 2 Pairs 0.04753902 1.17 0.05568638 9 Pair 0.42256903 0.13 0.05568638 Nothing 0.50117739 -1 -0.50117739 Total Expectation 0.0000

The above table gives an equal expectation for each winning result, with the break-even payment being the Win/Loss Multiple.

Step 2:

This method takes the expectation for a losing wager, being -0.50117739 and dividing the absolute number by the number of winning wager types, meaning 0.50117739 / 9 = 0.055686.

Step 3:

Then, taking 0.055686, we divide this number by the probability of the winning wager type, so for a Royal Flush, 0.055686 / 0.00000154 = 36,181.67. A Four-of-a-kind would yield  0.055686 / 0.00024010 = 231.93, this being the break-even payment.

Remember to add a 1 to the break-even payment if the wager is consumed whether the wager wins or not as is the case with jackpots – this results in a different expectation for all the wagers. Alternatively, just take (1/9) / Probability of the Wager, to get equal expectation for all wagers.

Jackpots

BUT!  The jackpot has to be paid out as well. Remember that the jackpot wager wins only on a Straight Flush (usually 10% of the jackpot) or a Royal Flush (100% of the jackpot)

So, as long as the wager + jackpot payout for a royal flush does not exceed 36,181.67 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 36,181.67 – 100 = 36,081.67 times the \$10 wager or \$360,816.70, 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

#### Tags 