What's wrong with my way of calculating different ways of $m$ balls into $n$ bins with capacity $r$

60 Views Asked by At

There are quite some materials online with some fairly complicated results. For example.

https://www.mathpages.com/home/kmath337/kmath337.htm

And I know the proper way to handle this is inclusion-exclusion principle.

But what's wrong with below simple approach:

say I want $m$ balls into $n$ bins with capacity $r$.

So we want $x_1 + x_2 + ... + x_n = m$ where $0 \leq x_i \leq r, x_i \in Z^{+} $

or $-x_1 - x_2 + ... - x_n = -m$

we want $x_i \leq r$, so $-x_i +r \geq 0$. Let $y_i = -x_i + r$, then above is

$y_1 + y_2 + ... + y_n = rn - m$, $y_i \geq 0$

Then now it's a classical problem of putting $rn-m$ balls in $n$ bins

what's worng with my approach?

2

There are 2 best solutions below

0
On BEST ANSWER

As Saulspatz pointed out you have $$y_1 + y_2 + ... + y_n = rn - m$$ with $ y_i \geq 0.$ That's good. You are correct so far, and you have not done anything bad so far. But to apply the standard distribution technique you also need that $ y_i \leq rn - m.$ Unfortunately, you don't have that criterion in your conditions. I hope it helps.

0
On

There is nothing wrong with your approach.

Now, you are just distributing $rn-m$ "non-balls" into $n$ boxes with space for maximum $r$ "non-balls" each, which means $0\leq y_i\leq r $ for $i=1,\ldots ,n$.