22
Melikyan/DM/Fall09 Discrete Mathematics Ch. 6 Counting and Probability Instructor: Hayk Melikyan [email protected] Today we will review sections 6.4, 6.5

Discrete Mathematics Ch. 6 Counting and Probability

  • Upload
    kapono

  • View
    75

  • Download
    0

Embed Size (px)

DESCRIPTION

Discrete Mathematics Ch. 6 Counting and Probability. Today we will review sections 6.4, 6.5. Instructor: Hayk Melikyan [email protected]. Combinations. Definition: An r-combination of a set of n elements is a subset of r elements. The symbol C(n, r), read - PowerPoint PPT Presentation

Citation preview

Page 1: Discrete Mathematics Ch. 6   Counting and Probability

1Melikyan/DM/Fall09

Discrete Mathematics

Ch. 6 Counting and Probability

Instructor: Hayk [email protected]

Today we will review sections 6.4, 6.5

Page 2: Discrete Mathematics Ch. 6   Counting and Probability

2Melikyan/DM/Fall09

CombinationsDefinition: An r-combination of a set of n elements isa subset of r elements. The symbol C(n, r), read “ n choose r” denotes the number of r-combinations

• Permutation is an ordered selection• Combination is an unordered selection

Example: Let S ={Ann, Bob, Cyd, Dan}. List all 3- combinations of S

Page 3: Discrete Mathematics Ch. 6   Counting and Probability

3Melikyan/DM/Fall09

Relationship between Permutations and Combinations

Example: Write all two permutations of the set {1, 2, 3, 4}

Page 4: Discrete Mathematics Ch. 6   Counting and Probability

4Melikyan/DM/Fall09

Theorem: The Number of subset of size r ( r-combinations) that can be chosen from a set of n elements, C(n, r), is given by the formula

C(n, r) = or equivalently

C(n, r) = where n and r are nonnegative integers with r n

n

r

P n r

r

( , )

!

n

r

n

n r r

!

( ) ! !

To form an r-permutation of a set of n elements first choose a subset of r of the n elements ( there are C(n, r) you can choose) then choose an ordering for the r elemets

Page 5: Discrete Mathematics Ch. 6   Counting and Probability

5Melikyan/DM/Fall09

Problems: There are 12 people, 5 men and 7 women, to work on a project:

– How many 5-person teams can be chosen? P(12, 5) = 792

– If two people insist on working together (or not working at all), how many 5-person teams can be chosen?

Page 6: Discrete Mathematics Ch. 6   Counting and Probability

6Melikyan/DM/Fall09

• Suppose two members of the group do not get along and refuse towork together on a team. How many 5-person teams can be formed?

Is there any alternatives to this solution?

Page 7: Discrete Mathematics Ch. 6   Counting and Probability

7Melikyan/DM/Fall09

Problem: Suppose the group consists of 7 women and 5 men.

1) How many 5-person teams contain at most 1 man?

Page 8: Discrete Mathematics Ch. 6   Counting and Probability

8Melikyan/DM/Fall09

How many 5-person teams contain at least 1 man?

Page 9: Discrete Mathematics Ch. 6   Counting and Probability

9Melikyan/DM/Fall09

Poker Hands: There are 52 cards in a deck. Each card has a suit and a value.

4 suits (♠ ♥ ♦ ♣)

13 values (2, 3, 4, 5, 6, 7, 8, 9, 10, J, Q, K, A)

Five-Card Draw is a card game in which each player is initially dealt a hand, a subset of 5 cards.

How many different hands?

Page 10: Discrete Mathematics Ch. 6   Counting and Probability

10Melikyan/DM/Fall09

Four of a Kind

A Four-of-a-Kind is a set of four cards with the same value.

How many different hands contain a Four-of-a-Kind?

A hand with a Four-of-a-Kind is completely described by a

sequence specifying:

1. The value of the four cards.

2. a card other than four cards selected in step 1.

By generalized product rule, there are 13x 48 = 624 hands.

Page 11: Discrete Mathematics Ch. 6   Counting and Probability

11Melikyan/DM/Fall09

What about Full House

A Full House is a hand with three cards of one value and two cards of another value.

How many different hands contain a Full House?

A Full Houses can be specified by selecting

1. The value of the triple, which can be chosen in 13 ways.

2. The suits of the triple, which can be selected in C(4,3) =4 ways.

3. The value of the pair, which can be chosen in 12 ways ( why12?).

4. The suits of the pair, which can be selected in C(4, 2) = 6 ways.

By generalized product rule, there are

Page 12: Discrete Mathematics Ch. 6   Counting and Probability

12Melikyan/DM/Fall09

