Counting (Enumerative Combinatorics)
- X. Zhang, Fordham Univ.
1
Counting ( Enumerative Combinatorics) X. Zhang, Fordham Univ. 1 - - PowerPoint PPT Presentation
Counting ( Enumerative Combinatorics) X. Zhang, Fordham Univ. 1 Chance of winning ? Whats the chances of winning New York Mega- million Jackpot just pick 5 numbers from 1 to 56, plus a mega ball number from 1 to 46, then
1
2
“just pick 5 numbers from 1 to 56, plus a mega ball
If your 6-number combination matches winning 6-number
There are many possible ways to choose 6-number Only one of them is the winning combination… If each 6-number combination is equally likely to be
Then the prob. of winning for any 6-number is 1/X
How many bits are need to represent 26 different
3
4
How many ways are there to select an English
26 as there are 26 English letters
How many three digits integers are there ?
These are integers that have value ranging from 100 to
How many integers are there from 100 to 999 ?
999-100+1=900
5
6
So the number of integers between two integers, S
How many integers are there in the range 123 to 928
7
3 letters followed by 4 digits (repetition allowed)
8
Count in a systematical way to avoid double-counting
Ex: to count num. of students present …
First count students on first row, second row, … First count girls, then count boys
9
Count in a systematical way to avoid double-counting
Ex: to buy a pair of jeans …
Styles available: standard fit, loose fit, boot fit and slim fit Colors available: blue, black How many ways can you select a pair of jeans ?
10
Table is a nature solution
3D table ?
11
style color color color color Node: a feature/variable Branch: a possible selection for the feature Leaf: a configuration/combination
12
Enumerate all 3-letter words formed using
assuming each letter is used once.
How would you do that ?
Choose a letter to put in 1st position, 2nd and 3rd
13
14
For “style”, the set of options is {standard, loose, boot,
For “color”, the set of options is {blue,black}
15
Just count it Organize counting: table, trees Multiplication rule Permutation Combination Addition rule, Generalized addition rule Exercises
16
C1 C2 C2 C2 … … … … n1 n2 n2
17
18
19
Pick two different letters AND pick 4 letters/numbers. C1: Pick a letter C2: Pick a letter different from the first C3,C4,C5,C6: Repeat for 4 times: pick a number or letter
Total # of possibilities:
26*25*36*36*36*36 = 1091750400
20
In a car racing game, you can choose from 4 difficulty
How many ways can you arrange 10 different
21
It might feel like that we are topics-hopping
Set, logic, function, relation …
Counting:
What is being counted ?
A finite set, i.e., we are evaluate some set’s cardinality when we
How to count ?
So rules about set cardinality apply ! Inclusion/exclusion principle Power set cardinality Cartisian set cardinality
|AxB| = |A| x |B| The number of diff. ways to pair elements in A with
A={standard, loose, boot}, the set of styles B={blue, black}, the set of colors AxB= {(standard, blue), (standard, black), (loose, blue),
|AxB|: # of different jeans we can form by choosing from
22
23
24
Pick a child to sit on first chair Pick a child to sit on second chair Pick a child to sit on third chair …
The outcome can be represented as an ordered list: e.g.
By multiplication rule: there are 5*4*3*2*1=120
Note, “Pick a chair for 1st child” etc. also works
25
Pick one person to assign to first job: 10 options Pick one person to assign to second job: 9 options Pick one person to assign to third job: 8 options … In total, there are 10*9*8*7*6 different ways to go
26
Some counting problems are similar
How many ways are there to arrange 6 kids in a line ? How many ways to assign 5 jobs to 10 volunteers,
How many different poker hands are possible, i.e.
27
A permutation of objects is an arrangement where
Note: “arrangement” implies each object cannot be picked
Seating of children
Positions matters: Alice, Peter, Bob, Cathy, Kim is different from
Job assignment: choose 5 people out of 10 and arrange
Select a president, VP and secretary from a club
28
Generally, consider choosing r objects out of a total
… 1 2 3 r r-1
29
n objects and r positions
Pick an object to put in 1st position, # of ways: Pick an object to put in 2nd position, # of ways: Pick an object to put in 3rd position, # of ways: … Pick an object to put in r-th position, # of ways: By multiplication rule,
n n-1 n-2 n-(r-1)
30
n! stands for “n factorial”, where n is positive integers,
31
How many five letter words can we form using
It’s a permutation problem, as the order matters and each
P(8,5)
32
How many ways can one select a president, vice
A permutation of 3 people selecting from 28 people:
33
What does P(10,2) stand for ? Calculate P(10,2).
34
If we roll a six-sided die three times and record results
How many possible outcomes are there ?
6*6*6=216
How many possible outcomes have different results for
6*5*4
How many possible outcomes do not contain 1 ?
5*5*5=125
35
from a committee of 3 from a club of 24 people Santa select 8 million toys from store Buy three different fruits
36
C(n,r): number of combinations of r objects chosen
Ex: ways to buy 3 different fruits, choosing from apple,
Ex: ways to form a committee of two people from a
Ex: Number of subsets of {1,2,3,4} that has two
Next: derive formula for C(n,r)
37
How many ways are there to form a committee of 2 for a
Order of selection doesn’t matter
Let’s try to count:
There are 24 ways to select a first member And 23 ways to select the second member So there are 24*23=P(24,2) ways to select two peoples in
sequence
In above counting, each two people combination is
e.g., For combination of Alice and Bob, we counted twice: (Alice,
Bob) and (Bob, Alice).
To delete overcounting
P(24,2)/2
38
If order of selection matters, there are P(n,r) ways For each combination (set) of r items, they have been
For r items, there are P(r,r) different possible selection order
e.g., {Alice, Bob} can be counted twice: (Alice, Bob) and (Bob, Alice).
(if r=2)
Therefore, each set of r items are counted P(r,r) times.
The # of combinations is:
39
40
C(20,7) Three members (Mary, Sue and Tom) are carpooling.
All three of them are on committee: None of them are on the committee:
C(20-7,4) C(20-7,7)
41
Just count it Organize counting: table, trees Multiplication rule Permutation Combination Addition rule, Generalized addition rule Exercises
42
How many subsets of {1,2,3,4,5,6} have 3 elements ?
C(6,3)
How many subsets of {1,2,3,4,5,6} have an odd
Either the subset has 1, or 3, or 5 elements. C(6,1)+C(6,3)+C(6,5)
43
44
If the events/outcomes that we count can be
(either C1 occurs, or C2 occurs, or C3 occurs, …. or Ck
Then the total number of outcomes is n1+n2+…
C1 C2 C3 C4
45
C1 C3 C4 C2
46
If we roll a six-sided die three times and record results
How many of the possible outcomes contain exactly one 1,
Let’s try multiplication rule by analyzing what kind of outcomes
First roll: 6 possible outcomes Second roll: # of outcomes ?
If first roll is 1, second roll can be any number but 1 If first roll is not 1, second roll can be any number
Third roll: # of outcomes ??
47
If we roll a six-sided die three times and record
how many of the possible outcomes contain exactly one
Let’s try to consider three different possibilities:
The only 1 appears in first roll, C1 The only1 appears in second roll, C2 The only1 appears in third roll, C3
We get exactly one 1 if C1 occurs, or C2 occurs, or C3
Result: 5*5+5*5+5*5=75
48
If we roll a six-sided die three times, how many of the
First we select where 1 appears in the list
3 possible ways
Then we select outcome for the first of remaining positions
5 possible ways
Then we select outcome for the second of remaining positions
5 possible ways
49
Pick a digit from set {1,3,7,9} and get an one-digit
Take 2 digits from set {1,3,7,9} and arrange them to
permutation of length 2 with digits from {1,3,7,9}.
Take 3 digits from set {1,3,7,9} and arrange them to
a permutation of length 3 with digits from {1,3,7,9}.
50
Use permutation formula for each scenario (event)
# of one digit number: P(4,1)=3 # of 2 digit number: P(4,2)=4*3=12 # of 3 digit number: P(4,3)=4*3*2=24
Use addition rule, i.e., “OR” rule
Total # of integers less than 1000 that consists of {1,3,7,9}:
51
How many different samples are possible ?
C(100,6)
How many ways are there to choose 6 computers if all four
C(4,4)*C(96,2)
How many ways are there to choose 6 computers if one or
C(4,4)*C(96,2)+C(4,3)*C(96,3)+C(4,2)*C(96,4)+C(4,1)*C(96,5) C(100,6)-C(96,6)
52
If we roll a six-sided die three times how many
How many have exactly one 1 ?
3*5*5
How many have exactly one 6 ?
3*5*5
Just add them together ?
Those have exactly one 1 and one 6 have been counted twice How many outcomes have exactly one 1 and one 6 ?
C(4,1)P(3,3)=4*3*2
53
If we have two choices C1 and C2,
C1 has n1 possible outcomes, C2 has n2 possible outcomes, C1 and C2 both occurs has n3 possible outcomes
then total number of outcomes for C1 or C2
C1 C2 C3
54
If we roll a six-sided die three times how many
3*5*5+3*5*5-3*2*4
Outcomes that have exactly one 1, such as (1,2,3), (1,3,6), (2,3,1) Outcomes that have exactly one 6, such as (2,3,6), (1,3,6), (1,1,6) Outcomes that have exactly one 1 and one 6, such as (1,2,6), (3,1,6)
55
A class of 15 people are choosing 3 representatives,
56
1.
2.
57
How to tackle a counting problem?
58
59
5.
60
61
choose one class member to take attendance? choose 2 people to clean the board? choose one person to take attendance and one to clean
choose one to take attendance and one to clean the
choose one to take attendance and one to clean the
62
A Fordham Univ. club has 25 members of which 5 are
Select a president if freshman is illegible to be president? Select two seniors to serve on College Council? Select 8 members to form a team so that each class is
63
A deck of cards contains 52 cards.
four suits: clubs, diamonds, hearts and spades thirteen denominations: 2, 3, 4, 5, 6, 7, 8, 9, 10, J(ack),
begin with a complete deck, cards dealt are not put back
abbreviate a card using denomination and then suit, such
64
A poker player is dealt a hand of 5 cards from a
How many ways can you draw a flush? Note: a flush
65
A poker player is dealt a hand of 5 cards from a
How many different hands have 4 aces in them? How many different hands have 4 of a kind, i.e., you have
How many different hands have a royal flush (i.e., contains
66
A shopper is buying three shirts from a store that
There are only the following possibilities,
She buys three of the same type: Or, she buys three different type of shirts: Or, she buy two of the same type shirts, and one shift of
Total number of ways: 9+C(9,3)+9*8
9 C(9,3) 9*8
67
P(3,3)
A B D C A C D B
68
1.
2.
3.
69
A bag has 32 balls – 8 each of orange, white, red and
Hint: cannot use combination formula, as balls are not all