Counting
CS 30 : Discrete Mathematics for Computer Science First Semester, AY 2012-2013
https://sites.google.com/a/dcs.upd.edu.ph/nhsh_classes/cs 30
sablay-logo
Nestine Hope S. Hernandez Algorithms and Complexity Laboratory Department of Computer Science University of the Philippines, Diliman nshernandez@dcs.upd.edu.ph updilseal
Day 9
dcs-logo
acl-logo Discrete Mathematics for Computer Science
CS 30
Counting
Combinatorics and Computing
sablay-logo
1
Counting The Pigeonhole Principle
updilseal
dcs-logo
acl-logo Discrete Mathematics for Computer Science
CS 30
Counting
The Pigeonhole Principle
QUIZ A particular brand of shirt comes in 12 colors, has a male version and a female version, and comes in three sizes for each sex. How many di erent types of this shirt are made? 1
2
3
How many di erent initials can someone have if a person has at least two, but no more than ve, di erent initials? Assume that each initial is one of the 26 letters of the English alphabet. How many strings of eight English letters are there a) if letters can be repeated? b) that start with X, if no letter can be repeated? c) that start and end with X, if letters can be repeated?
sablay-logo
updilseal
dcs-logo
acl-logo Discrete Mathematics for Computer Science
CS 30
Counting
The Pigeonhole Principle
The Pigeonhole Principle
sablay-logo
updilseal
dcs-logo
acl-logo Discrete Mathematics for Computer Science
CS 30
Counting
The Pigeonhole Principle
The Pigeonhole Principle
sablay-logo
updilseal
dcs-logo
acl-logo Discrete Mathematics for Computer Science
CS 30
Counting
The Pigeonhole Principle
The Pigeonhole Principle
sablay-logo
If
k is a positive integer and k + 1 or more objects are placed into k
boxes, then there is at least one box containing two or more of the
updilseal
objects. dcs-logo
acl-logo Discrete Mathematics for Computer Science
CS 30
Counting
The Pigeonhole Principle
The Pigeonhole Principle
Example 1
A function
f
from a set with
elements is not one-to-one. 2
k + 1 or more elements to a set with k
sablay-logo
Among any group of at least 13 people, there must be at least two with the same birthmonth.
3
Your bedroom drawer contains ten black and ten white socks. You reach in and pull some out without turning on the lights so as not to disturb your younger sibling who is sleeping in the same room. What is the least number of socks you must pull out to be sure to get a matched pair?
4
Show that for every integer
n there is a multiple of n that has both
updilseal
0s and 1s in its binary form.
dcs-logo
acl-logo Discrete Mathematics for Computer Science
CS 30
Counting
The Pigeonhole Principle
The Generalized Pigeonhole Principle
sablay-logo
updilseal
dcs-logo
acl-logo Discrete Mathematics for Computer Science
CS 30
Counting
The Pigeonhole Principle
The Generalized Pigeonhole Principle
sablay-logo
updilseal
dcs-logo
acl-logo Discrete Mathematics for Computer Science
CS 30
Counting
The Pigeonhole Principle
The Generalized Pigeonhole Principle
sablay-logo
If
N objects are placed into k boxes, then there is at least one box dN /k e objects.
updilseal
containing at least
dcs-logo
acl-logo Discrete Mathematics for Computer Science
CS 30
Counting
The Pigeonhole Principle
The Generalized Pigeonhole Principle
Example 1
sablay-logo
Among 100 people there are at least 9 who were born in the same month.
updilseal
dcs-logo
acl-logo Discrete Mathematics for Computer Science
CS 30
Counting
The Pigeonhole Principle
The Generalized Pigeonhole Principle
Example 1
sablay-logo
Among 100 people there are at least 9 who were born in the same month.
2
(a) How many cards must be selected from a standard deck of 52 cards to guarantee that at least three cards of the same suit are chosen?
updilseal
dcs-logo
acl-logo Discrete Mathematics for Computer Science
CS 30
Counting
The Pigeonhole Principle
The Generalized Pigeonhole Principle
Example 1
sablay-logo
Among 100 people there are at least 9 who were born in the same month.
2
(a) How many cards must be selected from a standard deck of 52 cards to guarantee that at least three cards of the same suit are chosen? (b) How many cards must be selected from a standard deck of 52 cards to guarantee that at least three hearts are chosen? updilseal
dcs-logo
acl-logo Discrete Mathematics for Computer Science
CS 30
Counting
The Pigeonhole Principle
Some Elegant Applications of the Pigeonhole Principle
Example 1
During a month with 30 days, a baseball team plays at least one game a day, but no more than 45 games. Show that there must be a period of some number of consecutive days during which the team
sablay-logo
must play exactly 14 games. 2
Show that among any
n + 1 positive integers not exceeding 2n there
must be an integer that divides one of the other integers. 3
Every sequence of
n
2
+ 1 distinct real numbers contains a n + 1 that is either strictly increasing
subsequence of length strictly decreasing. 4
or
Assume that in a group of six people, each pair of individuals
updilseal
consists of two friends or two enemies. Show that there are either three mutual friends or three mutual enemies in the group. dcs-logo
acl-logo Discrete Mathematics for Computer Science
CS 30
Counting
sablay-logo
Questions? See you next meeting!
updilseal
dcs-logo
acl-logo Discrete Mathematics for Computer Science
CS 30