Monday, 14 July 2014

Stars and Bars combinatorics




This is my second question on MSE, as my first one had format issues. So apologies for that!



I have a problem here.




How many ways can you distribute 4 balls into 3 boxes?




I would calculate x1+x2+x3=4 (right?)

But further on, there is a fixed constraint on each of the variables, stating that only a maximum of 2 is allowed in each box. (non negative allowed).
So I write, y1=x12,y2=x22,y3=x32



This gives




x12+x22+x32=4222
y1+y2+y3=2





I am stuck there. It gives a negative value, how will I be able to count for it? Please correct me and help if there are any problems!



Thank you so much! :)


Answer



So your example is to count the number of solutions (x1,x2,x3) to x1+x2+x3=4 where 0xi2 for all i



The generating function way to do this is to compute the coefficient of x4 in (1+x+x2)4=x6+3x5+6x4+7x3+6x2+3x+1,
which equals 6 here.



Another way: count all solutions without maximum restrictions by stars and bars:
this gives \binom{6}{2} = 15. There are 3 trivial ones with one x_i =4, the others 0, which we subtract and also a few where some x_i = 3. (these options are mutually exclusive, and at most one can be equal to 3) The last problem is equivalent to the remaining two variables summing to 1 = 4-3, so there are 2 solutions for fixed x_i = 3, and there are 3 choices for the x_i, so 6 solutions in all have this property. And 15 - 3 - 6 = 6 agreeing with the first solution.



No comments:

Post a Comment

real analysis - How to find lim_{hrightarrow 0}frac{sin(ha)}{h}

How to find \lim_{h\rightarrow 0}\frac{\sin(ha)}{h} without lhopital rule? I know when I use lhopital I easy get $$ \lim_{h\rightarrow 0}...