Professional Documents
Culture Documents
Counting Techniques: Mathematics Learning Centre
Counting Techniques: Mathematics Learning Centre
Learning Centre
COUNTING TECHNIQUES
Counting Techniques
Sue Gordon
1994
c University of Sydney
Acknowledgements
I gratefully acknowledge the many ideas and suggestions provided by Mary Barnes. I
would like to thank Jackie Nicholas and Chris Thomas for proof reading the text and
Jackie Nicholas for LATEXing this edition.
Sue Gordon
Contents
1 Introduction 1
1.1 How to use this book . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.2 Assumed knowledge . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.3 Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
3 Factorial notation 3
3.1 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
4 Permutations 4
4.1 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
5 Combinations 6
5.1 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
6 Binomial coefficients 9
6.1 The binomial theorem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
6.2 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
7 Review problems 11
1 Introduction
Calculations in probability theory often involve working out the number of different ways
in which something can happen. Since simply listing the ways can be very tedious (and
often unreliable), it is helpful to work out some techniques for doing this kind of counting.
You will not gain much by just reading this book. Have pencil and paper ready to try
to work through the examples before reading their solutions. Do all the exercises. It is
important that you try hard to complete the exercises on your own, rather than refer to
the solutions as soon as you are stuck.
You will need to use a calculator for the exercises. Cancel manually as much as possible
to avoid multiplying a large series of numbers by calculator.
13
29. 28.
30. 27.
25. 24.
26. 23
= 29.27.13.25.23 = 5852925.
8.
7.
6.
5.
4.
3.
2. 1
1.3 Objectives
By the time you have worked through this unit you should
• be able to calculate the number of ways in which an event can take place when the
event has two or more stages, each having a number of choices,
• know the difference between permutations and combinations and be able to solve
problems involving these,
1 3
B
4
A C
2 5
Let’s count the number of different routes we can take in travelling from A to C. This
will be easier to do if we number the roads as shown above.
We have two choices of route from A to B. Whichever of these we choose, when we reach
B we have three choices of route from B to C. So the total number of routes from A to C
is 2 × 3. We can list them:
Now let’s try to find the number of routes from A to C if there are 3 roads from A to
B and 4 from B to C. (Try drawing a diagram, number the roads, and then listing the
routes systematically.)
Solution
There are 3 choices of route from A to B. For each of these, there are 4 choices from B to
C. So there are 3 × 4 = 12 choices of route from A to C.
Finally, suppose there are 3 roads from A to B, 4 roads from B to C and 3 roads from C
to another town, D. How many possible routes are there?
Solution
As above, there are 12 choices of route from A to C. For each of these, there are 3 choices
from C to D. So there are 12 × 3 (ie 3 × 4 × 3) choices of route from A to D. (If you are at
all unsure about this, draw a diagram, number the different routes, and list all the routes
in a systematic way.)
These examples illustrate the basic counting principle which we can express informally
as:
2.1 Exercises
1. The local newsagent has gift wrapping paper and ribbon on sale. The paper comes in
green, blue, purple and white, and the ribbon in red and gold. If you buy one package
of paper and one of ribbon, how many different colour combinations can you choose?
2. Sam is buying fruit trees for his garden. He plans to plant one peach, one apple,
one plum and one cherry tree. The nursery recommends two varieties of peach, four
of apple, six of plum and three of cherry for his area. How many possible different
groups of trees could he plant? If Sam has already decided on the cherry, how many
choices are left for the other trees?
3. A New South Wales netball team plays teams from the other states in the competition
so that they play four matches each month. Each match has three possible results
for the NSW team — win, lose or draw. How many different sequences of results are
possible in a month for NSW.
3 Factorial notation
Many counting problems involve multiplying together long strings of numbers. Factorial
notation is simply a short hand way of writing down some of these products.
6! = 6 × 5 × 4 × 3 × 2 × 1 = 720
3! = 3 × 2 × 1 = 6
1! = 1
We also define 0! to be 1.
Note: Many people think that 0! ought to be 0, but this would give rise to problems of
dividing by 0. We shall see that the formulae we’ll be deriving make more sense if 0! = 1.
3.1 Exercises
1. Evaluate
7!
a.
5! 3!
15!
b. .
9! 6!
2. Use a calculator to evaluate
a. 9!
b. 32! (What does the calculator representation of this very large number mean?)
4 Permutations
The word ‘permutations’ means ‘arrangements’. We use it to refer to the number of ways
of arranging a set of objects. In other words, we use permutations when we are concerned
about ‘order’.
Try to work out each of the following examples for yourself before reading the solutions.
Example
How many different 4 letter arrangements can we make of the letters in the word ‘cats’,
using each letter once only.
Solution
We have four positions to fill.
There are four choices for position 1. For each of those choices there are 3 letters left, and
so 3 ways to fill position 2. So by the counting principle there are 4 × 3 ways of filling the
first 2 positions. For each of these choices there are now 2 letters left and there are two
ways of filling the third position. The remaining letter must then go in the last position.
Thus by the counting principle, there are 4 × 3 × 2 × 1 = 4! possible arrangements, ie 24
of them. Try writing them out as a check.
Example
How many ways can the numbers 7, 8 and 9 be arranged using each number once? Write
out all the permutations of 7, 8 and 9 to check that your answer is correct.
Solution
Mathematics Learning Centre, University of Sydney 5
Example
How many 3 letter ‘words’ can be made using the letters a, b, c, d, e, and f if each letter
can be used at most once?
Solution
The first box can be filled in 6 ways, the second in 5 ways and the third in 4 ways, ie the
number of permutations of 6 letters taken 3 at a time is 6 × 5 × 4.
If we wish the use the convenient factorial notation, multiply top and bottom by 3 × 2 × 1
to get
6×5×4×3×2×1 6!
= .
3×2×1 3!
Example
How many 3 digit numbers can be made from the digits 1, 2, · · ·, 9, if each can be used
once? How may 7 digit numbers can be made? Express your answers in factorial notation.
Solution
9!
The number of 3 digit numbers is 9 × 8 × 7 = .
6!
9!
The number of 7 digit numbers is 9 × 8 × 7 × 6 × 5 × 4 × 3 = .
2!
Now let’s work out a general formula for the number of arrangements of n different objects
taken r at a time.
Here there are r boxes to fill.
The first can be filled in n ways.
The second can be filled in (n − 1) ways.
The third can be filled in (n − 2) ways.
···
The rth box can be filled in n − (r − 1) = (n − r + 1) ways.
So the total number of arrangements is
n(n − 1)(n − 2) · · · (n − r + 1)(n − r) · · · 2.1 n!
n(n − 1)(n − 2) · · · (n − r + 1) = = .
(n − r)(n − r − 1) · · · 2.1 (n − r)!
Here we multiplied top and bottom by (n − r)(n − r − 1) · · · 2.1.
We denote this as n Pr .
Mathematics Learning Centre, University of Sydney 6
4.1 Exercises
20
1. Write in factorial notation P5 , 7 P2 .
2. Evaluate 6 P4 , 6 P2 .
3. How many different signals can be sent by displaying three flags on a mast if there
are six different flags available?
5. Does your calculator have a key n Pr ? If so use it to check your answers to Question
2.
5 Combinations
Combinations is a technical term meaning ‘selections’. We use it to refer to the number
of different sets of a certain size that can be selected from a larger collection of objects
where order does not matter.
Example
How many committees of two people can be chosen from this group of four people:
Solution
There are two committee members to be chosen so we have two places to fill.
There are 4 ways of choosing the first member and 3 ways of choosing the second. Thus
it would seem at a first glance that there are 12 ways to choose the committee — let us
list them:
However, when we look more closely at this list we notice that only 6 of these form
different committees. Jones and Harris, for example, make up the same committee as
Harris and Jones. The order in which people are chosen does not matter. To obtain the
correct answer we cannot just find
4!
4
P2 = = 4 × 3 = 12
2!
but must also divide by the number of ways the committee can be arranged, ie 2!, giving
the answer 6.
Example
How many distinct sets of 3 differently coloured scarves can be bought if the shop has
scarves in 8 different colours?
Solution
There are 8 different colours of scarves available, so the first scarf can be chosen in any
one of these 8 colours, that is, in 8 different ways. Since the scarves selected are all to be
in different colours, once the first scarf is chosen, there are 7 ways of choosing the colour
of the second scarf, and corresponding to each of these, 6 ways of choosing the third.
8!
Thus it appears there are 8 × 7 × 6 ways of choosing scarves in 3 different colours, ie .
5!
However these sets of 3 will not all be distinct. Suppose that a red scarf is selected first,
then a blue and then a white. This will result in the same set of scarves as if a white were
chosen first, then a blue and then a red. In fact, since a set of 3 colours can be arranged
in 3 × 2 × 1 = 3! different ways, there will be 3! different choices which will result in the
same set of scarves. Hence we must divide the number obtained by 3!. So the answer to
our problem is
8! 8×7×6
= .
3! 5! 3×2×1
Now, once again, let’s work out a general formula. This time we want the number of ways
of choosing r objects from n distinct objects when the order in which the objects are
chosen does not matter. Any two selections containing the same r objects are considered
to be the same.
⎛ ⎞
⎜ n ⎟
We will denote this by n Cr or ⎝ ⎠ read as ‘n choose r’.
r
The number of ways of choosing an ordered set of r objects out of n is equal to the
number of ways of choosing an unordered set of r objects out of n times the number of
ways of arranging r objects in order.
That is,
n
Pr = n Cr × r!
no. of ordered selections = no. of unordered selections × no. of ways of arranging them.
n
n
Pr n! n(n − 1)(n − 2) · · · (n − r + 1)
Cr = = = .
r! r!(n − r)! r(r − 1)(r − 2) · · · 2.1
(Note: there are r factors in both the top and bottom of this fraction.)
Going back to the previous two examples, we can now write them in this notation.
4 4! 4×3
C2 = = = 6.
2! 2! 2×1
8 8! 8×7×6
C3 = = = 56.
5! 3! 3×2×1
5.1 Exercises
9
C5
2. Evaluate 9C
.
6
4. Find the key for n Cr on your calculator. Use it to check your answers to questions 1
and 2.
6. In how many ways can twelve pieces of fruit be divided into two baskets containing
five and seven pieces of fruit respectively?
6 Binomial coefficients
Let’s consider the expansion of (x + a)n for n = 0, 1, 2, 3, 4 · · · .
(x + a)0 = 1
(x + a)1 = x+a
(x + a)2 = x2 + 2ax + a2
(x + a)3 = x3 + 3x2 a + 3xa2 + a3
(x + a)4 = x4 + 4x3 a + 6x2 a2 + 4xa3 + a4
(x + a)5 = x5 + 5x4 a + 10x3 a2 + 10x2 a3 + 5xa4 + a5
We notice the following properties.
1. For each term, the exponents of x and a add up to n. For example, in the expansion
(x + a)5 , the powers of x and a always add to 5.
2. If we write dowm just the coefficient of each term in the expansion above , we obtain
the triangle known as Pascal’s triangle.
(x + a)0 1
(x + a)1 1 1
(x + a)2 1 2 1
(x + a)3 1 3 3 1
(x + a)4 1 4 6 4 1
(x + a)5 1 5 10 10 5 1
and so on.
It can be seen that each coefficient in the triangle can be obtained by adding the two
numbers directly above it, eg 1 + 4 = 5, 6 + 4 = 10.
Let’s look more closely at how these coefficients are obtained. Consider
(x + a)2 = (x + a)(x + a)
= x2 + xa + ax + a2 .
Notice that there are two ways of obtaining a term in x: by choosing ‘x’ from the first
bracket and ‘a’ from the second, and by choosing ‘a’ from the first bracket and ‘x’ from
the second. Hence the coefficient of ax in the expansion of (x + a)2 is 2 C1 = 2, the number
of ways of choosing one ‘x’ from two brackets.
Now look at
We see that the terms involving x2 are: x2 a, xax and ax2 which when added together
give 3x2 a.
We can explain this by observing that, to obtain the coefficient of x2 a, we are finding the
number of ways of selecting two x’s and one a from the three brackets (x+a)(x+a)(x+a).
So we are selecting two x’s from the three brackets in every possible way, and taking an
‘a’ from the remaining bracket.
The number of ways of selecting two ‘x’s from three brackets is
3 3!
C2 = = 3.
2! 1!
Hence the coefficient of x2 a is 3.
Similarly, the number of ways of choosing one ‘x’ from (x + a)(x + a)(x + a) is 3 C1 = 3.
Hence the coefficient of xa2 is 3.
In general, the number of ways of choosing r ‘x’s (and so automatically n − r ‘a’s) from
n brackets (x + a)(x + a) · · · (x + a) is n Cr .
The coefficient of xr an−r in the expansion of (x + a)n is therefore n Cr . For this reason the
expression n Cr is called the binomial coefficient.
Example
Find the coefficients of x3 a2 , x4 a, and x5 in the expansion of (x + a)5 .
Solution
The coefficient of x3 a2 is 5 C3 = 10.
The coefficient of x4 a is 5 C4 = 5.
The coefficient of x5 is 5 C1 = 1.
We can check that these are correct by expanding (x + a)5 . Compare also with the fifth
row of Pascal’s triangle.
Notes
1. One way of proving the binomial theorem is by mathematical induction. If you are
interested refer to the Mathematics Learning Centre’s publication: Mathematical
Induction.
2. If you are familiar with Σ notation, the theorem can be expressed more compactly
as: n
(x + a)n = n
Cr xr an−r .
r=0
Mathematics Learning Centre, University of Sydney 11
6.2 Exercises
1. Use the binomial theorem to expand (x + a)3 and (x + a)4 .
7 Review problems
Try these problems. It will help you if you attempt to do them on your own rather than
just following the solutions. Use them as a way of assessing how well you have understood
the material in this book.
1. Eight birds are to be placed in eight different cages. How many arrangements are
possible if each bird is placed in a separate cage.
3. a. How many committees of 4 people can be chosen from 5 men and 3 women?
b. How many of these could be all men?
c. How many would consist of 2 men and 2 women?
4. Find n if n P2 = 56.
5. a. How many arrangement of the letters in the word ‘success’ are there?
b. How many of these begin with an ‘s’ ?
2. There are 2 × 4 × 6 × 3 different groups of trees, ie 144 groups. If the cherry has
already been chosen, there are 48 ways of choosing the other varieties.
3. There are three possible results for the first match and, for each of these, three results
for the second. Hence for two matches, there are 32 possible results. Continuing in
this way we see that there are 34 = 81 different sequences possible for the month.
2. a. 362 880
b. 2.631308369 × 1035
3. 69! is the largest factorial my calculator will evaluate. You may get a different answer
depending on the type of calculator you have.
4.
4. Any question along the lines of “How many ways are there of choosing 2 objects from
7 when order does matter”. For example, How many ways are there of choosing a
first and middle name for a baby out of 7 possible names? Or, How many ways are
there of making up two letter ‘words’ from the letters a, b, c, d, e, f and g using each
letter once only?
5.
m m!
6. a. Pr =
(m − r)!
n!
b. n Pk =
(n − k)!
n n! n!
c. Pn−k = =
[n − (n − k)]! k!
t t!
C4 =
(t − 4)!4!
t(t − 1)(t − 2)(t − 3)(t − 4)!
=
(t − 4)!4!
t(t − 1)(t − 2)(t − 3)
=
4.3.2.1
b. Numerator is 7.6 · · · (7 − t + 1) as
7 7!
Ct =
(7 − t)!t!
7.6 · · · (7 − t + 1)(7 − t)!
=
(7 − t)!t!
7.6 · · · (7 − t + 1)
=
t(t − 1) · · · 1
4.
Mathematics Learning Centre, University of Sydney 14
n n!
5. Cr =
(n − r)! r!
n n! n!
Cn−r = =
[n − (n − r)]!(n − r)! r!(n − r)!
n n
Notice that Cr is the same as Cn−r .
7. Any question is acceptable where you are asked to choose 2 items from 7 items. For
example, how many ways are there of choosing 2 chocolates from a box containing 7
different types of chocolate?
5.
1 1 1 1 1
(x − )4 = x4 + 4x3 (− ) + 6x2 (− )2 + 4x(− )3 + (− )4
2 2 2 2 2
3 2 1 1
= x − 2x + x − x + .
4 3
2 2 16
6! 6.5.4.3.2!
2. a. 6 P4 = = = 360
2! 2!
10! 10.9.8!
b. 10 C8 = = = 45
2! 8! 2.1 8!
26! 10! 26.25.24.23! 10.9.8.7!
c. 26 P3 ×10 P3 = × = × = 11232000
23! 7! 23! 7!
44! 44.43.42.41.39.38!
d. 44 C6 = = = 7059052.
38! 6! 38! 6.5.4.3.2.1
8! 8.7.6.5.4!
3. a. 8 C4 = = = 70
4! 4! 4.3.2.1.4!
5!
b. 5 C4 = =5
1! 4!
5! 3!
c. 5 C2 ×3 C2 = × = 30.
3! 2! 1! 2!
n!
4. n
P2 = = 56, so n! = 56(n − 2)!.
(n − 2)!
ie n(n − 1)(n − 2)! = 56(n − 2)!, so n2 − n = 56.
That is, n2 − n − 56 = 0 therefore (n − 8)(n + 7) = 0, so n = 8 (as n > 2).
5. a. There are 7 letters in ‘success’ so at first glance there are 7! arrangements. How-
ever, interchanging the 3 ‘s’s will not affect the arrangement and neither will
7! 7.6.5.4.3!
interchanging the two ‘c’s. Thus there are = = 420 arrangements.
3! 2! 3! 2.1
6!
b. There are 6 letters left after placing the first ‘s’. Thus there are ways of
2! 2!
arranging the other letter, as we divide by the number of ‘c’s and the two remaining
6!
‘s’s. Therefore the number of ways = = 180.
2! 2!
11 11! 11!
6. Cr = and 11 Cr−1 = .
(11 − r)! r! (11 − [r − 1])! (r − 1)!
11! 3.11!
Now = ,
(11 − r)! r! (12 − r)! (r − 1)!
(12 − r)! 3.r!
ie = dividing both sides by 11! and cross multiplying,
(11 − r)! (r − 1)!
(12 − r)(11 − r)! 3r(r − 1)!
ie = .
(11 − r)! (r − 1)!
[Note: (12 − r)! = (12 − r)(12 − r − 1)! = (12 − r)(11 − r)!]
So, 12 − r = 3r, ie r = 3.
You should check that 11
C3 = 3 ×11 C2 .
20 −1 8
7. The term in x4 is C12 (3x)12 ( ).
2x
20 1
So of the coefficient of x8 is C12 (3)12 (− )8 = 261506338.9. (Your calculator may
2
round this off to 2.61506 × 108 .)
Mathematics Learning Centre
T +61 2 9351 4061
F +61 2 9351 5797
E mlc.enquiries@sydney.edu.au
sydney.edu.au/mlc
Mathematics
Learning Centre