discrete mathematics, 1st edition kevin ferland chapter 6 basic counting 1

66
Discrete Mathematics, 1st Edition Kevin Ferland Chapter 6 Basic Counting 1

Upload: gwendolyn-lyons

Post on 21-Jan-2016

218 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Discrete Mathematics, 1st Edition Kevin Ferland Chapter 6 Basic Counting 1

Discrete Mathematics, 1st EditionKevin Ferland

Chapter 6

Basic Counting

1

Page 2: Discrete Mathematics, 1st Edition Kevin Ferland Chapter 6 Basic Counting 1

6.1 The Multiplication Principle

(Dinner Choices). A guest at a formal dinner has 4 entrée choices and 2 dessert choices. If a guest’s dinner is entirely determined by these two choices, then how many different dinner choices are there?

The total number of dinner choices is given by the product 4 · 2 = 8.

2Ch6-p303

Page 3: Discrete Mathematics, 1st Edition Kevin Ferland Chapter 6 Basic Counting 1

EXAMPLE 6.1 (Solution) (Cont.)

3Ch6-p304

Page 4: Discrete Mathematics, 1st Edition Kevin Ferland Chapter 6 Basic Counting 1

THEOREM 6.1

4Ch6-p304

Page 5: Discrete Mathematics, 1st Edition Kevin Ferland Chapter 6 Basic Counting 1

6.2 Permutations and Combinations

PermutationsA permutation of a set of objects is an

ordering of those objects. Permutations reflect selections for which an ordering is important.

5Ch6-p311

Page 6: Discrete Mathematics, 1st Edition Kevin Ferland Chapter 6 Basic Counting 1

EXAMPLE 6.8

(Lining Up). How many ways are there to put 8 children in a line to get ice cream?

6Ch6-p311

Page 7: Discrete Mathematics, 1st Edition Kevin Ferland Chapter 6 Basic Counting 1

EXAMPLE 6.8 (Solution)

There are 8 children from which to pick the child who is first.

Then there are 7 children left from which to pick the second child.

Then there are 6 left, and so on.Therefore, there are

8 · 7 · 6 · 5 · 4 · 3 · 2 · 1 = 8! = 40320ways to line up the children.

7Ch6-p311

Page 8: Discrete Mathematics, 1st Edition Kevin Ferland Chapter 6 Basic Counting 1

THEOREM 6.2

8Ch6-p311

Page 9: Discrete Mathematics, 1st Edition Kevin Ferland Chapter 6 Basic Counting 1

DEFINITION 6.1

A permutation of k objects from a set of size n is an ordered list of k of the n objects.

The number of permutations of k objects from n is denoted P(n, k).

9Ch6-p312

Page 10: Discrete Mathematics, 1st Edition Kevin Ferland Chapter 6 Basic Counting 1

THEOREM 6.3

10Ch6-p313

Page 11: Discrete Mathematics, 1st Edition Kevin Ferland Chapter 6 Basic Counting 1

Combinations

DEFINITION 6.2

A combination of k elements from a set of size n is a subset of size k.

11Ch6-p313

Page 12: Discrete Mathematics, 1st Edition Kevin Ferland Chapter 6 Basic Counting 1

THEOREM 6.4

12Ch6-p313

Page 13: Discrete Mathematics, 1st Edition Kevin Ferland Chapter 6 Basic Counting 1

EXAMPLE 6.18

How many license plates consisting of 6 digits (0 to 9) with exactly 2 of the same digit are possible?

13Ch6-p314

Page 14: Discrete Mathematics, 1st Edition Kevin Ferland Chapter 6 Basic Counting 1

EXAMPLE 6.18 (Solution)

There are 10 digits from which to choose the repeated one.

There are ways to choose the two positions to contain the repeated digit.

14Ch6-p314

2

6

Page 15: Discrete Mathematics, 1st Edition Kevin Ferland Chapter 6 Basic Counting 1

EXAMPLE 6.18 (Solution) (Cont.)

Then there are P(9, 4) ways to fill in the 4 remaining distinct digits.

By the Multiplication Principle, there are

6-digit license plates with exactly 2 digits the same.

15Ch6-p314

Page 16: Discrete Mathematics, 1st Edition Kevin Ferland Chapter 6 Basic Counting 1

6.3 Addition and Subtraction

16Ch6-p320

