Presentation on theme: "4.5 Generalized Permutations and Combinations"— Presentation transcript:
1 4.5 Generalized Permutations and Combinations Lecture 64.5Generalized Permutations and Combinations
2 Recap r-permutations: The number of ways in which we can draw r balls from a collection of n different balls, where the orderis important: P(n,r) = n! / (n-r)!r-combinations: The number of ways in which we can draw r ballsfrom a collection of n different balls, where we do not careabout the ordering: C(n,r) = n! / r! (n-r) !Today: we study counting problems where repetitions are allowed,i.e. it is possible that the same ball is drawn multiple times.
3 4.5 X X X X r boxes n balls 1 2 3 4 1 2 3 4 we over-counted by r! n waysn-1 waysn-r+1 waysdifferentbecausethe slotshave labels(distinguishable)n balls1234X1234XXr-permutation without repetition (order important)Xr-combination without repetition (order not important)the balls are not replacedwhen they have been drawnthe samebecausethe slotshave no labels(indistinguishable)we over-counted by r!
4 4.5 r boxes n balls 1 2 3 4 1 2 3 4 this one is tricky ! n ways n ways differentbecausethe slotshave labels(distinguishable)n balls12341234r-permutation with repetition (order important)r-combination with repetition (order not important)the balls are replacedwhen they have been drawn.Or there is a very large stackof indistinguishable ballsof each color.the samebecausethe slotshave no labels(indistinguishable)this one is tricky !
5 4.5Example: We want to draw 2 pieces of fruit from a bowl that contains many2 apples, 2 pears, and 2 oranges. In how many ways can we do this such that:1) The apples are different and the order matters.2) The apples are different and the order does not matter.3) The apples are indistinguishable but the order matters.4) The apples are indistinguishable and the order does not matter. 1) 6 * 5 = P(6,2) 2) 6 * 5 / 2 = C(6,2) 3) Now there are 3 kinds of fruit that we draw with replacement (since there areenough of each kind to be able to pick any fruit at any draw). This is truebecause drawing apple 1 is no different than drawing apple 2. It’s like thereare copies of the same apple present.Thus: 3 * 3 = 9( a a), (a p), (a o), (p a), (p p), (p o), (o a), (o p), (o o). 4) Since the order doesn’t matter (a p) = (p a), idem (a o)=(o a), (p o)=(o p).we over-counted 3 pieces: 9-3 = 6.
6 4.5 How to count the latter (r-combination with repetition)? One strategy could be to start from drawing where the order matters andtry to count the number of ways we over-counted (last example).However, there is a much smarter way!Map the problem to a bit-string as follows:balls becomeindistinguishableindistinguishable slotsbecome becomedistinguishable boxes.C(n+r-1,r) bit-strings !
7 4.5 n is number of distinct classes of objects in the original bag! - r-permutation without repetition- order matters(r distinguishable slots)- without replacement(n distinguishable objects)- r-combination without repetition- order does not matter(r indistinguishable slots)- without replacement(n distinguishable objects)n! / r! (n-r)!n! / (n-r)!- r-permutation with repetition- order matters(r distinguishable slots)- with replacement(n distinct classes of indistinguishableobjects)n^r- r-combination with repetition- order does not matter(r indistinguishable slots)- with replacement(n distinct classes of indistinguishableobjects)(n+r-1)! / r! (n-1)!
8 4.5Another problem:Assume we have exactly n objects in a bag, and we are going to drawall of them. The order in which we draw them is important, howevern1 objects are indistinguishable, n2 different objects are indistinguishable etc.This is like: you can only replace the blue ball 2 times, the red ball 3 times etc.)(b b r r r) is different from (b r b r b r), but theblue balls are the same and the red balls are the same.(2 distinct classes of indistinguishable balls of size2 and 3 and distinguishable slots).12345Here we can first count the total number of permutations, pretending all balls aredifferent n! (n = number of balls, not kinds of balls)Now try to figure out which strings are equivalent:(b1 b2 r1 r2 r3) = (b2 b1 r1 r2 r3). There are 2! ways to permute the blue balls.(b1 b2 r2 r2 r3) = (b1 b2 r2 r1 r3). There are 3! ways to permute the red balls.
9 4.5 Therefore the total number of ways is: 5!/2! 3!. In general: n!/ n1! n2! ...nk! with n=n1+n2+...+nkAlternate derivation:-For the first kind we have n slots and n1 balls to place such that theorder is unimportant: C(n,n1)-For the second kind there are then n-n1 slots still opento place n2 balls: C(n-n1,n2) ... etc.-For the last kind we have (n-n1-n2-...-n_(k-1)) slots forthe remaining nk balls: C(n-n1-n2-...-n_(k-1),nk).Total thus: C(n,n1) C(n-n1,n2)..... = n!/ n1! n2! ...nk! (check it!)
10 4.5Yet another problem:In how many ways can we distribute n different objects into k different boxessuch that n1 objects go in box 1, n2 objects go in box 2,... nk objects go in box k.(k distinguishable boxes with n distinguishable balls)412653(b r r b b g)Trick: the colors are now the boxes, so we assign boxes to balls instead ofballs to boxes! From the previous problem we know there aren!/n1! n2!...nk! ways to assign the boxes with k colors to the n balls.
11 4.5Examples:1) How many ways are there to select five bills from a cash box containing$1, $2, $5, $10, $20, $50 and $100 bills, such that the bills are indistinguishableand the order in which they are selected is unimportant. (there are also at least5 bills of each kind). This is like drawing colored balls with replacement. The colors correspond tothe values. Since the order doesn’t matter we have: C(7+5-1,5)=4622) A cookie shop has 4 kinds of cookies and we want to pick 6. We don’t careabout the order and cookies from one kind are indistinguishable. Again, drawing colored balls with replacement: colors are kind of cookies.C(6+4-1,6)=84.3) How many solutions to x1+x2+x3=11 with xi nonnegative integers.This is like throwing 11 balls in 3 boxes. The balls inside each boxe areindistinguishable. C(11+3-1,11)=78.
12 4.5Examples:1) In how many ways can we place 10 indistinguishable items in 8 distinguishableboxes. This is precisely the problem we saw to solve the r-combination with repetition:C(10+8-1,10)2) How many different “words” can we create by reordering SUCCESS ?Total number of permutations is 7!. However permuting the 3 S’s does notcreate a new word, idem 2 C’s: 7!/3! 2!3) In how many ways can we distribute a deck of 52 cards over 4 hands such thateach hand gets 5 cards? There are 4 boxes which receive 5 cards and 1 box which receives 32 cards.Assign people to cards instead: 52! / (5!)^5 32!
13 4.5 Exercise52 p. 344: How many different cross terms will we generate when we multiply out:(x1+x2+...+xm)^n ? How many different exponents are there of the sort x1^n1 x2^n2 ... xm^nmwith n1+n2+...+nm=n.Equivalent to : how many different way are there to put n balls in m boxes:C(n+m-1,n)38 p.342. Math teacher has 40 issues of a journal and packs them into 4 boxes,10 issues each.a) How many ways if the boxes are numbered? assign boxes to issues: 40! / (10!)^4b) Now the boxes are indistinguishable. There are 4! ways to label the boxes,once we have distributed them in unlabelled boxes.Since the number of ways to distribute them in labeled boxes is given by a)we get 40! / (10!)^4 4!.