Combinatorics Part II: Permutations
Combinatorics Part II: Permutations
Combinatorics Part II
Before going further, it is first important that you are familiar with factorials.
The notation is a number (or symbol) followed by an exclamation mark, e.g., 5!
The general case:
n! = n(n − 1)(n − 2) · . . . · 2 · 1
So you are multiplying each natural number between n and 1 to calculate the
factorial. See your notes for further information.
Permutations
These relate to specific types of selections where order is important, but no repeti-
tions are allowed.
Examples:
1. Given the letters A, B, C, and D. How many permutations of these four letters
are there?
This should not be too taxing, as it is easily solved using the multiplica-
tion principle.
3. The same 6 people are about to sit down at a round table for a meal. How
many different ways could they sit themselves?
Initially, you may think that the answer would be the same as the answer
for the previous question. However, as you can see from the picture of a
potential table layout, rotations will be considered identical, which means
ABCDE = BCDEA, which was not the case when standing in a line.
1
MA12 — Permutations & Combinations Andrew Roberts
24th March 2004
It is not always the case that the total number of permutations is sought. Alter-
natively, you may only be interested in a subset of the objects in question. For
example, from the 6 people as mentioned in previous examples, how many ways can
they be paired. This is known as a k -permutation1 .
To select k objects from a set of n objects is denoted as P (n, k). To calculate:
n!
P (n, k) = n(n − 1)(n − 2) . . . (n − k + 1) =
(n − k)!
You may be pleased to know that this function is found on most calculators
(look for nPr), which is useful for checking that your working out is correct.
More examples:
4. Given the letters A, B, C, D, and E.
5. How many possible 5 letter permutations are there (assuming no repeats)?
If ACE must stay together in that order, then we can use a simple trick
of combining them and treating them as a single entity. With the remaining
2 letters, there are only 3 objects to consider. Therefore, there are 3! permu-
tations that contain the substring ACE.
The approach here is to find the number of strings that do contains either
AB or CD and then subtract from the total number of string possible.
To find the number of strings containing AB, use the same principle as in
part b). Treat AB as a single entity, and there are 3 other letters. Thus, 4!
strings with AB.
That is the same result for strings with CD. Therefore, the total number
of strings containing either AB or CD = 4! + 4! = 2 · 4!
Now for the tricky part! Within the set of permutations that contain AB,
there are some that also contain CD. It is therefore also true that for the set
of strings containing CD, there are some that also contain AB. This means
that the above result of 4! + 4! actually contains some duplicates when added
together. To reach the final answer, we must remove this duplication.
This is actually fairly trivial to work out once you know what you are look-
ing for. The duplication was caused by counting the number of strings that
contain AB and CD twice. The number of strings that contain AB and CD is
3!. Therefore, if we subtract this amount from the 2 · 4! strings that contain
1 Is also known as an r -permutation, which is probably more common, especially in the maths
literature. However, it is only a name, and so I shall stick with the way your notes present the
material.
2
MA12 — Permutations & Combinations Andrew Roberts
24th March 2004
Finally, we already know the total number of permutations from part a).
So, the answer to the original question is 5! − ((2 · 4!) − 3!) = 78
Go through the steps as the previous part. The difference comes in the form
that there is an extra condition, i.e., a string can only contain AB and BE
if and only if it contains ABE. Part b) gave us the answer for the number of
permutations for substrings with three letters, 3!.
⇒ 5! − (2 · 4! − 3!) = 66.
Combinations
These are similar to permutations, however, order is not important, but still no
repetitions are allowed.
The notation for k combinations is C(n, k) where n is the number of distinct
elements.
P (n, k)
C(n, k) =
n!
Examples:
1. In the main draw of the National Lottery, the player can select 6 numbers
from a possible 49. How many possible combinations are there?
P (49, 6)
⇒ C(49, 6) = = 13, 983, 816
6!
Now you should see where the 14million-to-1 odds come from!
2. In a game of poker, you are dealt a hand of 5 cards from a pack of 52.
Again, order is still not important because A2345 is the same hand as
5432A.
P (52, 5)
⇒ C(52, 5) = = 2, 598, 960
5!
(b) How many hands contain cards of exactly one suit?
There are only 13 cards in each suit. So the possible number of hands
is C(13, 5) for a suit. And since there are four suits available, the total
number of hands is 4 · C(13, 5).
(c) How many hands contain cards of exactly two suits?
Imagine the suits in question are Spades and Hearts (the calculations
are the same for any two, however, its easier to be able to refer to suits
with a name). There are 26 cards between the two, which means there
3
MA12 — Permutations & Combinations Andrew Roberts
24th March 2004
are C(26, 5) ways to select 5 cards. However, don’t forget, within that
selection, there will be C(13, 5) that only contain spades, and the same
amount that only contain hearts. This leaves us with C(26, 5)−2·C(13, 5)
possible hands that contain Spades and Hearts. We must now generalise
for any combination of two suits. The number of ways to choose two
suits from four is C(4, 2).
Examples:
1. A roulette wheel has the numbers 0 to 36 (inclusive) and for each turn, a ball
will land on only one of those numbers. After 5 turns at the wheel, how many
possible sequences are there?
Since each turn is independent from any other, there are always 37 possi-
bilities for each turn. Therefore, after 5 turns,
⇒ 37 · 37 · 37 · 37 · 37 = 355 .
2. A die a rolled 3 times. How many possible permutations are there?
I could go on and produce a massive list of examples for this type of permutation.
However, all questions of this type will be in a similar style, just the preamble that
surrounds the key attributes is different, e.g., dice, cards, bags of sweets etc.
4
MA12 — Permutations & Combinations Andrew Roberts
24th March 2004
(k + n − 1)!
C(k + n − 1, k) =
k!(n − 1)!
Section 2.2.4 in your notes goes into detail as to how the above formula comes
into existence.
Summary
You would be well advised to have the following table at hand when doing your
combinatorics coursework, and to try and memorise for your exam.
Selections
Ordered Unordered
None P (n, k) C(n, k)
Repetition
Unlimited nk C(k + n − 1, k)