introduction to counting discrete structures. a multiplication principle

53
Introduction to Counting Discrete Structures

Upload: chester-weaver

Post on 29-Dec-2015

229 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Introduction to Counting Discrete Structures. A Multiplication Principle

Introduction to Counting

Discrete Structures

Page 2: Introduction to Counting Discrete Structures. A Multiplication Principle

A Multiplication Principle

Page 3: Introduction to Counting Discrete Structures. A Multiplication Principle

Example 3

Suppose you're buying equipment for a home office. You wish to purchase a computer, a scanner, and a printer ("3 decisions to make").

If you have narrowed your choices to 3 models of computers, 4 scanners, and 2 printers, how many different overall outcomes are possible?

Page 4: Introduction to Counting Discrete Structures. A Multiplication Principle

The Count By the multiplication principle, the product

3 x 4 x 2 = 24

computer scanner printer

tells us 24 different systems are possible.

“ a branch of a tree”

Page 5: Introduction to Counting Discrete Structures. A Multiplication Principle

Decision Tree: 24 branches

Total of 24

different systems

computer scanner printer

Page 6: Introduction to Counting Discrete Structures. A Multiplication Principle

Example 4

Consider a license plate consisting of any 3 single digit numbers followed by any 3 letters.

Examples of such license plates include 533 ATZ, 285 VCC, etc.

There are 6 decisions to make. For each digit, we have the 10 choices 0, 1,..., 9 and for each letter, we have 26 choices a,b,...,z.

Page 7: Introduction to Counting Discrete Structures. A Multiplication Principle

The Plates

The total number of different plates is given by

10 x 10 x 10 x 26 x 26 x 26

digit 1 digit 2 digit 3 letter 1 letter 2 letter 3A total of 17,576,000 different plates!

Page 8: Introduction to Counting Discrete Structures. A Multiplication Principle

Example 5

In a deli, suppose we may choose from 4 types of bread, 6 types of meat, and 3 types of cheese.

Consider the sandwiches which include one type of meat plus one type of cheese. How many such sandwiches are possible?

There are three decisions to make(bread, meat, cheese)

Page 9: Introduction to Counting Discrete Structures. A Multiplication Principle

The Sandwiches

There are three decisions to make

4 x 6 x 3 = 72 bread meat 1 cheese

A total of 72 different sandwiches.

Page 10: Introduction to Counting Discrete Structures. A Multiplication Principle

Cardinality of a Set

The number of elements in a set A is called the “cardinality” of A , denoted | A|.

By the multiplication principle,if | A| = n and | B| = m, then | A x B| = nm.

By the multiplication principle, if | A| = n, then ( ) 2 2 2 2 2n

n times

A

Page 11: Introduction to Counting Discrete Structures. A Multiplication Principle

No Overlap?

In this special case, count the total elements by counting each set separately.

In this case, the sets are saidto be "disjoint".

| | | | | |A B A B

Page 12: Introduction to Counting Discrete Structures. A Multiplication Principle

Multiply and Add Consider the license plate example again. This

time allow either 3 digits followed by 3 letters or just 6 digits. These two sets of plates are disjoint (no overlap).

A total of 18,576,000 license plates

Page 13: Introduction to Counting Discrete Structures. A Multiplication Principle

Inclusion/Exclusionand Combinations

Discrete Structures

Page 14: Introduction to Counting Discrete Structures. A Multiplication Principle

How many elements?

Recall our sets A = {2,4,5,8,10} andB = { 2,3,5,7,8,9}. Determine the cardinality, | |A B

| | | | | |A B A B Because the sets are not disjoint.

Page 15: Introduction to Counting Discrete Structures. A Multiplication Principle

Avoid Double Counting

When adding the 5 elements from A with the 6 elements from B, the 3 elements which lie in both A and B must be counted only once.

| | A B A B A B

Page 16: Introduction to Counting Discrete Structures. A Multiplication Principle

