- The binomial distribution — repeated trials
- The binomial theorem · coming soon
- Permutations and combinations — formal treatment · coming soon
Two questions with the same answer
Here are two counting questions.
First: in how many different orders can five people sit in a row of five chairs? The answer is 120.
Second: a club has ten members. In how many ways can it choose a committee of three? The answer is also 120.
The two questions look nothing alike. One is about order. The other is about a group, where order does not matter at all. Getting the same number is a coincidence. But the reason behind each answer is not a coincidence, and it is the subject of this lecture.
Now change the second question a little. The club chooses three of its ten members to be president, secretary and treasurer. The same three people can now fill the posts in different ways. The answer jumps to 720, exactly six times as many.
Why six? If you can answer that, you understand permutations and combinations. Most students who struggle with this topic were given two formulas and told which word goes with which. The words often mislead. This lecture builds both formulas from one idea, so that you can see which one a question needs.
Count in stages, then multiply
Start with something small. Leila has 4 shirts and 3 pairs of trousers. How many different outfits can she wear?
Pick a shirt first. Whichever shirt she picks, she can wear it with any of the 3 pairs of trousers. So each shirt gives 3 outfits. With 4 shirts, that is 4 groups of 3 outfits.
This is the multiplication principle. Some books call it the fundamental counting principle.
A task has two stages. The first stage can be done in ways. Then, whatever happened first, the second stage can be done in ways. So the whole task can be done in ways.
The same holds for three or more stages: multiply the number of choices at each stage.
The words "whatever happened first" matter. The second stage does not need the same choices each time. It only needs the same number of choices. You used this in the tree diagrams lecture. A bag held 10 balls, and two were taken out without putting the first back. The first ball could be any of 10. Whichever it was, 9 balls were left for the second. So there were ordered pairs, and that is why we multiply along a path.
A four-digit PIN shows both cases. If digits may repeat, each of the 4 positions has 10 choices, so there are PINs. If no digit may be used twice, the choices shrink: . Always check whether repeats are allowed before you count.
Multiplying is for stages, where you do one thing and then another. Sometimes a count splits into separate cases instead, where the outcome is one thing or another, never both. Then you add the cases. A café sells 5 cold drinks and 4 hot drinks. You buy one drink. There are choices, because no drink is both.
Arranging everything: factorials
Back to the five people and five chairs. Fill the chairs one at a time, from left to right. Any of the 5 people can take the first chair. Then 4 people are left for the second chair, 3 for the third, 2 for the fourth, and the last person takes the last chair.
Products like this appear so often that they have their own name and symbol. The product of the whole numbers from down to 1 is called factorial, written . So , , , and . The exclamation mark was first used for this by the French mathematician Christian Kramp, in a book of 1808.
different objects can be arranged in a row in ways.
Factorials grow very fast. . A standard pack of 52 cards can be put in order in ways, and . That is a number with 68 digits.
How big is that? Imagine that every person on Earth, about 8 billion people, shuffled a pack once every second for a billion years. That makes about shuffles. This is a tiny fraction of , far less than one part in a billion billion. So when you shuffle a pack well, the order in your hands has almost certainly never existed before in the history of the world.
One more factorial is needed: . It is defined to be 1, and there is a good reason. Look at how factorials are built.
For example, and . In general:
Use the last rule with . It says . Since , we need . This also has a meaning. There is exactly one way to arrange no objects at all: do nothing. As you will see in a moment, this choice also makes the formulas work in every case.
Arranging some of them: permutations
Ten runners are in a race. Gold, silver and bronze medals go to the first three. How many different results are possible?
Fill the medals in order. Any of the 10 runners could win gold. Then 9 are left for silver, and 8 for bronze. So there are results. We stop after three factors, because only three medals are given.
An ordered arrangement of objects taken from different objects is called a permutation. The number of them is written . Here, .
The product is the start of , with the tail missing. The missing tail is exactly . So we can write the count as with divided away:
The number of ordered arrangements of objects taken from different objects is
That is factors, starting at and counting down.
Check the formula when every object is used. Arranging all 5 people gives . With , this is , as it should be. That is the moment where the choice pays off.
In practice, you rarely need the full factorials. Write the factors and multiply. To deal 5 cards in a row from a pack of 52, the count is .
Choosing a group: combinations
Now the committee of three from ten members. There are no posts this time. The committee of Ana, Ben and Chen is the same committee as Chen, Ana and Ben.
This is the hard step of the lecture. Spend time here.
We cannot fill seats in order, because there are no seats. So count the ordered way first, and then correct for it. The ordered count is . That counts every committee many times, once for each order its three members can be listed in.
How many orders does one committee have? Three people can be arranged in ways. So every committee was counted exactly 6 times, no more and no less. To count each committee once, divide by 6.
That is it. That is the whole idea. A selection is an arrangement with the order forgotten, and each selection of objects hides arrangements. It is also the answer to the question from the start. Posts give six times as many results, because each committee of three can share out three posts in ways.
Try it yourself below. Choose how many letters there are and how many are picked. Every arrangement is listed, grouped by the selection it comes from. Count the groups and the size of each group.
Choose n, the number of different letters, and r, how many are picked. Each row is one selection. The arrangements after it are its different orders.
Letters n: 5
Picked r: 3
The table lists all 60 arrangements of 3 letters taken from A, B, C, D and E, grouped by selection. There are 10 selections, and each one appears in orders, so .
| Selection | Its 6 arrangements |
|---|---|
| {A, B, C} | ABC ACB BAC BCA CAB CBA |
| {A, B, D} | ABD ADB BAD BDA DAB DBA |
| {A, B, E} | ABE AEB BAE BEA EAB EBA |
| {A, C, D} | ACD ADC CAD CDA DAC DCA |
| {A, C, E} | ACE AEC CAE CEA EAC ECA |
| {A, D, E} | ADE AED DAE DEA EAD EDA |
| {B, C, D} | BCD BDC CBD CDB DBC DCB |
| {B, C, E} | BCE BEC CBE CEB EBC ECB |
| {B, D, E} | BDE BED DBE DEB EBD EDB |
| {C, D, E} | CDE CED DCE DEC ECD EDC |
Whatever you chose, every row had the same number of arrangements, . That is why one division is enough. Notice also what happens when . There is only one selection, all the letters, but it has orders.
The number of selections of objects from different objects is
Some books write instead, read " choose ". Your calculator has a key for it, usually marked nCr. To work one out by hand, write the factors of on top and underneath:
Which is larger: the number of committees of 3 that can be chosen from 10 people, or the number of committees of 7?
Show the answer
They are equal. Both are 120. Choosing the 3 people who are on a committee is the same act as choosing the 7 who are left off it. Each choice of 3 matches exactly one choice of 7. So . In general, . The formula agrees: swapping and only swaps the two factorials underneath.
The one question: does order matter?
Every counting question asks you to decide one thing first. Does order matter? Here is a reliable test. Take one possible answer and swap two of the chosen items. If the swap gives a different outcome, order matters, and you are counting arrangements. If the swap gives the same outcome, order does not matter, and you are counting selections.
A captain and a vice-captain: swap them, and a different person is captain. Order matters. Three toppings on a pizza: swap two, and it is the same pizza. Order does not matter. Do not decide by the wording. The word "choose" appears in both kinds of question.
Put each situation in a box. For each one, imagine swapping two of the chosen items. Is the outcome different?
Each situation is placed in its box, with the reason.
- Order matters: gold, silver and bronze for 3 of 10 runners. Swapping two runners changes who wins which medal.
- Order matters: a 4-digit PIN with no repeated digit. 1234 and 4321 open different locks.
- Order matters: choosing a captain and a vice-captain from 11 players. Swapping them changes who is captain.
- Order matters: seating 4 guests in 4 numbered chairs. Swapping two guests changes the seating.
- Order does not matter: a committee of 3 from a club of 10. The same three people form the same committee.
- Order does not matter: 6 lottery numbers from 1 to 49. A ticket wins whatever order the numbers are drawn in.
- Order does not matter: a hand of 5 cards. A player holds the same hand whatever order the cards arrived in.
- Order does not matter: 3 toppings on a pizza from 8. The pizza is the same.
- Order does not matter: handshakes when each pair of 10 people shakes hands once. A handshake between Ana and Ben is the same as one between Ben and Ana.
Notice the captain card. It used the word "choosing", and yet order mattered. The swap test is safer than any word.
Worked examples
A club has 12 members. In how many ways can it choose a committee of 4?
Does order matter? Swap two members of the committee: it is the same committee. So count selections.
Check: ✓. The answer is a whole number, as every count must be. If a division ever leaves a remainder, a step has gone wrong.
Six people choose a president and a secretary. Then two of the remaining four form a sub-committee. In how many ways can this be done?
Label each stage before you calculate. The president and secretary are different posts, so order matters there. The sub-committee is a group, so order does not matter there.
President: 6 ways. Secretary, from the 5 left: 5 ways. Sub-committee of 2 from the 4 left: ways.
Check by counting in a different order. Choose the sub-committee first, from all 6: ways. Then the president from the 4 left, and the secretary from the 3 left: ✓. Two different routes give the same count, which is strong evidence that nothing was counted twice.
Five friends, including Ana and Ben, sit in a row of five chairs. In how many orders can they sit if Ana and Ben must sit next to each other?
Treat Ana and Ben as one block. Now there are 4 things to arrange: the block and the 3 other friends. They can be arranged in ways. Inside the block, Ana can sit on the left or on the right: 2 ways.
Check by counting places. Five chairs in a row have 4 pairs of neighbouring chairs. Ana and Ben take one pair (4 ways), in either order (2 ways), and the other three fill the last three chairs ( ways). That gives ✓. So in of the orders, Ana and Ben are apart.
A bag holds 5 red and 4 blue balls. Three balls are taken out together. Find the probability that exactly two of them are red.
Taking balls "together" means order does not matter. Every selection of 3 balls from the 9 is equally likely, so count selections.
All possible selections: .
Selections with exactly 2 red: choose 2 of the 5 red balls and 1 of the 4 blue balls. These are two stages, so multiply: .
So the probability of exactly 2 red is
Check with a tree diagram, taking the balls one at a time without replacement. The path red, red, blue has probability . Two more paths give exactly two red: red, blue, red and blue, red, red. Each has the same three fractions in a different order, so each is . The total is ✓.
Look at what just happened. The tree needed 3 paths, and 3 is , the number of ways to choose which two of the three draws are red. Counting paths with combinations is exactly the idea the next lecture builds on.
"Choose" does not always mean combinations, and "arrange" is not always written. Choosing a captain and a vice-captain is a permutation, because the posts are different. Always use the swap test: does swapping two chosen items give a different outcome?
A group of 3 is chosen from 6 women and 4 men. How many groups have at least one woman? A tempting method is: choose one woman first (6 ways), then any 2 of the other 9 people ( ways), giving 216. That is too many. A group with two women, Ana and Bea, is counted once with Ana chosen "first" and again with Bea chosen first. Count the opposite instead. All groups: . Groups with no woman: . So groups have at least one woman.
assumes each object is used at most once. A 4-digit PIN where digits may repeat has possibilities, not . Read the question for "different", "no repeats" or "with replacement" before you choose a method. When repeats are allowed, go back to the multiplication principle.
Work each one on paper first. Open a hint only when you are stuck.
-
A code is made of 4 letters taken from A, B, C, D, E and F. (a) How many codes are there if all 4 letters must be different? (b) How many if letters may repeat?
Hint 1
A code is read in order, so ABCD and DCBA are different codes.
Hint 2
Fill the 4 positions one at a time. In (a) the choices go down by one each time; in (b) they do not.
Full answer
(a) Order matters and there are no repeats, so . (b) Each of the 4 positions has 6 choices: . Check: (b) must be larger than (a), because it allows every code in (a) and more. ✓.
-
A team of 5 is chosen from 8 girls and 6 boys. (a) How many teams have exactly 3 girls? (b) If the team is chosen at random, what is the probability that it has exactly 3 girls?
Hint 1
A team is a group, so order does not matter. Exactly 3 girls means exactly 2 boys.
Hint 2
Choose the girls and then the boys, and multiply. For (b), divide by the number of all possible teams of 5 from 14.
Full answer
(a) . (b) All teams: . So the probability is . Check: and ✓; the probability is between 0 and 1 ✓.
-
The five letters of the word MANGO are arranged in a row. (a) How many arrangements are there? (b) In how many are the two vowels, A and O, next to each other? (c) An arrangement is chosen at random. What is the probability that the vowels are next to each other?
Hint 1
All five letters are different. For (b), use the block method from Worked Example 3.
Hint 2
The block AO and the letters M, N, G make 4 things to arrange. The block can be AO or OA.
Full answer
(a) . (b) . (c) . Check (c) another way: whatever chair A takes, O must take a chair next to it. Over all 120 orders, 48 put them together, the same 2 in 5 found in Worked Example 3 ✓.
-
A 4-digit PIN uses four different digits, chosen at random from 0 to 9. What is the probability that its digits are in increasing order from left to right, such as 1358 or 0247?
Hint 1
Count all PINs with four different digits first. Then count the increasing ones.
Hint 2
Any selection of four different digits can be put in increasing order in exactly one way. So there are as many increasing PINs as there are selections of 4 digits.
Full answer
All PINs with different digits: . Increasing PINs: one for each selection of 4 digits, so . The probability is . Check: each selection of 4 digits has orders, and exactly one of them is increasing. So the answer must be ✓. This is the main idea of the lecture used backwards: .
Counting like this is very old. Ancient Indian medical books, including the Caraka Saṃhitā and the Suśruta Saṃhitā, describe six basic tastes: sweet, sour, salty, pungent, bitter and astringent. They state that the tastes can be combined in 63 ways, and list them by size: 6 single tastes, 15 pairs, 20 groups of three, 15 of four, 6 of five, and 1 of all six.
Those numbers are . Check one: ✓. The total of 63 also follows from the multiplication principle. Each taste is either in a mixture or not: 2 choices, six times over. That gives , and taking away the one "mixture" with no taste at all leaves 63.
The row 1, 6, 15, 20, 15, 6, 1 is one row of a famous triangle of numbers, now often called Pascal's triangle, which was studied in India, China, Persia and Europe. It will appear in the next lecture. There, a question such as "in how many ways can exactly 2 heads come up in 4 coin tosses?" turns out to be a question about . Counting groups is the engine behind the probability of repeated trials.
- When a task has stages, multiply the number of choices at each stage; when a count splits into separate cases, add the cases.
- different objects can be arranged in ways, and because must hold for .
- When order matters, the number of arrangements of objects from is , which is factors counting down from .
- When order does not matter, each selection of objects hides arrangements, so .
- To decide whether order matters, swap two chosen items: a different outcome means arrangements, the same outcome means selections.
- A probability with equally likely selections is the number of favourable selections divided by the number of all selections.