Professional Documents
Culture Documents
4.5
Generalized Permutations and
Combinations
Recap
r-permutations: The number of ways in which we can draw r balls
from a collection of n different balls, where the order
is important: P(n,r) = n! / (n-r)!
X 1 2 3 4
X X
r-permutation without repetition (order important)
X
r-combination without repetition (order not important)
we over-counted by r!
r boxes
1 2 3 4
1) 6 * 5 = 30 P(6,2)
2) 6 * 5 / 2 = 15 C(6,2)
3) Now there are 3 kinds of fruit that we draw with replacement (since there are
enough of each kind to be able to pick any fruit at any draw). This is true
because drawing apple 1 is no different than drawing apple 2. It’s like there
are 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.
How to count the latter (r-combination with repetition)?
One strategy could be to start from drawing where the order matters and
try to count the number of ways we over-counted (last example).
balls become
indistinguishable
indistinguishable slots
become become 0 1 0 0 0 1 1 1 1 C(n+r-1,r) bit-strings !
distinguishable boxes.
4.5
n is number of distinct classes of objects in the original bag!
n! / (n-r)! n! / r! (n-r)!
1 2 3 4 5
Here we can first count the total number of permutations, pretending all balls are
different 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.
4.5
Therefore the total number of ways is: 5!/2! 3!.
In general: n!/ n1! n2! ...nk! with n=n1+n2+...+nk
Alternate derivation:
-For the first kind we have n slots and n1 balls to place such that the
order is unimportant: C(n,n1)
-For the second kind there are then n-n1 slots still open
to place n2 balls: C(n-n1,n2) ... etc.
-For the last kind we have (n-n1-n2-...-n_(k-1)) slots for
the 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!)
4.5
Yet another (?) problem:
In how many ways can we distribute n different objects into k different boxes
such 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)
4
1 2
6 5 3
(b r r b b g)
Trick: the colors are now the boxes, so we assign boxes to balls instead of
balls to boxes! From the previous problem we know there are
n!/n1! n2!...nk! ways to assign the boxes with k colors to the n balls.
4.5 Balls in Boxes
Often, you can reverse the role of the balls and the boxes.
1 2 3 4
n^r balls are distinct
slots are distict
4
1 2
6 5 3
Distinct balls in identical boxes when the numbers of balls are known?
2) A cookie shop has 4 kinds of cookies and we want to pick 6. We don’t care
about 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) In how many ways can we distribute a deck of 52 cards over 4 hands such that
each 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!)^4 32!
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!)^4
b) 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!.
10 40 38
28
7 4 9
27
8 1 2
17
6 5 3
15
Book-Shelve Problems
4.5, Exercise 45
In how many ways can you put n different books on k different shelves?
(shelves can hold all books).
solution 1: Place books one by one. First book on k shelves. Second book
to the left or right of existing book, or on empty shelve (2+k-1=k+1).
Total: k(k+1)(k+2) ... (k+n-1) = (n+k-1)! / (k-1)!
solution 2: There are n! ways to put them into a sequence. Now we need to cut
the sequence into k subsequences using k-1 identical dividers. Imagine the dividers
look like identical books how many bit-strings are there with k-1 ones (dividers)
and n zeros (books): C(n+k-1,k-1). Total: C(n+k-1,k-1) n! = (n+k-1)!/(k-1)!