Generalized Counting Rules . If |

advertisement
Mathematics for Computer Science
Pigeonhole Principle
MIT 6.042J/18.062J
Mapping Rule: total injection from
A to B implies |A| |B|.
Generalized
Counting Rules
Albert R Meyer,
April 12, 2010
If |A| > |B| , then
no total injection from A to B.
Albert R Meyer,
lec 10M.1
Pigeonhole Principle
April 12, 2010
lec 10M.2
Pigeonhole Principle
If more pigeons
then some hole must
have two pigeons!
than pigeonholes,
Albert R Meyer,
April 12, 2010
example: 5 Card Draw
set of 5 cards:
must have 2
J
10 J
66 10
22
lec 10M.4
5 cards
(pigeons)
JJ
with the same suit.
April 12, 2010
April 12, 2010
5 Card Draw
Image by MIT OpenCourseWare.
Albert R Meyer,
Albert R Meyer,
lec 10M.3
lec 10M.5
4 suits
(holes)
Albert R Meyer,
April 12, 2010
lec 10M.6
Pigeon clip art © source unknown.
All rights reserved. This content is excluded from our Creative Commons license.
For more information, see http://ocw.mit.edu/fairuse
1
10 Card Draw
10 Card Draw
10 cards: how many have
the same suit?
NO!
< 3 cards in every hole?
Albert R Meyer,
April 12, 2010
lec 10M.7
10 Card Draw
Albert R Meyer,
April 12, 2010
lec 10M.8
Generalized Pigeonhole Principle
If n pigeons and h holes,
then some hole has # cards with same suit
10 =3
4
pigeons.
“ceiling,” means round up
Albert R Meyer,
April 12, 2010
lec 10M.9
Albert R Meyer,
April 12, 2010
Generalized Product Rule
Generalized Product Rule
# lineups of 5 students in
6.042? let S::= 6.042 students
|S| = 91 so
|lineups of 5 students| =NO!
915 ?
lineups have no repeats:
|seqs in S5 with no repeats| ?
|seqs in S5 with no repeats|
Albert R Meyer,
April 12, 2010
lec 10M.11
lec 10M.10
91 choices for 1st student,
90 choices for 2nd student,
89 choices for 3rd student,
88 choices for 4th student,
87 choices for 5th student
91!
= 9190898887 =
86!
Albert R Meyer,
April 12, 2010
lec 10M.12
2
Generalized Product Rule
Division Rule
Q a set of length-k sequences
#6.042 students =
if n1 possible 1st elements,
n2 possible 2nd elements
(for each first entry),
n3 possible 3rd elements
(for each 1st & 2nd entry,…)
then, |Q| = n1n2nk
Albert R Meyer,
April 12, 2010
lec 10M.13
Division Rule
Let A::= permutations of {1,2,…,13}
B::= size 4 subsets
|A| = k|B|
(generalized Bijection Rule)
April 12, 2010
lec 10M.15
Counting Subsets
map a1 a2 a3 a4 a5…a12 a13 A
to
{a1, a2, a3, a4}
B
Albert R Meyer,
April 12, 2010
lec 10M.16
Counting Subsets
a1 a3 a2 a4 a5…a12 a13 also maps
to {a1, a2, a3, a4}
13! = |A| = (4!9!)|B|
so # of size 4 subsets is
so does a1 a3 a2 a4 a13 … a12 a5
4! perms
lec 10M.14
How many size 4 subsets of {1,2,…,13}?
k-to-1, then
Albert R Meyer,
April 12, 2010
Counting Subsets
if function from A to B
is
Albert R Meyer,
9! perms
all map to same set
4!9!-to-1
Albert R Meyer,
April 12, 2010
lec 10M.17
Albert R Meyer,
April 12, 2010
lec 10M.18
3
Counting Subsets
counting 2-pair poker hands
# m element subsets
of an n element set is
Albert R Meyer,
April 12, 2010
a 2-pair hand has
•2 cards of some rank
•2 cards of a second rank
•1 card of still a third rank
lec 10M.19
counting 2-pair poker hands
K, K, A, A, 3
April 12, 2010
lec 10M.22
counting 2-pair poker hands
then choose:
• 1st pair suits
• 2nd pair suits
• last card suit
Albert R Meyer,
lec 10M.21
counting 2-pair poker hands
Albert R Meyer,
April 12, 2010
lec 10M.23
counting 2-pair poker hands
successively choosing:
K, A, 3, {, }, {, }, specifies 2-pair hand:
4
2 4
2 sets of
2 suits
sets of
2 suits
(4 suits)
April 12, 2010
April 12, 2010
to count, choose:
• 1st pair rank
(13 ranks)
(12 ranks left)
• 2nd pair rank
• last card rank (11 ranks left)
a 2-pair hand:
Albert R Meyer,
Albert R Meyer,
K, K, A, A, 3
lec 10M.24
Albert R Meyer,
April 12, 2010
lec 10M.25
4
counting 2-pair poker hands
so # 2-pair hands is
this method counts 6-tuples
[1st card ranks][2nd card ranks]
[last card rank] [1st card suits] [2nd card suits]
[last card suit]
correctly
4 4
13 12 11 4
2 2 NO!
Albert R Meyer,
April 12, 2010
counting 2-pair poker hands
lec 10M.26
counting 2-pair poker hands
but the correspondence to
2-pair hands is not a bijection:
Albert R Meyer,
April 12, 2010
lec 10M.27
counting 2-pair poker hands
the bug
to count, choose:
• 1st pair rank
(13 ranks)
(12 ranks left)
• 2nd pair rank
• last card rank (11 ranks left)
(K, A, 3, {, }, {, }, )
K, K, A, A, 3
(A, K, 3, {, }, {, } , )
Albert R Meyer,
April 12, 2010
lec 10M.28
counting 2-pair poker hands
the bug
to count, choose:
• 1st pair rank
(13 ranks)
(12 ranks left)
• 2nd pair rank
• last card rank (11 ranks left)
either pair might be 1st
Albert R Meyer,
April 12, 2010
lec 10M.31
Albert R Meyer,
April 12, 2010
lec 10M.30
counting 2-pair poker hands
map from 6-tuples
(K, A, 3, {, }, {, }, )
to 2-pair hands
K, K, A, A, 3
is 2-to-1
Albert R Meyer,
April 12, 2010
lec 10M.32
5
counting 2-pair poker hands
so # 2-pair hands is
so # 2-pair hands is really
4 4
13 12 11 4
2 2 4 4
13 12 11 4
2 2 2
1
NO!
Albert R Meyer,
April 12, 2010
counting 2-pair poker hands
lec 10M.33
Albert R Meyer,
April 12, 2010
lec 10M.34
Team Problems
Problems
14
Albert R Meyer,
April 12, 2010
lec 10M.35
6
MIT OpenCourseWare
http://ocw.mit.edu
6.042J / 18.062J Mathematics for Computer Science
Spring 2010
For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms.
Download