Page 17: Discrete Mathematics, 1st Edition Kevin Ferland Chapter 6 Basic Counting 1

6.3 Addition and Subtraction

EXAMPLE 6.20

How many possible license plates consisting of 6 digits (0 to 9) have either all digits distinct or all digits the same?

17Ch6-p320

Page 18: Discrete Mathematics, 1st Edition Kevin Ferland Chapter 6 Basic Counting 1

EXAMPLE 6.20 (Solution)

There are P(10, 6) plates with all digits distinct and 10 with all digits the same.

Certainly no one plate can have both of these properties. Hence, the total number of license plates under consideration is

P(10, 6) + 10 = 151210.

18Ch6-p320-321

Page 19: Discrete Mathematics, 1st Edition Kevin Ferland Chapter 6 Basic Counting 1

THEOREM 6.6

19Ch6-p322

Page 20: Discrete Mathematics, 1st Edition Kevin Ferland Chapter 6 Basic Counting 1

EXAMPLE 6.26

A byte is a binary number consisting of 8 digits. How many bytes have at least 2 zeros?

There are 28 binary sequences of length 8.

Of them, 1 has no zeros and 8 have one zero.

Since the rest have at least 2 zeros, there are

28 − (1 + 8) = 247

sequences with at least 2 zeros.

20Ch6-p323

Page 21: Discrete Mathematics, 1st Edition Kevin Ferland Chapter 6 Basic Counting 1

THEOREM 6.7

21Ch6-p323

Page 22: Discrete Mathematics, 1st Edition Kevin Ferland Chapter 6 Basic Counting 1

EXAMPLE 6.29

A standard (6-sided) die is rolled a sequence of 5 times. In how many ways can the sequence of numbers resulting be all even or all multiples of 3?

22Ch6-p325

Page 23: Discrete Mathematics, 1st Edition Kevin Ferland Chapter 6 Basic Counting 1

EXAMPLE 6.29 (Solution)

Since there are 3 even values (2, 4, and 6), there are 35 ways to get all even numbers.

Since there are 2 multiples of 3 (3 and 6), there are 25 ways to get all multiples of 3.

Only the value 6 is both even and a multiple of 3, so there is 1 way to do both .

Therefore, the desired number of ways is

35 + 25 − 1 = 274.23Ch6-p325

Page 24: Discrete Mathematics, 1st Edition Kevin Ferland Chapter 6 Basic Counting 1

6.4 Probability

EXAMPLE 6.31

Consider the task of tossing two dice and recording the numbers showing. Compute the probability that the sum is 8.

24Ch6-p328

Page 25: Discrete Mathematics, 1st Edition Kevin Ferland Chapter 6 Basic Counting 1

EXAMPLE 6.31 (Cont.)

The set of possible results of our task is thus

S = { (1, 1), (1, 2), (1, 3), (1, 4), (1, 5), (1, 6), (2, 1), (2, 2), (2, 3), (2, 4), (2, 5), (2, 6),

(3, 1), (3, 2), (3, 3), (3, 4), (3, 5), (3, 6), (4, 1), (4, 2), (4, 3), (4, 4), (4, 5), (4, 6), (5, 1), (5, 2), (5, 3), (5, 4), (5, 5), (5, 6), (6, 1), (6, 2), (6, 3), (6, 4), (6, 5), (6,

6) }.

25Ch6-p328

Page 26: Discrete Mathematics, 1st Edition Kevin Ferland Chapter 6 Basic Counting 1

EXAMPLE 6.31 (Solution)

From the possible results listed in S, we are interested in the subset

E = {(2, 6), (3, 5), (4, 4), (5, 3), (6, 2)}.

The probability of E is given by

.

26Ch6-p328

Page 27: Discrete Mathematics, 1st Edition Kevin Ferland Chapter 6 Basic Counting 1

DEFINITION 6.3

Let S be a finite sample space. The outcomes

in S are said to be equally likely if ∀ x, y ∈S, P(x) = P(y).

That is, ∀x ∈ S, P(x) =

27Ch6-p329

.||

1

s

Page 28: Discrete Mathematics, 1st Edition Kevin Ferland Chapter 6 Basic Counting 1

DEFINITION 6.4

If the outcomes in a finite sample space S are all equally likely, then the probability of an event E is given by

28Ch6-p329

||