Addition Principle

For any two sets A and B,

| | A B A B A B

In particular, if A and B are disjoint sets,then

| | A B A B

Page 17: Introduction to Counting Discrete Structures. A Multiplication Principle

Playing Cards

The 13 cards in each category or "suit" include a 2, 3, 4, 5, 6, 7, 8, 9, 10, Jack, Queen, King, and an Ace. The Jack, Queen, and King are called "face cards".

Page 18: Introduction to Counting Discrete Structures. A Multiplication Principle

Aces or Spades

In a deck of playing cards, how many of the cards are Aces or Spades?

That's a total of 16 distinct cards.

Page 19: Introduction to Counting Discrete Structures. A Multiplication Principle

Using Addition Rule

By counting the set of Aces and set of Spades individually and subtracting the overlap…

| |

4 13 1 16

Aces Spades

Aces Spades Aces Spades

Page 20: Introduction to Counting Discrete Structures. A Multiplication Principle

Solving for other term

Given any 3 of the values in the addition rule, we may solve for the remaining unknown value.

Find the number of elements in B, given

| | 140, 90, and 35A B A A B Substitute in the known values…

| |

140 90 35, and so 85

A B A B A B

B B

Page 21: Introduction to Counting Discrete Structures. A Multiplication Principle

Elements in B

The 85 elements of B includes the 35 in the overlap with A. These regions contain the total of 140 elements.

Page 22: Introduction to Counting Discrete Structures. A Multiplication Principle

Example

“In a survey of 1000 students, 700 indicate they are enrolled in a math or english class. Of these students, 400 are enrolled in a math class and 650 are enrolled in an english class. How may are enrolled in math and english classes?”

| | 700, 400, and 650M E M E

Page 23: Introduction to Counting Discrete Structures. A Multiplication Principle

Find Intersection Using the addition principle, setup and solve

for the intersection.| | +

700 400 650

350

M E M E M E

M E

M E

50 350 300M E

Page 24: Introduction to Counting Discrete Structures. A Multiplication Principle

Extended to 3 Sets?

| |

A B C A B C

A B A C B C

A B C

May generalize further for any n sets.

Page 25: Introduction to Counting Discrete Structures. A Multiplication Principle

Problem 8, page 203 Among 150 students

83 own a car,97 own a bicycle,28 own a motorcycle,53 own car and bicycle,14 own car and motorcycle,7 own bicycle and motorcycle,2 own all three items

How many own only a bicycle? How many don’t own any of these items?

Page 26: Introduction to Counting Discrete Structures. A Multiplication Principle

Permutations and Combinations

Discrete Structures

Page 27: Introduction to Counting Discrete Structures. A Multiplication Principle

Arranging Letters

When we consider 3 letters on a license plate, the order in which the letters appear is significant. That is, the sequence of letters PHT is different than TPH, even though the same letters are used.

Using the “multiplication principle”, there are 26 x 25 x 24 = 15600 ways to pick and arrange 3 distinct letters(not using the same letter twice).

Page 28: Introduction to Counting Discrete Structures. A Multiplication Principle

“Permutations”

When we wish to consider the many different arrangements of the various choices, as with letters on license plates, we use the term "permutations".

“Permutations of n objects, taken r at a time”

Consider 26 letters, choose and arrange 3.How many ways may this be done?

Page 29: Introduction to Counting Discrete Structures. A Multiplication Principle

Permutation Formula

When repetitions are not allowed, the number of ways to choose and arrange any r objects chosen from a set of n availableobjects is denoted Pn, r .

Page 30: Introduction to Counting Discrete Structures. A Multiplication Principle

Using the Formula For the arrangements of 3 letters

recall by “multiplication principle”, there are 26 x 25 x 24 = 15600 ways

Page 31: Introduction to Counting Discrete Structures. A Multiplication Principle

Same as before!

A convenient notation, but why not just use the multiplication principle?

