Chapter 1
Chapter 1
Example 1.1: There are 18 mathematics students and 325 computer science students at a college. How
many ways are there to pick one representative who is either mathematics major or a computer science
major?
Solution: Let 𝐴 be the task, choosing a member of the mathematics major, can be done in 18 ways. Let 𝐵 be
the task, choosing a computer major, can be done in 325 ways. From the sum (addition) rule, it follows that
there are 18 + 325 = 343 possible ways to pick these representatives.
Example 1.2 A freshman has selected four courses and needs one more course for the next term. There are
15 courses in English, 10 in French and 6 in German. She is eligible to task. In how many ways can she
choose the fifth course?
Solution: Let 𝐸 be the task of selecting a course in English, 𝐹 be the task of selecting a course in French and
𝐺 that of selecting a course in German. These tasks can be done in 15,10 and 6 ways, respectively, and are
mutually exclusive, so by addition principle, the fifth course can be selected in |𝐸| + |𝐹| + |𝐺| = 15 + 10 +
6 = 31 ways.
Example 1.3: A student can choose a computer project from one of three lists. The three lists contain 23,15
and 19 possible projects, respectively. How many possible projects are there to choose from?
Solution: Let 𝐴, 𝐵 𝑎𝑛𝑑 𝐶 be the first, second and third lists respectively. And the list can be done 23, 15 and
19 ways respectively. Hence there are 23+15+19=57 projects to choose from.
1.2 The inclusion-exclusion principles
Theorem 1.2 (Inclusion-exclusion principle)
Suppose a task 𝐴 can be done in 𝑚 ways, task 𝐵 in 𝑛 ways and both can be accomplished in 𝑘 different ways.
Then task 𝐴 𝑜𝑟 𝐵 can be done in 𝑚 + 𝑛 − 𝑘 . We can phrase this counting principle in terms of sets. Let
𝐴 𝑎𝑛𝑑 𝐵 be two finite sets. Then |𝐴 ∪ 𝐵| = |𝐴| + |𝐵| − |𝐴 ∩ 𝐵|
Example 1.4: Find the number of positive integers ≤ 300 and divisible by 2 or 3.
Solution: Let 𝐴 = {𝑥 ∈ ℕ: 𝑥 ≤ 300 𝑎𝑛𝑑 𝑑𝑖𝑣𝑖𝑠𝑖𝑏𝑙𝑒 𝑏𝑦 2}
𝐵 = {𝑥 ∈ ℕ: 𝑥 ≤ 300 𝑎𝑛𝑑 𝑑𝑖𝑣𝑖𝑠𝑖𝑏𝑙𝑒 𝑏𝑦 3}
Then 𝐴 ∩ 𝐵 consists of positive integers ≤ 300 that are divisible by 2 and 3. That is, divisible by 6. Thus,
𝐴 = {2,4, … ,300} 𝐵 = {3,6, … ,300} and 𝐴 ∩ 𝐵 = {6,12, … ,300}.
Clearly, |𝐴| = 150, |𝐵| = 100 𝑎𝑛𝑑 |𝐴 ∩ 𝐵| = 50 . By theorem 1.2,
|𝐴 ∪ 𝐵| = |𝐴| + |𝐵| − |𝐴 ∩ 𝐵| = 150 + 100 − 50 = 200
1
Thus, there are 200 positive integers ≤ 300 and divisible by 2 or 3.
Corollary 1.3: Let 𝐴, 𝐵 𝑎𝑛𝑑 𝐶 be three finite sets. Then
|𝐴 ∪ 𝐵 ∪ 𝐶| = |𝐴| + |𝐵| + |𝐶| − |𝐴 ∩ 𝐵| − |𝐴 ∩ 𝐶| − |𝐵 ∩ 𝐶| + |𝐴 ∩ 𝐵 ∩ 𝐶|
Proof: |𝐴 ∪ 𝐵 ∪ 𝐶| = |𝐴 ∪ (𝐵 ∪ 𝐶)|
= |𝐴| + |𝐵 ∪ 𝐶| − |𝐴 ∩ (𝐵 ∪ 𝐶)| (By theorem 1.2)
= |𝐴| + [|𝐵| + |𝐶| − |𝐵 ∩ 𝐶|] − [|𝐴 ∩ 𝐵| ∪ |𝐴 ∩ 𝐶|]
= |𝐴| + |𝐵| + |𝐶| − |𝐵 ∩ 𝐶| − [|𝐴 ∩ 𝐵| + |𝐴 ∩ 𝐶| − |(𝐴 ∩ 𝐵) ∩ (𝐴 ∩ 𝐶)|]
= |𝐴| + |𝐵| + |𝐶| − |𝐵 ∩ 𝐶| − |𝐴 ∩ 𝐵| − |𝐴 ∩ 𝐶| + |𝐴 ∩ 𝐵 ∩ 𝐶|
Example 1.6: Find the number of positive integers ≤ 2076 and divisible by 3, 5 or 7.
Solution: Let 𝐴, 𝐵 𝑎𝑛𝑑 𝐶 denote the sets of positive integers ≤ 2076 and divisible by 3, 5 and 7, respectively,
by the corollary 1.3
|𝐴 ∪ 𝐵 ∪ 𝐶| = |𝐴| + |𝐵| + |𝐶| − |𝐴 ∩ 𝐵| − |𝐴 ∩ 𝐶| − |𝐵 ∩ 𝐶| + |𝐴 ∩ 𝐵 ∩ 𝐶|
2076 2076 2076 2076 2076 2076 2076
= + + − − − +
3 5 7 15 21 35 105
Example 1.8 How many distinct phone numbers are there if we assume that a phone number is made of 6
digits with the first digit begin neither from 0 nor 1?
Example 1.9 In how many ways can the letters of the word ‘CAR’ be reordered to produce distinct ‘words’.
Solution: We have 3 possibilities for the first letter, 2 possibilities for the 2 nd letter and have to use the
remaining letter. So, there are 3 × 2 × 1 = 6 distinct ‘words’.
Theorem 1.4 (Multiplication principle)
Suppose a task 𝑇 is made up of two subtasks. Subtask 𝑇1 followed by subtask 𝑇2 . If subtask 𝑇1 can be done
in 𝑚 1 ways and subtask 𝑇2 in 𝑚 2 different way for each way subtask 𝑇1 can be done, then task 𝑇 can be done
in 𝑚1 𝑚2 ways.
Example 1.10 Find the number of two letter words that being with a vowel a,e,i,o or u.
2
Solution: The task of forming a two-letter word consists of two subtasks 𝑇1 𝑎𝑛𝑑 𝑇2 , 𝑇1 consisting of the first
letter and 𝑇2 selecting the second letter; as figure 1.3 shows
Number of choices
? ?
Subtask 𝑇1 Subtask 𝑇2
Figure 1.3
Since each word must begin with a vowel, 𝑇1 can be accomplished in five ways. There is no restriction on the
choice of the 2nd letter, so 𝑇2 can be done in 26 ways (figure 1.4).
Number of choices
5 26
Subtask 𝑇1 Subtask 𝑇2
Figure1. 4
Therefore, by the multiplication principle the task can be performed in
5 × 26 = 130 different ways. In other words, 130 two letter words begin with a vowel.
The multiplication principle can also be extended to any finite number of subtasks. Suppose a task 𝑇 can be
done by n successive subtasks, 𝑇1 , 𝑇2 , … , 𝑇𝑛 . If subtask 𝑇𝑖 can be done in 𝑚𝑖 different ways after𝑇𝑖−1 has been
completed, where 1 ≤ 𝑖 ≤ 𝑛, then task 𝑇 can be done in 𝑚1 × 𝑚2 × 𝑚3 × … × 𝑚𝑛 ways.
Example. How many distinct phone numbers are there if we assume that a phone number is made of 6 digits
with the first digit begin different from 0 and 1?
Solution: Assume that 𝑎1 be the first digit, 𝑎2 be the second digits, 𝑎3 , 𝑎4, 𝑎5, 𝑎6 be the 3rd , 4th ,5th and 6th
digit respectively. But 𝑎1 ≠ 0 𝑎𝑛𝑑 1. So we have 8 possible choice of 𝑎1 and we have 10 possible choices for
the digit 𝑎2 to 𝑎6 .
Therefore, 8 × 105 = 800,000 distinct phone number.
Example. In how many ways can the letters of the word ‘CAR’ be reordered to produce distinct ‘words’.
Solution: We have 3 possibilities for the first letter, 2 possibilities for the 2 nd letter and have to use the
remaining letter. So, there are 3 × 2 × 1 = 6 distinct ‘words’.
𝑎𝑎 𝑎𝑏 𝑎𝑐 𝑎𝑑
𝑏𝑎 𝑏𝑏 𝑏𝑐 𝑏𝑑
3
i.Permutations with 𝑐𝑎 𝑐𝑏 𝑐𝑐 𝑐𝑑 repetitions. The order
of listing the letters 𝑑𝑎 𝑑𝑏 𝑑𝑐 𝑑𝑑 is important, and
repetition is allowed. In this case
there are 4 ·4 = 16 possible selections:
ii.Permutations without repetitions. The order of listing the letters is important, and
repetition is not allowed. In this case there are 4 ·3 = 12 possible selections:
𝑎𝑏 𝑎𝑐 𝑎𝑑
𝑏𝑎 𝑏𝑐 𝑏𝑑
iii.Combinations with repetitions. The
𝑐𝑎 𝑐𝑏 𝑐𝑑
order of listing the letters is not
important, and 𝑑𝑎 𝑑𝑏 𝑑𝑐 repetition is allowed.
In this case there are
4 ·3
+ 4 = 10 possible selections:
2
𝑎𝑎 𝑎𝑏 𝑎𝑐 𝑎𝑑
𝑏𝑏 𝑏𝑐 𝑏𝑑
𝑐𝑐 𝑐𝑑
𝑑𝑑
iv. Combinations without repetitions. The order of listing the letters is not important, and
repetition is not allowed. In this case there are.
𝑎𝑏 𝑎𝑐 𝑎𝑑
4
4 ·3
= 6 Possible selections: 𝑏𝑐 𝑏𝑑
2
𝑐𝑑
Example 1.15 Eight runners take part in a race. How many different of ways of allocating
medals (gold, silver and bronze) are there?
5
Solution: We choose 𝑟 = 3 medalists from the 𝑛 = 8 runners (the order doesn’tb matter). The
number of 3 −permutation of 8 runners is 8 × 7 × 6 = 336 ways the medals can be handed
out, thus, 𝑝(8,3) = 336.
If we went to choose only 𝑟 ≤ 𝑛 of the n objects and retain the order in which we choose the
object the there are 𝑝(𝑛, 𝑟) = 𝑛(𝑛 − 1)(𝑛 − 2) … (𝑛 − 𝑟 + 1) different ways of doing so.
Theorem 1.5: The number of 𝑟 −permutation of a set of 𝑛 (distinict) elements is given by
𝒏!
𝑝(𝑛, 𝑟) = (𝒏−𝒓)!
Example 1.16 How many ways are there to select a first-prize winner, a second-prize winner
and a third-prize winner, from 100 different people who have entered contest?
Solution: The number of ways to pick the three prize winner (1st , 2nd and 3rd ) is the number of
ordered selections of three elements from a set of 100 elements, that is the 3 −permutations of
a set of 100 elements.
(100)! (100)! 100×99×98×97!
𝑝(100,3) = (100−3)! = = = 100 × 99 × 98 = 970,200
(97)! (97)!
Example 1.17: Find the number of words that can be formed by scrambling the letter of the
word SCRAMBLE (remember, a word is just an arrangement of symbols, it need not make
sense )?
Solution: The word SCRAMBLE contains eight distinct letters. Therefore, the number of
words that can be formed equals. The number of arrangement of the letters in the word, namely
𝑝(8,8) = 8! = 8 × 7 × 6 × 5 × 4 × 3 × 2 × 1 = 40,320
Combinations
Definition 1.2: An 𝑟 −combination of elements of a set, where 0 ≤ 𝑟 ≤ 𝑛 , is an unordered
selection of 𝑟 elements from the set. Thus, an 𝑟 −combination is simply a subset of the set with
𝑟 −elements. The number of 𝑟 −combinations of a set with 𝑛 elements is denoted
𝑛
by 𝐶(𝑛, 𝑟)𝑜𝑟 ( ). Both notations frequently appear in combinatorics. The number of
𝑟
combination is also called the binomial coefficient.
Example 1.18: Find the number of 𝑟 −combinations of the set {𝑎, 𝑏, 𝑐} when 𝑟 = 2 𝑜𝑟 3
Theorem 1.6: The number of 𝑟 −combinatios of a set with n elements, where 𝑛 is a nonnegative integer
and 𝑟 is an integer with 0 ≤ 𝑟 ≤ 𝑛 equals
𝑛!
𝐶(𝑛, 𝑟) =
(𝑛−𝑟)!𝑟!
Proof: By definition, there are 𝐶(𝑛, 𝑟), 𝑟 − combinations of a set of 𝑛 −elements, Each combination contains
𝑟 −elements and contributes 𝑝(𝑟, 𝑟) = 𝑟!;
𝑟 −permutation, so, the total number of 𝑟 −permutation is 𝑟! 𝐶(𝑛, 𝑟). But by
6
𝑛!
definition, there are 𝑝(𝑛, 𝑟) = 𝑟 −permutations. Therefore,
(𝑛−𝑟)!
𝑛!
𝑟! 𝐶(𝑛, 𝑟) = That
(𝑛−𝑟)!
𝑛!
is, 𝐶(𝑛, 𝑟) =
(𝑛−𝑟)!𝑟!
Note:
𝑛!
1. 𝐶(𝑛, 0) = 0!(𝑛−0)! = 1, that is, the number of 0 −combinations of a set with n
elements is one.
𝑛!
2. 𝐶(𝑛, 𝑛) = 𝑛!(𝑛−𝑛)! = 1, that is, the number of 𝑛 −combinations of a set with 𝑛
Example 1.21 Find the number of bytes contain exactly three 0’s
Solution:
𝑛𝑢𝑚𝑏𝑒𝑟 𝑜𝑓 𝑏𝑦𝑡𝑒𝑠 𝑛𝑢𝑚𝑏𝑒𝑟 𝑜𝑓 𝑏𝑦𝑡𝑒𝑠 𝑐𝑜𝑛𝑡𝑎𝑛𝑖𝑛𝑔 𝑡ℎ𝑟𝑒𝑒 0′ 𝑠
( )=( )
𝑐𝑜𝑛𝑡𝑎𝑖𝑛𝑔 𝑒𝑥𝑎𝑐𝑡𝑙𝑦 𝑡ℎ𝑟𝑒𝑒 0′ 𝑠 𝑎𝑛𝑑 𝑓𝑖𝑣𝑒 1′ 𝑠
7
= 56
Example 1.22. Find the number of different arrangement of the letter of the word REFERENCE.
Solution: The word REFERENCE contain nine letters; two R’s and four E’s, the remaining letters are
9!
distinct, now by theorem 1.9, the total number of words are = 7560.
2!4!
Theorem 1.10: The number of 𝑟 −combinations with repetition from a set of 𝑛 elements is
𝐶(𝑛 + 𝑟 − 1, 𝑟).
Proof: Each 𝑟 −combination with repeated elements from a set of 𝑛 elements can be considered a string of
𝑟 𝑥′𝑠 and (𝑛 − 1) slashes (that means, for instance if 𝑛 = 3 𝑥𝑥 ∕ 𝑥𝑥 ∕ 𝑥𝑥 indicates that two elements select
1st task, two select 2nd and two select 3rd task) each strings contains 𝑛 + 𝑟 − 1 symboles,of which 𝑟 are alike
(𝑥’𝑠) and 𝑛 − 1 are alike (slashes).Therefore by theorem 1.9,the number of such strings, that is r-
combination equals
(𝑛+𝑟−1)! 𝑛+𝑟−1
= 𝐶(𝑛 + 𝑟 − 1, 𝑟) = ( )
𝑟!(𝑛−1)! 𝑟
Example 1.24. Suppose that a cookie shop has four different kinds of cooking. How many different ways can
six cookies be chosen? Assume that only the types of cookie are not the individual cookies or the order in
which they are chosen matter
Solution: The number of ways to chose six cookies is the number of 6-combinations of a set with four
elements. From theorem 1.10, this equals
𝐶(4 + 6 − 1,6) = 𝐶(9,6). Since
9! 9! 9×8×7×6!
𝐶(9,6) = 𝐶(9,3) = = = = 84
(9−3)!3! 6!3! 3×2×1×6!
Retaining order 𝑛! 𝑛𝑟
𝑝(𝑛, 𝑟) =
(𝑛 − 𝑟)!
8
𝑛 𝑛+𝑟−1
Not retaining 𝐶(𝑛, 𝑟) = ( ) ( )
𝑟 𝑟
𝑛! (𝑛 + 𝑟 − 1)!
order = =
(𝑛 − 𝑟)! 𝑟! 𝑟! (𝑛 − 1)!
10