Learning to Count Again

Let’s define an event A, flipping heads on the flip of a coin for example. What is the probability of that event occurring? I will use the common notation of P(A) to represent the probability of an event A. The basic way to calculate a probability is to divide the number of ways A can occur by the number of ways anything can occur. That is,

\[\text{P(A)} =\frac{\text{Number of ways A can occur}}{\text{Number of ways anything can occur}}\]

In the case of getting a heads from a flip of a coin, there is only one way to get a heads and there are two possibilities. So the probability is 1/2.

If we flip two coins and we now let our event A be two heads, then the counting of the ways anything can happen takes just a little more thought. The possibilities are: HH, HT, TH, and TT. So there is only one way to get two heads but there are four possibilities. So the probability is 1/4. If the event is “at least one head”, there are three ways that can happen out of the total of four possibilities, so the probability is 3/4.

We can increase the complexity of our experiment and flip three coins or ask questions about choosing certain cards in a standard deck. The counting for the numerator and the dominator gets harder but it is still possible with a little more thought. But what if I asked “what is the probability of getting a flush (all cards of the same suit) in 5 cards randomly selected from a deck of cards?” or “A four-digit number (with no repetitions) is to be formed from the set of digits {1, 2, 3, 4, 5, 6}. Find the probability that the number is even.” Now the counting gets much harder. But fortunately, there are ways to handle this

Selection or Arrangement

Let’s say we have 8 people standing around just waiting for a math problem to show up. Someone wants to form a team of 5 people from these 8 and another person wants to arrange 5 of these people around a desk. How many different teams can be made and how many different settings around the desk can be done?

Notice that in the team question, it doesn’t matter what order you pick the players but in the table question, order does matter. Just using letters to represent the people, ABCDE and EDCBA are the same for the team question so would only be counted once but these are two separate arrangements in the table question. The table question is an arrangement question whereas the team question is a selection question. In textbooks, arrangements are often called permutations and selections are called combinations. It doesn’t matter what they are called, you need to know which type you have in order to count the number of possibilities correctly.


Let’s look at the table question first. You have 8 ways to choose the first person, but when you do, there are only 7 people left to choose as the second person. Then you only have 6 left for the third position, 5 left for the fourth and 4 left for the fifth. So the total number of arrangements is 8×7×6×5×4 = 6720. Multiplying numbers that sequentially decrease by one is a common thing when doing these kind of problems so, as is so common in maths, a shorthand notation was created. 8×7×6×5×4×3×2×1 is represented as 8! and is called “8 factorial”. But for our arrangement problem, we are missing the 3×2×1 part. Notice that 3×2×1 = 3!. So another way to show the solution is 8!/3!. Also notice that 8 – 5 = 3.

We can generalise this. If you have n things and want to arrange them r at a time, then the number of arrangements is n!/(nr)!. Once again, even this is too much to write for our lazy mathematicians, so this is given a shortcut notation where the P stands for permutation:

^{n} P_{r} =\frac{n!}{( n-r) !}

In a CAS calculator, the function “nPr” is used to calculate permutations, so for our problem nPr(8,5) = 6720.

By the way, what if we wanted to arrange all 8 people? Then using the permutation formula, we get 8!/(8-8)! = 8!/0!. This looks illegal but mathematicians foresaw this and defined 0! as being equal to 1. Must be nice to be able to make your own rules.


Now let’s look at the team question. Using letters again, we are now in the scenario where ABCDE and EDCBA are the same team and this should only be counted once. So we would expect that the number of selections using the same n and r would be smaller than the number of arrangements. In fact this is true. So for our team selection, if we use our arrangement formula, each team has 5! different arrangements and the calculated number is 5! too large. So if we divide our arrangement total of 6720 by 5! = 120, we would get the correct number for the number of teams possible, 6720/120 = 56. To generalise, if you have n things and want to select them r at a time without regard to order, then the number of arrangements is n!/r!(nr)!. Again, there is shorthand for this where the C stands for combination:

\[^{n} C_{r} =\frac{^{n} P_{r}}{r!} =\frac{n!}{r!( n-r) !}\]

In a CAS calculator, the function “nCr” is used to calculate combinations, so for our problem nCr(8,5) = 56.


So at the beginning of this post, I posed a hypothetical question about the probability of being dealt a flush hand of 5 cards out of a deck of 52 cards. As card order does not matter, this is a selection (combination) problem. We need to find the number of ways to get 5 card flush hands and the total number of possible 5 card hands. I assume you are familiar with the standard deck of cards that consists of 4 suits of 13 cards each.

First let’s find the total number of 5 card hands there are. Here n = 52 and r = 5:

\[^{52} C_{5} =\frac{52!}{5!( 52-5) !} =2,598,960\]

his will be our denominator to use in the probability formula. For the numerator, we need to find how many ways you can get a 5 card flush. You could get 5 clubs, 5 hearts, 5 diamonds, or 5 spades. Each one of these is a selection of 13 cards, 5 at a time or:

\[^{13} C_{5} =\frac{13!}{5!( 13-5) !} =1,287\]

We need to multiply this by 4 since there are 4 suits, 1287×4 = 5148. So the probability of being dealt a flush in 5 card poker is P(Flush) = 5148/2598960 = 0.00198 = 0.198% or about once in 505 hands. I wouldn’t bet on it.