Title: Permutations and Combinations
1Permutations and Combinations
2Learning Objectives
- What are permutations.
- What are combinations.
- How to calculate binomial coefficients.
- What is the binomial theorem.
- Counting examples.
3Permutations and Combinations
- Urn models
- We are given set of n objects in an urn (dont
ask why its called an urn - probably due to
some statistician years ago) . - We are going to pick (select) r objects from the
urn in sequence. After we choose an object - we can replace it-(selection with replacement)
- or not -(selection without replacement).
- If we choose r objects, how many different
possible sequences of r objects are there? - Does the order of the objects matter or not?
4Permutations and Combinations
- PermutationsSelection without replacement of r
objects from the urn with n objects. - A permutation is an arrangement.
- Order matters .
- After selecting the objects, two different
orderings or arrangements constitute different
permutations.
5Permutations and Combinations
- Choose the first object n ways,
- Choose the second object (since selection is
without replacement) (n - 1) ways, - ...
- Choose the rth object (n - r 1) ways.
- By the rule of product, The number of
permutations of n things taken r at a time - P(n,r) n(n - 1)(n - 2) . . . (n - r 1)
- Note
6Permutations and Combinations
- ExampleLet A and B be finite sets and let A
? B .Count the number of injections from A
to B.Note there are no injections if A gt B
(why?) - There are P( B , A ) injections
- We order the elements of A, a1, a2, . . . and
assume the urn contains the set B. - There are B ways to choose the image of a1,
B - 1 ways to choose the image of a2, and so
forth. - Selection is without replacement. Otherwise we do
not construct an injection.
7Permutations and Combinations
- Combinations
- Selection is without replacement but order does
not matter . - It is equivalent to selecting subsets of size r
from a set of size n. - Divide out the number of arrangements or
permutations of r objects from the set of
permutations of n objects taken r at a time - The number of combinations of n things taken r at
a time
8Permutations and Combinations
- Other names for C(n, r)
- n choose r
- The binomial coefficient
- Example
- How many subsets of size r can be constructed
from a set of n objects? - The answer is clearly C(n, r) since once we
select the objects (without replacement) the
order doesn't matter.
9Permutations and Combinations
- CorollaryProof
- If we count the number of subsets of a set of
size n, we get the cardinality of the power set.
10Permutations and Combinations
- ExampleSuppose you flip a fair coin n times.
How many different ways can you get - no heads? C(n, 0)
- exactly one head? C(n, 1)
- exactly two heads? C(n, 2)
- exactly r heads? C(n, r)
- at least 2 heads? 2 n - C(n, 0) - C(n, 1)
11Permutations and Combinations
- Pascal's IdentityProof
- We construct subsets of size k from a set with n
1 elements given the subsets of size k and k-1
from a set with n elements. - The total will include
- all of the subsets from the set of size n which
do not contain the new element C(n, k), - plus
- the subsets of size k - 1 with the new element
added C(n, k-1).
12Permutations and Combinations
13Permutations and Combinations
- A good way to evaluate C(n, r) for large n and r
(to avoid overflow). -
- ExampleHow many bit strings of length 4 have
exactly 2 ones (or exactly 2 zeros)?
14Permutations and Combinations
- AnalysisWe solve the problem by determining the
positions of the two ones in the bit string. - place the first one - 4 possibilities
- place the second one - 3 possibilities
- Hence it appears that we have (4)(3) 12
possibilities. - We enumerate them to make sure
- 0011, 0101, 1001, 0110, 1010, 1100.
- There are actually only 6 possibilities. What is
wrong?
15Permutations and Combinations
- The answer would be correct if we had two
different objects to place in the string. - For example, if we were going to place an a and
a b in the string we would have00ab, 00ba,
0a0b, 0b0a, a00b, b00a,and so forth for a total
of 12. - But......the objects (1 and 1) are the same so
the order is not important ! - Divide through by the number of orderings 2!
2. Therefore the answer is 12/2 6.
16Permutations and Combinations
- ExampleHow many bit strings of length 4 have at
least 2 ones?AnalysisTotal the number of
strings that have - zero 1s 1
- one 1 4Total 24 - 5 11.
- If the universe is the bit strings of length 4,
what is the complement of the above set? - What is its cardinality?
17Counting Examples
- An office building contains 27 floors and 37
offices on each floor. How many offices are in
the building ? - Answer 27 37 999 (product rule)
18Counting Examples
- How many bit strings are there of length 6 or
less ? - Answer sum rule
- length 1 2
- length 2 4
- length 3 8
- length 4 16
- length 5 32
- length 6 64
- total 2 4 8163264 126
19Counting Examples
- How many strings of four decimal digits
- do not contain the same digit twice
- 10987 5040
- end with an even digit
- 1010105 5000
- have exactly three digits that are 9s
- 94 36
20Counting Examples
- How many different functions are there from a set
with 10 elements to a set with - one element 1
- two elements 2 10
- three elements 3 10
21Counting Examples
- How many bit strings of length seven begin with
three 0s or end with three 1s? - Principle of inclusion-exclusion
- begin with three 0s 2 4 16
- end with three 1s 2 4 16
- intersection 2
- total 16 16 - 2 30
22Pigeon-Hole Principle Examples
- Show that among any group of five (not
necessarily consecutive integers), there are two
with the same remainder when divided by 4. - Pigeon-hole principle with 4 boxes (there are 4
different remainders of division by 4) - 41 5
- in any 5 integers, there are at least two with
the same remainder when divided by 4
23Pigeon-Hole Principle Examples
- Suppose that there are 9 students in a class.
- Show that the class must have at least five male
students or at least five female students. - Generalized pigeon-hole principle 2 boxes,
?9/2? 5 - Show that the class must have at least three male
students or at least seven female students. - Either nb males gt2.
- Or nb males lt 2, and then nb females gt 7.
24Permutation and Combination
- List all permutations of a, b, c
- Permutations of a, b, c are bijections from and
onto this same set. There are 3! 6
permutations. - a, b, c a, c, b b, a, c b, c, a
c, a, b c, b, a
25Permutation and Combination
- A group contains n men and n women. How many ways
are there to arrange these people in a row if the
men and women alternate ?M W M W for M
n ! P(n, n) for W n ! P(n,
n) sub-total n! 2WMWM same n! 2total 2
n! 2
26Permutation and Combination
- In how many ways can a set of five letters be
selected from the English alphabet. - We suppose that letters cannot be repeated
- If the order matters (such as in a word) P(26,
5) 26.25.24.23.22 7893600Example abcdef,
bacdef, ... - If the order does not matter (such as in a
set) C(26,5) P(26,5) / 5! 65780 Example
a, b, c, d, e, f
27Permutation and Combination
- If letters can be repeated
- If the order matters 26 5 11881276
- If the order does not matter more complex
C(26 5 - 1, 5) C(30, 5) 142506 - Number of groups of p objects (not necessarily
different) with repetition taken from a set of m
objects without taking the order into account
C(m p - 1, p)
28Permutation and Combination
- A department contains 10 men and 15 women. How
many ways are there to form a committee with 6
members if it must have more women than men. - Committees are not ordered and no duplicates are
allowed. - 6 women C(15, 6) . C(10,0)
- 5 women C(15,5) . C(10,1)
- 4 women C(15,4) . C(10,2)
- total (sum rule) C(15,6) C(15,5).10
C(15,4).45
29Permutation and Combination
- Give the row of Pascals triangle immediately
following 1 7 21 35 35 21 7 11 11 2
11 3 3 11 4 6 4 11 5 10 10 5
11 6 15 20 15 6 11 7 21 35 35 21 7
1 1 8 28 56 70 56 28 8 1
30Permutation and Combination
- Develop (x y) 8 (x y)8 x8 8 x7 y 28
x6 y2 56 x5 y3 70 x4 y4 56 x3 y5 28 x2
y6 8 x y7 y8