Page 32: Introduction to Counting Discrete Structures. A Multiplication Principle

Gold, Silver, Bronze

Consider the top 3 winners in a race with 8 contestants. How many results are possible?

Or equivalently,

Page 33: Introduction to Counting Discrete Structures. A Multiplication Principle

Calculate it

Calculators have a built-in feature for these computations (labeled as nPr ).

Use the MATH button and PRB submenu.

To compute the value P8,3 = 336

we simply enter: 8 nPr 3

Page 34: Introduction to Counting Discrete Structures. A Multiplication Principle

Compare 2 Cases:

Case 1: If a president, VP, and

treasurer are elected, how many outcomes are possible?

(select and arrange 3, order is important)

16 x 15 x 14 = 3360 pres. VP treas.

Consider a club with 16 members: Case 2: If a group of 3 members is

chosen, how many groups are possible ?

(a choice of 3 members, order is not important)

Since we don't count the different arrangements, this total should be less.

Page 35: Introduction to Counting Discrete Structures. A Multiplication Principle

Case 2 “Combinations” We’re interested in the members of the group, not

all the possible arrangements.

Think of the group as one "choice of 3” from the 16 members.

The number of different combinations is denoted by C16, 3 .

“Combinations of 16 objects, taken 3 at a time”

Page 36: Introduction to Counting Discrete Structures. A Multiplication Principle

Combinations Formula

number of combinations of r items chosen from n available choices, is given by

“Combinations of n objects, taken r at a time”

Often read as “n, choose r"

Page 37: Introduction to Counting Discrete Structures. A Multiplication Principle

Calculate “16, choose 3”

Or we may calculate the value C16,3 = 560by simply entering: 16 nCr 3

simplifies as

Page 38: Introduction to Counting Discrete Structures. A Multiplication Principle

Our Comparison

Case 1: Case 2:

Given one group of 3 members, such as Joe, Bob, and Sue, 6 arrangements are possible: ( Joe, Bob, Sue), ( Joe, Sue, Bob), ( Bob, Joe, Sue)

( Bob, Sue, Joe), ( Sue, Joe, Bob), ( Sue, Bob, Joe)

Each group gets counted 6 times for permutations.

Divide by 6 to “remove this redundancy”.

Page 39: Introduction to Counting Discrete Structures. A Multiplication Principle

Arranging Letters

How many distinct ways can the letters “MISSOURI” be arranged?

There are 8 letters, so there are 8! permutations. But not all distinct!

RUIS1 MS2 OI is equal to RUIS2 MS1 OI so don’t count these twice.

Same consideration for the letter “I’s”. 8!, reduce by half, and reduce by half again.

Perhaps an easier way?

Page 40: Introduction to Counting Discrete Structures. A Multiplication Principle

Rearranging Missouri

How many distinct ways can the letters “MISSOURI” be arranged?

8!10080

(2!)(2!)

8,2 6,2 (4!) (28)(15)(24) 10080C C

Alternate, choose 2 slots for the M’s, choose 2 slots for the I’s, then arrange the other 4 letters.

Page 41: Introduction to Counting Discrete Structures. A Multiplication Principle

Rearranging Mississippi

How many distinct ways can the letters “mississippi” be arranged?

11!34650

(4!)(4!)(2!)

11,4 7,4 3,2 (1) (330)(35)(3)(1) 34650C C C

Alternate, choose 4 slots for the S’s, 4 slots for the I’s, 2 slots for the P’s, then only one slot left to place the M.

Page 42: Introduction to Counting Discrete Structures. A Multiplication Principle

More Combinations

Discrete Structures

Page 43: Introduction to Counting Discrete Structures. A Multiplication Principle

5 card hands?

When a hand of cards is drawn from a deck, which cards we receive is important, not the arrangement.

How many different 5-card hands are possible ?

Consider all combinations of 5 cards, taken from the 52 cards. That is, “52, choose 5”.

