Top Banner
CS 23022 Discrete Mathematical Structures Mehdi Ghayoumi MSB rm 132 [email protected] Ofc hr: Thur, 9:30-11:30a
27

CS 23022 Discrete Mathematical Structures Mehdi Ghayoumi MSB rm 132 [email protected] Ofc hr: Thur, 9:30-11:30a.

Dec 14, 2015

Download

Documents

Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: CS 23022 Discrete Mathematical Structures Mehdi Ghayoumi MSB rm 132 mghayoum@cs.kent.edu Ofc hr: Thur, 9:30-11:30a.

CS 23022Discrete Mathematical Structures

Mehdi Ghayoumi

MSB rm 132

[email protected]

Ofc hr: Thur, 9:30-11:30a

Page 2: 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.

Page 3: CS 23022 Discrete Mathematical Structures Mehdi Ghayoumi MSB rm 132 mghayoum@cs.kent.edu Ofc hr: Thur, 9:30-11:30a.

CountingSuppose you have 4 shirts, 3 pairs of pants, and 2 pairs of

shoes. How many different outfits do you have?

Product Rule

Page 4: CS 23022 Discrete Mathematical Structures Mehdi Ghayoumi MSB rm 132 mghayoum@cs.kent.edu Ofc hr: Thur, 9:30-11:30a.

The Product Rule

Page 5: CS 23022 Discrete Mathematical Structures Mehdi Ghayoumi MSB rm 132 mghayoum@cs.kent.edu Ofc hr: Thur, 9:30-11:30a.

Example of Product Rule

Page 6: CS 23022 Discrete Mathematical Structures Mehdi Ghayoumi MSB rm 132 mghayoum@cs.kent.edu Ofc hr: Thur, 9:30-11:30a.

Product RuleHow many 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.

How many ways can each choice be made?

4 4 4

64

Page 7: CS 23022 Discrete Mathematical Structures Mehdi Ghayoumi MSB rm 132 mghayoum@cs.kent.edu Ofc hr: Thur, 9:30-11:30a.

Product RuleHow 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.

How many ways can each choice be made?

4 3 2

24

Page 8: CS 23022 Discrete Mathematical Structures Mehdi Ghayoumi MSB rm 132 mghayoum@cs.kent.edu Ofc hr: Thur, 9:30-11:30a.

Example of Product Rule

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?

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?

Page 9: CS 23022 Discrete Mathematical Structures Mehdi Ghayoumi MSB rm 132 mghayoum@cs.kent.edu Ofc hr: Thur, 9:30-11:30a.

The Sum Rule

Page 10: CS 23022 Discrete Mathematical Structures Mehdi Ghayoumi MSB rm 132 mghayoum@cs.kent.edu Ofc hr: Thur, 9:30-11:30a.

Example of Sum Rule

Page 11: CS 23022 Discrete Mathematical Structures Mehdi Ghayoumi MSB rm 132 mghayoum@cs.kent.edu Ofc hr: Thur, 9:30-11:30a.

Pigeonhole Principle

If n pigeon fly into k pigeonholes and k < n, then some pigeonhole contains at least two pigeons.

Page 12: CS 23022 Discrete Mathematical Structures Mehdi Ghayoumi MSB rm 132 mghayoum@cs.kent.edu Ofc hr: Thur, 9:30-11:30a.

Pigeonhole Principle

If n pigeons fly into k pigeonholes and k < n,

then some pigeonhole contains at least two

pigeons.

We can use this simple little fact to prove amazingly complex things.

Page 13: CS 23022 Discrete Mathematical Structures Mehdi Ghayoumi MSB rm 132 mghayoum@cs.kent.edu Ofc hr: Thur, 9:30-11:30a.

Pigeonhole PrincipleLet 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?

Page 14: CS 23022 Discrete Mathematical Structures Mehdi Ghayoumi MSB rm 132 mghayoum@cs.kent.edu Ofc hr: Thur, 9:30-11:30a.

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.

Page 15: CS 23022 Discrete Mathematical Structures Mehdi Ghayoumi MSB rm 132 mghayoum@cs.kent.edu Ofc hr: Thur, 9:30-11:30a.

Generalized Pigeonhole PrincipleIf 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)?

Page 16: CS 23022 Discrete Mathematical Structures Mehdi Ghayoumi MSB rm 132 mghayoum@cs.kent.edu Ofc hr: Thur, 9:30-11:30a.

More applications of pigeonhole principleA 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?

Page 17: CS 23022 Discrete Mathematical Structures Mehdi Ghayoumi MSB rm 132 mghayoum@cs.kent.edu Ofc hr: Thur, 9:30-11:30a.

Permutations

There are basically two types of permutation:

1.Repetition is Allowed:

such as 4 digits above. It could be "3333".

2.No Repetition:

such as 4 digits above. It could be "3624".

Page 18: CS 23022 Discrete Mathematical Structures Mehdi Ghayoumi MSB rm 132 mghayoum@cs.kent.edu Ofc hr: Thur, 9:30-11:30a.

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

Page 19: CS 23022 Discrete Mathematical Structures Mehdi Ghayoumi MSB rm 132 mghayoum@cs.kent.edu Ofc hr: Thur, 9:30-11:30a.

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

nr

where n is the number of things to choose from, and we choose r of them

(Repetition allowed, order matters)

So, the formula is simply:

Page 20: CS 23022 Discrete Mathematical Structures Mehdi Ghayoumi MSB rm 132 mghayoum@cs.kent.edu Ofc hr: Thur, 9:30-11:30a.

Permutations without RepetitionIn 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.

Page 21: CS 23022 Discrete Mathematical Structures Mehdi Ghayoumi MSB rm 132 mghayoum@cs.kent.edu Ofc hr: Thur, 9:30-11:30a.

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

Page 22: CS 23022 Discrete Mathematical Structures Mehdi Ghayoumi MSB rm 132 mghayoum@cs.kent.edu Ofc hr: Thur, 9:30-11:30a.

Permutations without Repetition

How many ways can first and second place be awarded to 10 people?

Our "order of 3 out of 16 pool balls example" would be:

Page 23: CS 23022 Discrete Mathematical Structures Mehdi Ghayoumi MSB rm 132 mghayoum@cs.kent.edu Ofc hr: Thur, 9:30-11:30a.

PermutationsIn 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?

a) 60b) 125

c) 12!/7!d) 512

e) No clue

12 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)!

Page 24: CS 23022 Discrete Mathematical Structures Mehdi Ghayoumi MSB rm 132 mghayoum@cs.kent.edu Ofc hr: Thur, 9:30-11:30a.

PermutationsSuppose 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

Page 25: CS 23022 Discrete Mathematical Structures Mehdi Ghayoumi MSB rm 132 mghayoum@cs.kent.edu Ofc hr: Thur, 9:30-11:30a.

PermutationsSuppose 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)

Page 26: CS 23022 Discrete Mathematical Structures Mehdi Ghayoumi MSB rm 132 mghayoum@cs.kent.edu Ofc hr: Thur, 9:30-11:30a.

PermutationsSuppose 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!

Page 27: CS 23022 Discrete Mathematical Structures Mehdi Ghayoumi MSB rm 132 mghayoum@cs.kent.edu Ofc hr: Thur, 9:30-11:30a.