Stars And Bars

# Stars And Bars - * 9? NO, because the two bars are...

This preview shows page 1. Sign up to view the full content.

CSE 21: Notes on Stars and Bars (April 17, 2007) Problem: We are given n undistinguishable balls and k distinguishable bins. How many ways are there to drop the balls in the bins? Solution. Let’s see an example. Suppose we have 8 balls and 3 bins, where the numbers of balls in the bins are 2 , 3 , 3: Such an assignment of balls can be obtained in this way: 1. Put all the balls in a row. 2. We want to separate balls into three groups, each for a bin. The tricky way to do this is inserting two bars between adjacent balls. Inserting the bars into diﬀerent positions gives diﬀerent ways of dropping balls. 3. Let’s count. We need to insert two undistinguishable bars into 9 possible positions. Note that each bar has 9 possible ways to insert. (a) Is the answer 9 · 8? NO, because two bars can be inserted into the same position! (b) Then the answer must be 9
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: * 9? NO, because the two bars are identical; it doesnt matter which bar is insert rst. So, how do we count? Here is another trick: when the bars are inserted, we have 8 + 2 = 10 objects (balls + bars). Where are the bars? The bars occupy two of the 10 positions. The problem becomes clear now: we need to choose two of the 10 positions for the bars. As we learned, there are ( 10 2 ) ways to do this. Generally, if we have n balls and k bins, then we need to insert k-1 bars. There are n + k-1 objects (balls + bars). We need to choose k-1 positions for the bars. Then answer is n + k-1 k-1 . P.S. An explicit expression for S ( n, k ), Stirling number of the second kind: S ( n, k ) = 1 k ! k X j =1 (-1) k-j k j j n 1...
View Full Document

## This note was uploaded on 12/03/2009 for the course CSE 21 taught by Professor Graham during the Spring '07 term at UCSD.

Ask a homework question - tutors are online