||)(

S

EEP

Page 29: Discrete Mathematics, 1st Edition Kevin Ferland Chapter 6 Basic Counting 1

THEOREM 6.9

29Ch6-p330

Page 30: Discrete Mathematics, 1st Edition Kevin Ferland Chapter 6 Basic Counting 1

EXAMPLE 6.34

The license plates issued by a certain state consist of 3 letters (A to Z) followed by 4 digits (0 to 9). If all possible plates are equally likely to be chosen, then what is the probability that a randomly chosen plate will have some letter or digit repeated?

30Ch6-p330-331

Page 31: Discrete Mathematics, 1st Edition Kevin Ferland Chapter 6 Basic Counting 1

EXAMPLE 6.34 (Solution)

The sample space S is the set of all possible plates consisting of 3 letters followed by 4 digits. Hence,

|S| = 263 · 104 = 175760000.

31Ch6-p331

Page 32: Discrete Mathematics, 1st Edition Kevin Ferland Chapter 6 Basic Counting 1

EXAMPLE 6.34 (Solution) (Cont.)

Let E be the subset of plates in which some letter or digit is repeated.

Clearly, |Ec| = P(26, 3) · P(10, 4) = 78624000.

The desired probability is

32Ch6-p331

Page 33: Discrete Mathematics, 1st Edition Kevin Ferland Chapter 6 Basic Counting 1

THEOREM 6.10

33Ch6-p331

Page 34: Discrete Mathematics, 1st Edition Kevin Ferland Chapter 6 Basic Counting 1

EXAMPLE 6.36

(Home Security). A home security code consists of 4 digits (0 to 9). If all such codes are equally likely to be chosen, then what is the probability that a randomly chosen code will contain exactly 1 three or exactly 2 sixes?

34Ch6-p331

Page 35: Discrete Mathematics, 1st Edition Kevin Ferland Chapter 6 Basic Counting 1

EXAMPLE 6.36 (Solution)

Let S be the sample space of all possible 4-digit codes. Let E be the subset of codes containing exactly 1 three, and let F be the subset of codes containing exactly 2 sixes.

So E ∪ F consists of all codes containing exactly 1 three or exactly 2 sixes.

We seek P(E ∪ F).

35Ch6-p331

Page 36: Discrete Mathematics, 1st Edition Kevin Ferland Chapter 6 Basic Counting 1

EXAMPLE 6.36 (Solution) (Cont.)

Since

36Ch6-p332

Page 37: Discrete Mathematics, 1st Edition Kevin Ferland Chapter 6 Basic Counting 1

EXAMPLE 6.36 (Solution) (Cont.)

Theorem 6.10 gives that

37Ch6-p332

Page 38: Discrete Mathematics, 1st Edition Kevin Ferland Chapter 6 Basic Counting 1

Conditional Probability

DEFINITION 6.5

Let E and F be events in a sample space S with P(F) > 0. The conditional probability of E given F , denoted P(E | F ), is given by

38Ch6-p332

.)(

)()|(

FP

FEPFEP

Page 39: Discrete Mathematics, 1st Edition Kevin Ferland Chapter 6 Basic Counting 1

EXAMPLE 6.37

At a company picnic, the children played a soccer game, after which one player’s name was randomly drawn to win a prize.

The winning team in the soccer game consists of 7 girls and 4 boys, and the losing team consists of 5 girls and 6 boys.

Given that the prize winner is a boy, what is the probability that he also comes from the winning soccer team?

39Ch6-p332

Page 40: Discrete Mathematics, 1st Edition Kevin Ferland Chapter 6 Basic Counting 1

EXAMPLE 6.37 (Solution)

Let S be the set of 22 children that played soccer, let E be the event that the prize winner is from the winning team, and let F be the event that the prize winner is a boy.

The probability that we seek is P(E|F).

40Ch6-p333

Page 41: Discrete Mathematics, 1st Edition Kevin Ferland Chapter 6 Basic Counting 1

EXAMPLE 6.37 (Solution) (Cont.)

Note that E ∩ F is the event that the prize winner is a boy from the winning team.

Clearly,

We conclude that

41Ch6-p333

Page 42: Discrete Mathematics, 1st Edition Kevin Ferland Chapter 6 Basic Counting 1

DEFINITION 6.6

Two events E and F in a sample space S are said to be independent if

P(E ∩ F ) = P(E) · P(F ).

42Ch6-p333

Page 43: Discrete Mathematics, 1st Edition Kevin Ferland Chapter 6 Basic Counting 1

EXAMPLE 6.38

Consider the experiment of tossing two dice in sequence. Let E be the event that the first die shows a value of at most 3, let F1 be the event that the values on the two dice are the same, and let F2 be the event that the sum of the values on the two dice is 5.

Note that

43Ch6-p333

Page 44: Discrete Mathematics, 1st Edition Kevin Ferland Chapter 6 Basic Counting 1

EXAMPLE 6.38 (Cont.)

(a) Are E and F1 independent?

Solution.

and .

It follows that

So yes, E and F1 are independent.

44Ch6-p333

Page 45: Discrete Mathematics, 1st Edition Kevin Ferland Chapter 6 Basic Counting 1

EXAMPLE 6.38 (Cont.)

(b) Are E and F2 independent?

Solution.

and .

It follows that

So no, E and F2 are not independent.

45Ch6-p333

Page 46: Discrete Mathematics, 1st Edition Kevin Ferland Chapter 6 Basic Counting 1

THEOREM 6.11

46Ch6-p334

Page 47: Discrete Mathematics, 1st Edition Kevin Ferland Chapter 6 Basic Counting 1

THEOREM 6.11 -- Proof

E = E ∩ S = E ∩ (F1 ·· · ∪ ∪ Fn) = (E ∩ F1) ·· ∪· (∪ E ∩ Fn) is a disjoint union.

It follows that

47Ch6-p334

Page 48: Discrete Mathematics, 1st Edition Kevin Ferland Chapter 6 Basic Counting 1

COROLLARY 6.12

48Ch6-p334

Page 49: Discrete Mathematics, 1st Edition Kevin Ferland Chapter 6 Basic Counting 1

EXAMPLE 6.39

In a recent election, the majority of female voters preferred a different candidate from the one preferred by the majority of the male voters.

Exit polls showed that 75% of female voters chose candidate A, whereas 55% of male voters chose candidate B.

49Ch6-p334

Page 50: Discrete Mathematics, 1st Edition Kevin Ferland Chapter 6 Basic Counting 1

EXAMPLE 6.39 (Cont.)

50Ch6-p334

Assume that each voter chose either candidate A or candidate B and that an equal number of men and women voted.

(a) Which candidate won the election? Explain.

(b) If a randomly chosen voter is known to have voted for candidate A, then what is the probability that the voter is a female?

Page 51: Discrete Mathematics, 1st Edition Kevin Ferland Chapter 6 Basic Counting 1

EXAMPLE 6.39 (Solution)

To be simple, let A be the event that a voter chooses candidate A, let B be the event that a voter chooses candidate B, let F be the event that a voter is female, and let M be the event that a voter is male.

51Ch6-p334

Page 52: Discrete Mathematics, 1st Edition Kevin Ferland Chapter 6 Basic Counting 1

EXAMPLE 6.39 (Solution) (Cont.)

Based on the exit polls and the assumption that each voter chose A or B, we know that

P(A | F) = .75, P(B | F) = .25,

P(A | M) = .45, P(B | M) = .55.

We are also assuming that

P(F) = P(M) = .5.

52Ch6-p334

Page 53: Discrete Mathematics, 1st Edition Kevin Ferland Chapter 6 Basic Counting 1

EXAMPLE 6.39 (Solution) (Cont.)

(a) To determine who won, we apply Theorem 6.11. Observe that

P(A) = P(A | F)P(F) + P(A | M)P(M)

= (.75)(.5) + (.45)(.5) = .6.

Since candidate A received 60% of the votes, candidate A won the election.

53Ch6-p334

Page 54: Discrete Mathematics, 1st Edition Kevin Ferland Chapter 6 Basic Counting 1

EXAMPLE 6.39 (Solution) (Cont.)

(b) We seek P(F | A), the probability that a voter is female given that she voted for candidate A.

For this, Bayes’ Formula gives that

54Ch6-p335

Page 55: Discrete Mathematics, 1st Edition Kevin Ferland Chapter 6 Basic Counting 1

6.5 Applications of Combinations (Choices with Repetition)

EXAMPLE 6.42 (Barbecue Orders).A barbecue is attended by 7 people.Each person has the choice of a hamburger, a piece of

barbecued chicken, or a hot dog (but only one in each case) for the first food item.

If the cook will barbecue all 7 items at the same time and does not care who ordered what, then how many different barbecue orders are possible for the cook? We assume that there are ample supplies of each food type.

55Ch6-p341

Page 56: Discrete Mathematics, 1st Edition Kevin Ferland Chapter 6 Basic Counting 1

EXAMPLE 6.42 (Solution)

This is considered a problem involving choices with repetition, since the cook may receive multiple requests for any of the 3 items:

hamburger B, barbecued chicken C, or hot dog D.

56Ch6-p346

Page 57: Discrete Mathematics, 1st Edition Kevin Ferland Chapter 6 Basic Counting 1

EXAMPLE 6.42 (Solution) (Cont.)

A total order would consist of a list of length 7 of B’s, C’s, and D’s, but with no specified number of any particular choice. For example, one order might be CBBDBDB. To help motivate our counting technique, such an order could be recorded in the form of a table.

57Ch6-p346

Page 58: Discrete Mathematics, 1st Edition Kevin Ferland Chapter 6 Basic Counting 1

EXAMPLE 6.42 (Solution) (Cont.)

Imagine that the cook simply places a in the appropriate column of an order sheet as each order is taken. At the end, the order could more efficiently be recorded as a sequence of length 9 consisting of 7 ’s and 2 |’s.

| |

58Ch6-p346

Page 59: Discrete Mathematics, 1st Edition Kevin Ferland Chapter 6 Basic Counting 1

EXAMPLE 6.42 (Solution) (Cont.)

Here the headers B, C, D are understood. The point is that this is a binary sequence of length 9 containing 7 ’s (and 2 |’s). Note that the number of |’s is one fewer than the number of item choices. We conclude that the number of possible barbecue orders is

59Ch6-p346

Page 60: Discrete Mathematics, 1st Edition Kevin Ferland Chapter 6 Basic Counting 1

THEOREM 6.13

60Ch6-p346

Page 61: Discrete Mathematics, 1st Edition Kevin Ferland Chapter 6 Basic Counting 1

6.6 Correcting for Overcounting

EXAMPLE 6.44 (Seating Arrangements).

How many ways are there to seat 5 girls at a circular table if the particular seat taken by each girl does not matter and what matters to each girl is

(a) who is sitting to her left and who is sitting to her right?

(b) who is sitting next to her (which side does not matter)?

61Ch6-p351

Page 62: Discrete Mathematics, 1st Edition Kevin Ferland Chapter 6 Basic Counting 1

EXAMPLE 6.44 (Solution)

Temporarily call one seat the head of the table.If we keep track of which girl is seated at the head, then

there are 5! ways to seat the girls clockwise around the table.

However, 5! is an overcounting of what we want, since we have carried the extra structure of who is seated at the head of the table.

Given any such seating, if all of the girls stood up and shifted one position clockwise, then the new seating should be considered the same as the original.

62Ch6-p351

Page 63: Discrete Mathematics, 1st Edition Kevin Ferland Chapter 6 Basic Counting 1

EXAMPLE 6.44 (Solution) (Cont.)

(a) Each girl would still have the same neighbor to her left and the same neighbor to her right. Since there are 5 different rotations of any seating, we need to divide the original 5! count by 5.

Therefore, there are different seatings around the table.

63Ch6-p351

Page 64: Discrete Mathematics, 1st Edition Kevin Ferland Chapter 6 Basic Counting 1

EXAMPLE 6.44 (Solution) (Cont.)

(b) When which neighbor is to the left of a girl and which is to the right no longer matters, there are fewer than 24 different seatings.

Since only the set of 2 neighbors matters, if we take the mirror reflection of any seating from part (a), then the reflected seating should now be considered the same as the original.

64Ch6-p351

Page 65: Discrete Mathematics, 1st Edition Kevin Ferland Chapter 6 Basic Counting 1

EXAMPLE 6.44 (Solution) (Cont.)

Reflection preserves neighbors (and switches sides).

65Ch6-p351

Page 66: Discrete Mathematics, 1st Edition Kevin Ferland Chapter 6 Basic Counting 1

EXAMPLE 6.44 (Solution) (Cont.)

Since each seating from part (a) should be paired with its reflection, we need to divide the answer from part (a) by 2.

Thus, there are different seatings in which only neighbors matter.

66Ch6-p351