Chapter 6 - COUNTING
Chapter 6 - COUNTING
Chapter 6 - COUNTING
Unit 6
COUNTING
Solution:
Each of the seven bits can be chosen in two ways,
because each bit is either 0 or 1.
Therefore, the product rule shows that there are a total
of 27 = 128 different bit strings of length seven.
Tree Diagrams
Counting problems can be solved using tree diagrams.
A tree consists of:
a root
a number of branches leaving the root
Possible additional branches leaving the endpoints of other
branches.
Example (ii)
Suppose that T- shirts come in five different sizes:
S, M, L, XL, and XXL.
S, M, and L comes in four colors, white, red,
green, and black,
XL comes only in red, green, and black,
XXL comes only in green and black.
How many different shirts does a shop have to
stock to have at least one of each available size and
color of the T- shirt?
Solution
EXAMPLE
Answer: 102
Generalized Pigeonhole Principle
Examples (i)
Among 100 people, there are at least
100 / 12 = 9 born on the same month
Example:
In how many ways we can select 3 students from a
group of 5 students?
In how many different ways they stand in line for
picture?
Permutations
A permutation is an ordered arrangement of the
elements of some set S
Let S = {a, b, c}
c, b, a is a permutation of S
b, c, a is a different permutation of S
The ordered arrangement a, c is a 2-permutation of S (of two
elements only of S)
Permutations
The number of r-permutations of a set with n
elements is denoted by P (n, r)
n!
P(n, r )
(n r )!
Factorial Review
n! is defined as the product of all positive
integers from 1 to n
Examples:
1! = 1*1 = 1
2! = 2*1 = 2
3! = 3*2*1 = 6
4! = 4*3*2*1 = 24
P(n,n) = n! / (n-r)!
= n! / (n-n)!
= n! / 0!
= n! / 1
= n!
Permutations: Examples (i) & (ii)
In how many ways can we select In how many ways can we arrange
3 students from a group of 5 to all 5 of these students in a line?
stand in line?
There are 5 ways to select the 1st
There are 5 ways to select the 1st student
student
4 for 2nd
4 ways to select the 2nd
3 for 3rd
3 ways to select the 3rd
2 for 4th
By the product rule, there are
5 · 4 · 3 = 60 ways to select 3 1 for 5th
students out of a group of 5 Consequently, there are
which is equivalent to 5 · 4 · 3 · 2 · 1 = 120 ways
P(6,6) = 6! = 720
r-combination (Cont’d)
n!
C (n, r )
r!(n r )!
Combinations Examples (i)
How many bit strings of length 10 contain:
Exactly four 1’s?
Find the positions of the four 1’s
Does the order of these positions matter? No!
Eg. positions 2, 3, 5, 7 is the same as positions 7, 5, 3, 2
Thus, the answer is C(10,4) = 210
Solution
Binomial Coefficients
The number of r-combinations form a set with n
elements is often denoted by C (n, r )
n
r
n n
1
0 n
The Binomial Theorem
The Binomial Theorem gives the coefficients of the expansion
of powers of binomial expressions.
n
n
( x y ) n x n j y j
j 0 j
Example (i)
What is the expansion of (x + y)4?
4
4 4 4 4 4 4
( x y ) 4 x 4 j y j x 4 x 3 y x 2 y 2 xy 3 y 4
j 0 j 0 1 2 3 4
Examples (iii)
Pascal’s identity
Let n and k be positive integers with n ≥ k.
Then
n 1 n n
k k 1 k