Page 44: Introduction to Counting Discrete Structures. A Multiplication Principle

Series of Choices

Try combining our new counting formulas with our previous counting principles.

How many 5-card hands include exactly 3 kings and 2 aces?

Here we select kings and select aces. It’s a series of decisions, so we apply the multiplication principle:

? x ? = ??? choose 3 of choose 2 of the 4 kings the 4 aces

Page 45: Introduction to Counting Discrete Structures. A Multiplication Principle

3 Kings, 2 Aces “4 kings, choose 3”;

there are C4,3 = 4 possible outcomes.

“4 aces, choose 2”; there are C4,2 = 6 possible outcomes.

C4, 3 x C4, 2 = (4)(6) = 24 choose 3 of choose 2 of the 4 kings the 4 aces

There are 24 hands including 3 kings and 2 aces.

Page 46: Introduction to Counting Discrete Structures. A Multiplication Principle

Committee Consider a group of 20 juniors and 25 seniors. Question 1: How many ways can a committee of 4 of

these students be selected? "45 available students, choose 4“

C45,4 = 148,995 possible committees.

Question 2: How many ways can a committee with 2 juniors and 2 seniors be selected?

Select 2 of the 20 juniors, select 2 of 25 seniors: C20, 2 x C25, 2 = (190)(300) = 57,000 committtees.

Page 47: Introduction to Counting Discrete Structures. A Multiplication Principle

Continued… Question 3:

How many ways can a committee of 4 students be selected, including at least 3 seniors?

Adding the two cases yields a total of (20)(2300) + 12650 = 58,650 committees.

Page 48: Introduction to Counting Discrete Structures. A Multiplication Principle

Defective, or not?Among a collection of 20 clocks, 5 are defective. Question 1: How many ways can 3 of the clocks

be selected? "20 available clocks, choose any 3“

C20,3 = 1140 possible selections.

Question 2: How many ways can 3 of the clocks

be selected such that none are defective? Select 3 from the 15 non-defective clocks

C15,3 = 455 selections don't involve defective clocks

Page 49: Introduction to Counting Discrete Structures. A Multiplication Principle

Partition as Disjoint Sets

All 5-card hands categorized as: no face cards: C40, 5 = 658,008

1 face card: C12,1 C40, 4 = 1,096,680 2 face cards: C12,2 C40, 3 = 652,0803 face cards: C12,3 C40, 2 = 171,6004 face cards: C12,4 C40, 1 = 19,800all 5 face cards: C12,5 = 792

Total 5-card hands: 2,598,960

Page 50: Introduction to Counting Discrete Structures. A Multiplication Principle

Throw out the rest

Sometimes instead of counting the objects we’re interested in…

…it’s easier to count “all objects” and subtract out the objects we don’t want.

A S A

Consider a subset A of a “universal” set S

AA

S

Page 51: Introduction to Counting Discrete Structures. A Multiplication Principle

The LONG Way…

To count the 5-card hands with at least one face card…

12,1 40,4 12,2 40,3 12,3 40,2 12,4 40,1 12,5

1,940,952 ?

C C C C C C C C C

hands with 1 face card + hands with 2 face cards+ hands with 3 face cards + hands with 4 face cards+ hands with 5 face cards

Page 52: Introduction to Counting Discrete Structures. A Multiplication Principle

The Easy Way!

But, to count the 5-card hands with at least one face card…

…we may instead count all 5-card hands and subtract the hands with no face cards.

52,5 40,5

2,598,960 658,008

1,940,952

C C

one or more

face cards no face

cards

all 5-card hands

Page 53: Introduction to Counting Discrete Structures. A Multiplication Principle

Subtract the complement

From a group of 15 juniors and 15 seniors… …how many ways is it possible to choose a

team of 11 students including at least 2 seniors?

two or more

seniors 0 or 1

senior

all 11-student teams

54,627,300 1,365 45,045

54,580,890

30,11 15,11 15,1 15,10C C C C