Understanding Combinations and Permutations

In 1665, three years after his death, Pascal's famous arithmetical triangle was published. Pascal's Triangle is a well known mathematical pattern.

Pascal's TriangleThis pattern was actually discovered in China, but it has been named after the first westerner to study it. According to Yunze He, "Pascal's" triangle was first developed during the Song Dynasty by a mathematician named Hue Yang so lets take a moment to celebrate Hue Yang's triangle.

The triangle is easily compiled. Each line is formed by adding together each pair of adjacent numbers in the line above. The first thing to notice about the triangle is how neatly row 5 summarises the five tosses of a coin (there are a total of 32 possible results of which one contains no heads, five contain 1 head, ten contain 2 heads, ten contain 3 heads, five contain 4 heads and one contains 5 heads). The Triangle is of great interest to gamblers, and provides the answer to questions relating to equipartition and combinations.

Combinations and permutations

A practical problem for gamblers is the calculation of combinations and permutations. A gambler frequently wants to know how many different ways a smaller number of items can be taken from a larger. This occurs in horse racing, where the number of four-horse accumulators which can be taken from a total of eight selections might be required, or in selecting draws for a treble-chance football pool, where perhaps the number of combinations of eight draws from ten selections are needed.

Each of these problems is an exercise in calculating combinations, although British football pools companies and pools journalists always refer for some reason to the second example, as a permutation.

The answer to both problems is contained in Pascal's Triangle. Modern calculators and spreadsheets embed a simpler way of working out these calculations. In Excel use the combin(n,r) function, where n is the number of articles and r is the repetitions (combinations).

The full formula is =(n!/((n-r)!*r!))

The "!" in the forumla means factorial. In Excel a factorial is entered =fact(n) where "n" is the number of the factorial you need to work out. In Microsoft Excel there is actually a function to replace the entire confusing formula. The function is “combin”.

If you need to select any 8 combinations from 10 items your answer to the problem should equal 45. In excel test this using =combin(10,8)

Ages ago, I wrote a small piece of software to list the combinations of this formula. This software was available on this site and would output a file to the directory on your computer from where it was run. I am grateful to Sean McClean (Thanks Sean!) who visited this site and emailed me. He converted my algorithm into Javascript which I have presented below for your interest. Type in the combination you want and then click calculate and it will list all the combinations available for you.

Combinations in Javascript

Original algorithm by Peter Webb, Javascript by Sean McClean.

How many items (I.e. 3 from10)
How many selectons (I.e. 3from 10)
Text area showing all permutations available :

A combination is concerned only with the make-up of the group in question. If for example we want to know how many combinations of two trap numbers are possible from a six trap greyhound race there are:-

combin(6,2) = 15

We are not concerned with the order of the traps in each combination. But if we wanted to forecast the first two dogs home in the correct order, we need to calculate a permutation. In this case, there are six dogs, each of whom could finish first, so there are six alternative trap numbers to supply the winner. For each of these, there are five alternative trap numbers to supply the second dog- So there are 6 x 5 ways, or 30, of forecasting the first and second dog in a six-dog race in the correct order. This can be verified from the calculation of combinations. There were 1 5 combinations, each of which could be reversed, as the combination of say, Trap 3 and Trap 4 has two orders, 3:4 and 4:3. Therefore there must be 15 x 2 permutations of the first two dogs home.

Lottery wheeling

On many lottery pages you will find references to wheels or wheeling. Basically these wheels are often put forward as a universal solution to your lottery woes; but of course, they are not. Basically a wheel is an optimal covering combination. The combination is set up to ensure a win in a given circumstance. This is done by forming the entry in blocks and placing the available numbers far enough apart to minimise your cost but close enough to ensure a win. Blocks of numbers are cast out till duplications and less effecient combinations are excluded. The set is minimised to a set which ensure optimal coverage for the least effort.

There are a couple of excellent wheels on this site. Having kept an eye on the various wheeling challenges it is interesting to see that the smallest number of entries to ensure a 3 ball win on a 6 from 49 lottery is 163 with an average win of just over 3 on that set!! If you are happy to match only 2 balls then you can get away with only 19 tickets. If you are interested in combinations it is worth studing wheels. They are a good way to visualise the thoery of combinatorics. Rade Belic holds the record for the smallest "wheel" for a guaranteed three ball match from an any 6 from 49 lottery, you can visit his page here.

The La Jolla covering repository is an excellent site for mining combinations / wheels for your own research or purposes. Usually the form for finding a wheel you are interested in is expressed as C(10,5,4) = 51. It means that the number of combinations is 51 where we want to ensure we find any four from five selections in a group of ten numbers.

Let me give you a simple example of how wheeling is able to "optimise" your entry. Using the javascript calculator further up this page you will find that there are 10 possible combinations of arranging ANY three from five numbers. Here is the set.

Any three from five numbers =1 2 3, 1 2 4, 1 2 5, 1 3 4, 1 3 5, 1 4 5, 2 3 4, 2 3 5, 2 4 5, 3 4 5

If we adopt the covering combination C(5,3,2) we are saying that we want to guarantee that we get at least two from any three numbers out of a total selection of five. We can achieve that with a covering combination of only four sets of three numbers. This compromise means we are not covering three but at least two numbers. However the total number of sets required to achieve this has dropped from ten to four.

Any two from a set of three numbers = 1 2 3, 1 4 5, 2 3 4, 2 3 5

The problem with wheels of course is they can generate very efficient covering combinations but they actually make no difference to your chance of winning a random event. Sometimes this is difficult to understand, but it is true. Don't bother trying to prove otherwise or else you will spend a lot of time before realise you have actually wasted it!! However I have put them to use in a number of situations and they are interesting to study but you will need a good grounding in combinations and permutations before you get to grips with them fully.

JoomlaWatch 1.2.12 - Joomla Monitor and Live Stats by Matej Koval