Lecture 13 , July - 08

advertisement
CS 23022
Discrete Mathematical Structures
Mehdi Ghayoumi
MSB rm 132
mghayoum@cs.kent.edu
Ofc hr: Thur, 9:30-11:30a
Announcements
Homework 6 available. Due 07/10, 8a.
Today’s lecture covers material
from
Rosen, sections 6.2-6.3.
Counting
Suppose you have 4 shirts, 3 pairs of pants, and 2 pairs of
shoes. How many different outfits do you have?
Product Rule
The Product Rule
Example of Product Rule
Product Rule
How many functions are there from set A to set B?
B
A
To define each function we have to make 3 choices,
one for each element of A.
4
4
4
How many ways can each
choice be made?
64
Product Rule
How many one-to-one functions are there from set A to
set B?
A
B
To define each function we have to make 3 choices,
one for each element of A.
4
3
2
How many ways can each
choice be made?
24
Example of Product Rule
How many Strings of 4 digits…
a)
Do not contain the same digit twice?
b) End with an odd digit?
c) Start with an even digit?
How many Strings of 4 decimal digits…
a)
Do not contain the same digit twice?
b) End with an odd digit?
c)
Start with an even digit?
The Sum Rule
Example of Sum Rule
Pigeonhole Principle
If n pigeon fly into k pigeonholes and k < n, then
some pigeonhole contains at least two pigeons.
Pigeonhole Principle
We can use this
simple little fact to
prove amazingly
complex things.
If n pigeons fly into k pigeonholes and k < n, then
some pigeonhole contains at least two pigeons.
Pigeonhole Principle
Let S contain any 6 positive integers.
Then, there is a pair of numbers in S whose
difference is divisible by 5.
Let S = {a1,a2,a3,a4,a5,a6}.
Each of these has a remainder when divided by 5. What can
these remainders be?
0, 1, 2, 3, or 4
6 numbers, 5 possible remainders…what do we know?
Pigeonhole Principle
6 numbers, 5 possible remainders…what do we know?
Some pair has the same remainder, by PHP.
Consider that pair, ai and aj, and their remainder r.
ai = 5m + r, and aj = 5n + r.
Their difference:
ai - aj = (5m + r) - (5n + r) = 5m - 5n = 5(m-n), which is divisible by 5.
Generalized Pigeonhole Principle
If N objects are placed in k boxes, then there is at least
one box containing at least N/k =˥ objects.
Example 1.
In a class of 73 students, there are at least ? who are born in the
same month.
Example 2.
How many student in a class must there be to ensure that 6
student get the same grade(one of A,B,C,D or F)?
More applications of pigeonhole
principle
A bowl contain 10 red and 10 yellow balls
How many balls must be selected to ensure 3 yellow balls?
Consider the worst case:
Consider 10 red balls and 2 yellow balls ,
Answer?
Permutations
There are basically two types of permutation:
1.Repetition is Allowed:
such as 4 digits above. It could be "3333".
1.No Repetition:
such as 4 digits above. It could be "3624".
Permutations with Repetition
When we have n things to choose from ... then
we have n choices each time!
When choosing r of them, the permutations are:
n × n × ... (r times)
(In other words, there are n possibilities for the first choice, THEN
there are n possibilites for the second choice, and so on,
multplying each time.)
Which is easier to write down using an exponent of r:
n × n × ... (r times) = nr
Permutations with Repetition
Example: in a lock , there are 10 numbers to choose from (0,1,...9)
and we choose 3 of them:
10 × 10 × ... (3 times) = 103 = 1,000 permutations
So, the formula is simply:
nr
where n is the number of things to choose
from, and we choose r of them
(Repetition allowed, order matters)
Permutations without Repetition
In this case, we have to reduce the number of available choices each time.
So, our first choice would have 10 possibilites, and our next choice would
then have 9 possibilities, then 8, 7, etc. And the total permutations would
be:
10 × 9 × 8 × 7 × ... ×2 ×1 = …
But maybe we don't want to choose them all, just 3 of them, so that would
be only:
10 × 9 × 8 = 720
In other words, there are 720 different ways that 3 digits code could be
selected out of 10 digits.
Permutations without Repetition
For example, what order could 16 pool balls be in?
After choosing, say, number "14" we can't choose it again
But how do we write that mathematically? Answer: we use the
"factorial function"
So, if we wanted to select all of the billiard balls the permutations would be:
16! = 20,922,789,888,000
But if we wanted to select just 3, then we have to stop the multiplying after
14. How do we do that? There is a neat trick ... we divide by 13! ...
Do you see? 16! / 13! = 16 × 15 × 14
Permutations without Repetition
Our "order of 3 out of 16 pool balls example" would be:
How many ways can first and second place be awarded to 10 people?
Permutations
In a running race of 12 sprinters, each of the top 5
finishers receives a different medal. How many
ways are there to award the 5 medals?
12
a)
b)
c)
d)
e)
60
125
12!/7!
512
No clue
11
10
9
8
A permutation is an ordered
arrangement of objects.
The number of permutations of r
distinct objects chosen from
n distinct objects is denoted
P(n,r).
P(n,r) = n! / (n-r)!
Permutations
Suppose you have time to listen to 10 songs on your daily
jog around campus. There are 6 Cake tunes, 8 Moby
tunes, and 3 Eagles tunes to choose from.
How many different jog playlists can you make?
P(17,10) = 17x16x15x14x13x12x11
Permutations
Suppose you have time to listen to 10 songs on your daily
jog around campus. There are 6 Cake tunes, 8 Moby
tunes, and 3 Eagles tunes to choose from.
Now suppose you want to listen to 4 Cake, 4 Moby, and 2
Eagles tunes, in that band order. How many playlists
can you make?
P(6,4) x P(8,4) x P(3,2)
Permutations
Suppose you have time to listen to 10 songs on your
daily jog around campus. There are 6 Cake
tunes, 8 Moby tunes, and 3 Eagles tunes to
choose from.
Finally, suppose you still want 4 Cake, 4 Moby, and
2 Eagles tunes, and the order of the groups
doesn’t matter, but you get dizzy and fall down
if all the songs by any one group aren’t played
together.
How many playlists are there now?
P(6,4) x P(8,4) x P(3,2) x 3!
Download