How many hands have Two Pairs; that is, two cards of one value, two cards of another value, and one card of a third value?

1. The value of the first pair, which can be chosen in 13 ways.

2. The suits of the first pair, which can be selected C(4, 2) = 6 ways.

3. The value of the second pair, which can be chosen in 12 ways.

4. The suits of the second pair, which can be selected in C(4, 2) = 6 ways

5. The fifth card, which can be chosen in 44 ways.

So, is the total number = 13x6x12x6x44 ?

Double Counting

Page 13: Discrete Mathematics Ch. 6   Counting and Probability

13Melikyan/DM/Fall09

Problem: How many eight-bit strings have exactly three 1’s?

To solve the problem, imagine eight empty positions in to which the 0’s and 1’s of the bit strings will be placed

Once a subset of three positions has been chosen from the 8 to contain 1’s the remaining places must contain 0’s. So, the number of 8-bits containing exactly 3 1’s is C(8, 3) = 54 =

8

38 !

5 3

! !

Page 14: Discrete Mathematics Ch. 6   Counting and Probability

14Melikyan/DM/Fall09

Permutation of a Set with Repeated ElementsProblem: How many different ways can letters in the word MISSISSIPPI be arranged.

Solution: Imagine placing the 11 letters of this word one after another into 11 positions

Page 15: Discrete Mathematics Ch. 6   Counting and Probability

15Melikyan/DM/Fall09

Solution (continue)

Note that constructing an ordering for these letters can be thought of as four step process:

1. Select positions for the four S’s. C(11, 4)2. Select positions for the four I’s out of remaining 7 positions . C(7, 4)3. Select positions for the two P’s out of three positions. C(3, 2)4. Select a position for the M. C(1, 1)

C(11, 4) C(7, 4) C(4, 3) C(1.1) =

= = 34650

11

7 4

!

! !7

4 3

!

! !3

2 1

!

! !1

1 0 !

!

!

11

4 4 2 1

!

! ! ! !

Page 16: Discrete Mathematics Ch. 6   Counting and Probability

16Melikyan/DM/Fall09

Theorem: Suppose a collection consists of n objects of which:

n1 are type 1 and are indistinguishable from each other n2 are of type 2 and are indistinguishable from each

other... nk are of type k and are indistinguishable from each

otherand suppose that n1 + n2 = … + nk = n.

Then the number of distinct permutations of the n objects is

C(n, n1)C(n - n1, n2)C(n – n1- n2, n3). . . C(nk, nk) =

=

n

n n n k

!

! ! !1 2

Page 17: Discrete Mathematics Ch. 6   Counting and Probability

17Melikyan/DM/Fall09

Combinations with RepetitionDefinition: An r-combination with repetition allowed (or multiset of size r) chosen from a set X of n

elements is an unordered selection of elements where some elements can be repeated

Example: Find the number of 3-combinations with repetitions allowed from the set of4 elements {1, 2, 3, 4}

Page 18: Discrete Mathematics Ch. 6   Counting and Probability

18Melikyan/DM/Fall09

Theorem: The number of r-combinations with repetition allowed that can be selected from a set of n elements is

C(r + n -1, r) =

Example: How many monotone triples exist in a set of n elements?

Same as in example 6.5.3 from textbook.Here is the picture explaining for the case n = 5

r n

rn r

n r

1 1

1

( ) !

( ) ! !

Page 19: Discrete Mathematics Ch. 6   Counting and Probability

19Melikyan/DM/Fall09

Example (continue):

Thus any triple of integers (i, j, k) with 1 i j k n can be

represented as a sting of n -1 vertical bars and three crosses. By theorem

The number of such triples is

3 1

32

1 3

1 2

6

n n

n

n n n( ) !

( ) ! !

( )( )

Page 20: Discrete Mathematics Ch. 6   Counting and Probability

20Melikyan/DM/Fall09

Nice Example: Consider the implementing the following algorithm: for k := 1 to n for j := 1 to k

for i := 1 to j printf(“hello ”);

next Inext j

next k

How many times word hello will be printed if the program implementing this algorithm is run?

n n n( )( ) 1 2

6

Page 21: Discrete Mathematics Ch. 6   Counting and Probability

21Melikyan/DM/Fall09

Example: Integral solutions of an Equations

How many non-negative integral solutions are thereto the equation x1 + x2 + x3 + x4 = 10?

3 1 0

1 01 3

1 0 32 8 6

( ) !

( ) ! !

Page 22: Discrete Mathematics Ch. 6   Counting and Probability

22Melikyan/DM/Fall09

How many positive integral solutions are there for the above equation?

Which Formula to Use?

3 6

69

6 ! 38 4

!

!