340 likes | 749 Views
Discrete Mathematics Ch. 6 Counting and Probability. Today we will review sections 6.4, 6.5. Instructor: Hayk Melikyan melikyan@nccu.edu. Combinations. Definition: An r-combination of a set of n elements is a subset of r elements. The symbol C(n, r), read
E N D
Discrete MathematicsCh. 6 Counting and Probability Today we will review sections 6.4, 6.5 Instructor: Hayk Melikyan melikyan@nccu.edu
Combinations • Definition: An r-combination of a set of n elements is • a 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
Relationship between Permutations and Combinations • Example: Write all two permutations of the set {1, 2, 3, 4}
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 • 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
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?
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?
Problem: Suppose the group consists of 7 women and 5 men. 1) How many 5-person teams contain at most 1 man?
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?
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.
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
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
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 =
Permutation of a Set with Repeated Elements • Problem: 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
Solution (continue) • Note that constructing an ordering for these letters can be thought of as • four step process: • Select positions for the four S’s. C(11, 4) • Select positions for the four I’s out of remaining 7 positions . C(7, 4) • Select positions for the two P’s out of three positions. C(3, 2) • Select a position for the M. C(1, 1) C(11, 4) C(7, 4) C(4, 3) C(1.1) = = = 34650
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 . . .nkare 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) = =
Combinations with Repetition • Definition: 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}
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
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
Nice Example: Consider the implementing the following algorithm: for k := 1 to n for j := 1 to k for i := 1 to jprintf(“hello ”); next I next j next k • How many times word hello will be printed if the program implementing this algorithm is run?
Example: Integral solutions of an Equations • How many non-negative integral solutions are there • to the equation x1 + x2 + x3 + x4 = 10?
How many positive integral solutions are there for the above equation? • Which Formula to Use?