ON A TI-84 CALCULATOR YOU CAN DO: math -> prob -> nPr / nCr for the given thing you want to calculate, that being the amount of possible permutation, or the value of the combinations given a value of n and r
Permutations
Permutations relate to the arrangement of objects. So image something like 5 people that are queuing to order a book, and you want to determine how many ways there are for them to form a queue?
- List the people as:
a, b, c, d, e - We have 5 Choices for the first position, 4 choices for the second, 3 choices for the third, 2 for the fourth, and then one for the fifth. This follows a factorial pattern, so
n! - This means that are
5! = 120different ways
A permutation of a set of distinct objects is an ordered arrangement of these objects, with a given n! unique permutations for n distinct objects.
Sometimes you wish to only arrange a given subset r of the set, and this is called r-permutation, and this is noted as P(n, r) where P is the permutation, n is the entirety of the objects, and r is the subset.
Example:
Assume we have a set {cat, mouse, dog, rabbit}. We wish to take a side-by-side photo of two animals, so, how many unique ways of photo arrangement are there.
cat-mouseandmouse-catcat-doganddog-catcat-rabbitandrabbit-catmouse-doganddog-mousemouse-rabbitandrabbit-mousedog-rabbitandrabbit-dog
This gives use a total of 12 different combinations for the photo arrangements. Now 4! is equal to 24, so you divide by 2 given the nature of the problem.
A Useful Formual:
So, for a given P(n,r) you can evaluate it as n(n-1)(n-2)(n-2)...(n-r+1) which for the shorthand ends up becoming (n!)/(n-r)!.
So for the given value of P(4, 2) = (4!)/((4-2)!) = 24/2 = 12
Example 2:
From a group of 20 actors, how many different ways are there to select three actors to play a thief, a police office, and a show owner?
So given this, there are generally three different options that you can choose from, so you have the total of 20 options for the first pick, 19 for the second, and then 18 for the final one. Given this restriction, you have 20*19*18=6840 different possible options
For the formula you end up with the following: P(n, r) where n=20 r=3 so you end up with with P(20, 3) = (20!)/(20-3)! = (20!)/(17!) = 6840
Example 3:
How many permutations of the letters {a, b, c, d, e, f, g} contain “bad”?
- Answer: “bad” must occur without a gap, and other letters can appear before it or after it, so you cannot break bad into segments
- This reduces the set to {c, e, f, g, “bad”}, so, how many permutations exist for this new set? Well we have
5! = 120
Now image this: How many words on {a, b, c, d, e, f, g} are there containing “bad”? Using only each letter once and what not.
- Reduce the set once again to {c, e, f, g}, and then the word bad can fit in the gaps:
- Length
3:1bad - Length 4:
p(4, 1)=4!/3! = 4, so there are two possible positions to put “bad” in - We then also have the option of putting bad before or after, not just in between, so we end up with 8 words of length 4 containing “bad”
Stars and Bars Theorem:
So for a given problem of distributing n indistinguishable objects into a given k distinguishable bins, you can solve them using the stars and bar theorem:
Note that the above example is actually in binomial coefficient notation so like 12 choose 2 basically
So for this example:
if I have a bag of 10 sweets and three children to share them with, how many ways can the sweets be divided among the children? Remember to consider extreme cases (e.g. where one child gets all 10 sweets and the other two do not get any sweets).
The answer would be that n=10 and k=3 so plugging this into the formula you end up with (10+3-1) choose (3-1) = 12 choose 2 = (12 C 2) = 66
The above is the formula for the combinatorics thing ^^^
Combinations
Image we did not care for the order/permutation of the pets, and instead only wished to find out the number of different combinations that were possible. This can be done with combinations.
So take {cat, mouse, dog, rabbit} and we wanted a side-by-side photo of two animals, what are the total number of ways we can choose two animals? Note that photos with the same animals are counted as equivalent regardless of the arrangement so mouse-cat is the same as cat-mouse
Give this you would have 4 choose 2 or how many combinations of 2 can we make with 4 animals? Using the above formula, you end up with 4!/(2!)(4-2)! = 24/(2)(2) = 24/4 = 6, meaning there is 6 total different combinations
A combination of a set of distinct objects is an unordered arrangement of these objects, and there is only ever one combination of n elements, whenever you shuffle, only the order/permutation changes, and with combination, the order does not matter!
R-combination of elements of a set is an unordered selection of r elements from this set. A given r-combination of a set of n elements, is denoted by C(n,r)
Factorial Tricks:
Basically a factorial of a great size will always contain a factorial of a smaller size, this can be nice if you want to calculate your factorials faster because certain portions of different factorial values will cancel each other out
So for the given idea where you end up having the two different values that you have, you can actually just pick the one out of the two that is bigger that being r! or (n-r)! and then you can cancel that one out of the given top value and what not
Example one:
How many hands of 7 cards can be dealt from a standard deck of 52 cards. In theory this just ends up being how many different combinations of 7 can we make up out of 52? Notice that the given order of the cards does not matter, and so you can figure this out using the given combination, and not permutation
- The easiest way of course is to choose a calculator:
52 C 7 = 133784560 - Expanding this out into the formula becomes:
(52!)/7!(52-7)! = (52!)/(7!)(45!) - Now you know a LOT of that 52! is going to get canceled out by the 45!, so you can manually rewrite this as
(52*51*50*49*48*47*46)/(7*6*5*4*3*2*1)which ends up all giving you the value of133784560
This is the same as if you want to end up tossing out the different combinations of how many hands of 45 can you end up tossing out, the r just changes value but it all stays the same and the 45! still cancels out
Exercises:
Now it’s time to put into practice the concepts that you have learnt so far in Week 6. Attempt the following exercises. If you get stuck, you can refer to the hints and tips on the next page.
Please note that these exercises are optional, further practice – but we strongly recommend that you engage with them in order to test your knowledge and see where you might need to do additional study.
-
A zip code in Canada consists of three letters and three digits. Each zip code begins with a letter. The letters and digits alternate; for instance, A1B2C3. Find the number of zip codes that:
- end in 6:
26^3 * 10^2 - begin with A and end in 3:
26^2 * 10^2 - end in Z:
0 - are possible:
26^3 * 10^3
- end in 6:
-
Find the number of bytes that:
- begin with 101:
2^5 - end with 110:
2^5 - begin with and end in the same bit:
2 * 2^6 = 2^7 - begin with and end in different bits:
2 * 2^6 = 2^7 - have the same third and fourth bits:
2 * 2^6 = 2^7
- begin with 101:
-
The password for a computer system consists of eight distinct alphabetic characters. Find the number of passwords possible that:
- end in the string MATH:
P(22, 4) = 22 * 21 * 20 * 19 - begin with the string CREAM:
P(21, 3) = 21 * 20 * 19 - contain the word COMPUTER as a substring:
1 - contain the letters WORD together, but in any order.
P(22, 4) * 4! * 5
- end in the string MATH:
-
Find the number of three-digit numerals that can be formed using the digits 2, 3, 5, 6 and 9 if repetitions are not allowed.
Total Permutations = P(5, 3) = 60?
Book Reading:
This essential reading covers the subjects that you have studied in Topic 3 (Week 5 and 6). It contains detailed explanations and a variety of examples to enable you to understand concepts such as combinations and permutations. We strongly recommend that you to first watch the videos and then study the essential reading.
- Read Koshy, Chapter 6, pp.343–349, 352–358 and 375–384.
Book Notes
Combinatorics is basically the study that is used to determine the number of different ways that a given task can be done. The most grueling way to find this out of course is to manually write out each of the given methods, but generally that is not the best because we do not care for all the ways, just the number of different ways
Take for example: One type of automobile license plate number in Massachusetts consists of one letter and five digits. What is the total number of different possible licence plates? Well easy, you just do 26 * 6 ** 10^5
Now you can calculate that very fast, but if you had to manually write out each possible value and count them, at one a second, it would still take you well over six months.
Mutually exclusive tasks are two tasks that cannot occur simultaneously. So imagine that you have a given task A of drawing red queens from a deck of cards, and task B of drawing black kings from a set of cards. Given this what is the number of ways to draw a red queen or a black queen? So you have |B| + |A| which since the two tasks are disjoint, they are mutually exclusive, so I cannot draw a black king and a red queen at the same time, meaning you get |A ∪ B| which is four.
Addition Principle: this is basically the additional principle from the previous week or two, where if you have A and B as two mutually exclusive tasks, then both tasks can be done in |A| + |B| given ways, so this is just basic counting but with tasks.
You can then extend this to any finite number of pairwise mutally exclusive tasks using induction:
The Includsion-Exclusion Principle from the basics of counting can also be applied to these given tasks, so say that you have something like task A which can be done in m number of ways, and a task B which can be done in a n number of ways. The overlapping portion of the ways in which the tasks can both be done can then be said to be h, so in total the number of ways is n + m - h number of ways. So |A ∪ B| = |A| + |B| - |A ∩ B|
The Multiplication Principle: Suppose you have a task T that is made up of two different subtasks. Subtask t1 followed by subtask t2. If the first subtask can be done in m1 ways and the second in m2 DIFFERENT ways for each way in subtask 1, then the task can be done in m1 * m2 ways.
So basically image you want to make a round trip from Boston to New York right, your first sub task is getting from Boston to New York, and say you have 3 ways to do so, and then once you are in New York, your second subtask is to get back to Boston, and say that you have 2 ways of doing so. For this, you have three options to get to NY, and then for each of those 3 options there are 2 options back, so you end up with 6 total possible combinations.
Permutations:
So this one is for the number of combinations whenever the actual order of the combinations matters. So say that you have something like a photographer who wants to arrange 10 cats in a row for a television commercial. She can arrange them however she would like, so in how many ways can she accomplish this? Well, because we understand that the order does not entirely matter, there would be 10! different permutations of the cats.
A permutation of a set of n (distinct) elements taken r (0 ≤ r ≤ n) at a time is an arrangement of r elements of the set. For convenience this is called an r-permutation. If r = n, then the r-permutation is called simply a standard permuation. The number of possible different r-permutations is denoted by P(n, r)
Formula:
An interesting fact to also mention is that if you have something like P(n, n) where r = n then that is actually equal to n!, and that is because the bottom of the formula becomes 0!=1, and this makes sense if you really think about it.
Equally enough, it should be pointed out that the formula there is in fact good, but it is more often that you generally have the formula calculated as n(n-1)(n-2)...(n-r+1), and this is because the factorials on the bottom actually cancel out, this makes the math easier overall.
Derangement
The following is a problem proposed in the 18th century:
A permutation of n distinct items a1, a2, ... an in which no item of ai appears in it’s original position of i is called a derangement. This is where order matters a lot and you are counting the number of possible permutations where nothing is correct.
So image something like a set of {1, 2, 3, 4}:
These are each derangement because none of the values appear inn their correct order.
How to find a Derangement:
So this feels really really recursive in nature. Basically you find out the number of derangements for each of the given values because the one where you want to find the derangement, and then multiply them out. This is because you need to find out what the number of different derangement is for each of the single derangements.
This is because if for example I want to have another element like 3 or something that I want to have deranged, then the values of the number of derangement is multiplied with each of the new derangement possible at 3, and so you cover all of the given options with this method. The reason for the (n-1) is because an can be placed in anyone one of the positions a1, a2, ... (n-1)
Combinations
Combinations are the different ways that you can arrange something when the permutations of an item do not matter. This means that the items do not necessarily have to be distinct in order to count. They are generally defined as:
r-combination: this is when a set of n elements, where 0 ≤ r ≤ n, is a subset containing r elements. The number of r-combinations if a set with n elements is denoted by C(n, r) or (n r) where the second one is basically vertical.
The number of combinations is also called the binomial coefficient.
Cool thing
A neat thing to note about combinations is that they sort of work from both sides of the spectrum, that is to say that C(n, r) = C(n, n-r) so if you have a value between r and n-r if you want to do the least amount of computational work, you should do the one that would require you do find out the least number of different multiplications that you would have to do.






























