# UPDATE:How many ways can we distribute $r$ identical balls into $n$ distinct boxes with exactly $m$ boxes empty

How many ways can we distribute $$r$$ identical balls into $$n$$ distinct boxes with exactly $$m$$ boxes empty

we're looking for exactly $$m$$ boxes empty.

So after fixing empty boxes in $$C(n,m)$$ ways, we want to solve $$x_1 + x_2 \ldots x_{n-m} = r$$ where $$x_i \geq 1 \; \forall 1\leq i \leq n-m$$ which gives $$C(r-1,n-m-1)$$

So answer should be $$C(n,m)*C(r-1,n-m-1)$$

which doesn't agree with one of the answers on this post:

So which is the correct answer?

• The question says that none of the boxes is to be empty, and has no mention of $m$. Where do you get, "We're looking for exactly $m$ empty boxes?" Commented Nov 3, 2019 at 22:57
• The post has identical balls and your has distinct and same problem with the boxes Commented Nov 3, 2019 at 22:58
• Sorry, wrong title, it's been updated. check now. I mis-typed the title at first. Commented Nov 3, 2019 at 22:59
• Yes, yours is correct. I have commented on the answer. Commented Nov 4, 2019 at 0:12

After fixing $$m$$ empty boxes ($$n\choose m$$ ways), and one ball in each of the other $$n-m$$ boxes (one way), you have $$r-(n-m)$$ balls remaining to put freely into $$n-m$$ boxes, and the stars and bars formula gives you $${[r-(n-m)]+[n-m]-1\choose [n-m]-1}={r-1\choose n-m-1}\text{ ways}$$