0

I would like to count the number of ways to distribute $20$ identical balls to $6$ different boxes, where exactly only $1$ box is empty.

Let $r$ be the number of objects and $n$ be the number of boxes.

Since in this case $r$ is empty while $n$ is distinct, and there is at least $1$ empty box, $r = 20$ and $n = 5$

I have decided to use the formula $\displaystyle H^r_{r-n}$ which gives me $\displaystyle H^{20}_{15} = \binom{34}{15} ={1,855,967,520}$, (Since $H^n_{r}$ = ${r+n-1}\choose{r}$)

However since there are $6$ ways to choose the empty box, I am not sure of how to go through with the final answer. Should I be multiplying the answer by $6$?

Meowmi
  • 303

2 Answers2

4

Assume that $a$ balls go to first box, $b$ to second and so on and $f$ to the sixth box.

Now, we have the equation $a+b+c+d+e+f=20$. But your condition says exactly $1$ must be $0$. So we put one variable to $0$ in the above equation and ensure that all the other variables are $\geq 1$.

So let's say $f=0$, so we have $a+b+c+d+e=20$ where $ a,b,c,d,e \ge 1 $.

The solution to this can be easily found by forming a generating function $(x+x^2+x^3+\cdots)^5$ in which we have to find the coeffcient of $x^{20}$. That can be easily found now.

Or, if one doesn't wants to make a generating function, we use stars and bars method here. Let $a'=a+1,b'=b+1,\cdots,e'=e+1$ so that $a',b',\cdots,e'$ are now $\geq 0$ and after plugging these variables into our equation, we get our new equation as $a'+b'+c'+d'+e'=15$, whose solution by stars and bars is given by $\displaystyle \binom{15+4}{4}=\binom{19}{4}$.

But since we assumed $f=0$, we could have any of $a,b,c,d,e$ to be $0$, so we multiply this number by $6$, thus final answer turns out to be $\displaystyle 6\binom{19}{4}$.


Note that $a'$ is not to be confused with a derivative (see comments), it's just another variable!

V.G
  • 4,196
  • Why do you do $a',b'...e'$??? Is that differentiating or just letting $a$ -->$a+1$? (edit: well... I know it wasn't differentiating) – user71207 Jan 04 '21 at 03:41
  • (edit2: nevermind "Let ′=+1,′=+1,⋯,′=+1 so that ′,′,⋯,′ are now ≥0" I'm blind) But I still don't get why you had to make that substitution. – user71207 Jan 04 '21 at 03:47
  • Also how can $ 1≤,,,,≤20$ if$ ++++=20$? If $a=20$, then automatically the equation is false since the smallest numbers that the other letter can be within the domain is $1$ – user71207 Jan 04 '21 at 04:05
  • 1
    I just let another variable as $a'=a+1$ and similarly others, it could be any other variable also. I made the substitution because while we are finding the solutions to an equation of the form $a_1+a_2+\cdots+a_n=m$, where any of $a_1,a_2,\cdots,a_n$ could be $0$, it is given $\displaystyle \binom{m+n-1}{n-1}$. But we had in our case $a,b,\cdots,e \ge 1$ , so to remove that restriction, variable change was necessary. – V.G Jan 04 '21 at 05:33
  • @user71207, Ah! I shouldn't have put $\le 20$ there. I will edit that. Thanks! – V.G Jan 04 '21 at 05:36
  • Ohhh so you can only solve that particular equation (using stars and bars) if they are integers $≥0$? – user71207 Jan 04 '21 at 05:42
  • Yes. Or, as I said, use generating functions otherwise. Also, read comments of the other answer by @Brian M Scott. – V.G Jan 04 '21 at 05:43
2

No, you should be multiplying by $6$, the number of different ways to choose which box is empty. But you’ve also drastically overcounted the possible distribution of $20$ balls in $5$ boxes when each box is required to get at least one ball. (Remember, only one box is empty.)

There are $6$ ways to choose which box is to be empty. Once that choice is made, there are $\binom{20-1}{5-1}=\binom{19}4$ ways to distribute the $20$ balls to the other $5$ boxes in such a way that each box gets at least one ball. (See Theorem One in the Wikipedia article on stars and bars.) Thus, there are altogether $6\binom{19}4=23,256$ distributions that meet the conditions.

Brian M. Scott
  • 616,228
  • 1
    How to visualize star-bar method when there are bounds on no. of objects? Say the second box can't contain more than 7 objects and third can't contain more than 5. Generating function can solve it. But I wonder how to solve using star bar. Any suggestions/hints? – Koro Aug 28 '20 at 05:44
  • 1
    I guess you can solve it when there are lower bounds on the variables in stars and bars but for upper bounds, you only have to use generating function. – V.G Aug 28 '20 at 05:47
  • 2
    @ABCD: You don’t have to use generating functions in that case: you can also use inclusion-exclusion. – Brian M. Scott Aug 28 '20 at 05:48
  • @BrianM.Scott yeah, right...I forgot about I.E. But inclusion exclusion gets a little complicated though.... – V.G Aug 28 '20 at 05:49
  • 1
    @Koro: You can also use an inclusion-exclusion argument. – Brian M. Scott Aug 28 '20 at 05:49
  • @ABCD: yes, it can get a bit messy; it’s not hard, but it does take a little work to keep track of everything. – Brian M. Scott Aug 28 '20 at 05:50
  • Thanks sir. But I find IE intimidating and I try to avoid it as much as I can. The reason is that it's easy to visualize when no. of objects is small (e.g. No of onto functions from A to B when cardinals of A, B are 3, 2 respectively). But for large nos. it becomes difficult to visualize. Why $+, - $ alternate? And it's difficult to explain it to someone also. – Koro Aug 28 '20 at 05:55
  • 1
    @Koro: It’s easier to see why the $+$ and $-$ alternate if you realize that the first term overestimates the number, and each successive correction term overcorrects. Thus, you subtract the second term to get rid of the overcounting, but it turns out that it subtracts too much, so that now you’re undercounting. The third term is added to correct the undercounting, but again it overcorrects, so that the total is now too high. And so on, until you get to the end. – Brian M. Scott Aug 28 '20 at 06:03
  • @ABCD: Thanks a lot. I think so too. But I saw an answer on MSE (trying to find the link...) wherein first the excess sum was found. Example: non -ve integer solutions of $x+y+z=12$,$x,y\le 5$, $z\le 10$ so the maximum sum is $5+5+10=20$. So star bar was applied to excess sum $(20-12)=8$. I don't know how. – Koro Aug 28 '20 at 06:23
  • 1
    @Koro: See if my answer to this question helps. (I'll check back tomorrow sometime.) – Brian M. Scott Aug 28 '20 at 06:43