6

What is the number of ways of distributing $N$ indistinguishable balls into $M$ bins such that at least one bin has at least $n$ balls in it?


My attempt:

The number of ways of of placing $N$ balls into $M$ bins is $\binom{N+M-1}{N}$.

I tried, by stars and bars, to calculate the number of ways of distributing $N$ indistinguishable balls into $M$ bins such that exactly one bin has exactly $n$ balls in it:

If the first or last bin contains the $n$ balls, we have used one partition, so there are $M-2$ left. This gives $2\binom{N-n+M-2}{N-n}$ ways.

If the second to $(M-1)$th bin contains the $n$ balls, we have used two partitions, which gives $(M-2)\binom{N-n+M-3}{N-n}$ ways.

So the total number of ways of distributing $N$ indistinguishable balls into $M$ bins such that exactly one bin has exactly $n$ balls in it is $$2\binom{N-n+M-2}{N-n}+(M-2)\binom{N-n+M-3}{N-n}.$$

Is this correct? It seems like a strange result.

Then I thought about simply summing this expression for $n$ going from $n$ to $N$, i.e.,

$$\sum_{k=n}^N 2\binom{N-k+M-2}{N-k}+(M-2)\binom{N-k+M-3}{N-k},$$

in order to obtain the expression for "at least $n$ balls," but I feel like this would be over-counting somehow.

And then there is the issue of "at least one bin," which I am rather blunted by.

Any help is much appreciated!

Note that I'm looking for a closed form solution to the problem in the yellow box. Thanks.

2 Answers2

1

This is a fairly ugly problem; probably the most straightforward approach is the calculate the number of distributions that have fewer than $n$ balls in each bin and subtract that number from $\binom{N+M-1}N$. Unfortunately, there does not seem to be a closed form for the subsidiary problem. By a combination of stars and bars and inclusion-exclusion one can show that there are

$$\sum_i(-1)^i\binom{M}i\binom{N+M-1-in}{M-1}$$

of these ‘bad’ distributions.

Note that the $i=0$ term is $\binom{N+M-1}{M-1}=\binom{N+M-1}N$; the other terms from the inclusion-exclusion calculation get rid of the distributions that have more than $n$ balls in some bin. Thus, the answer to your question is actually just the negative of the some of the terms with $i>0$, i.e.,

$$\sum_{i=1}^M(-1)^{i+1}\binom{M}i\binom{N+M-1-in}{M-1}\;.$$

The inclusion-exclusion argument itself is pretty straightforward; I can give it in detail if you wish, though I’m not sure how useful the result is.

In this answer Marc van Leeuwen uses generating functions to deal with the more general problem in which each bin has its own upper limit, but he starts with the simpler case in which all of the limits equal, as in your question.

Brian M. Scott
  • 616,228
  • Thank you very much for your time! – Bobson Dugnutt Sep 07 '16 at 07:12
  • @Lovsovs: You’re very welcome! – Brian M. Scott Sep 07 '16 at 07:15
  • Hmm, there is something I don't understand: When I (in Mathematica) plot the ratio "the sum you found"/$\binom{N+M-1}{M-1}$ I always get $1$, even though I would expect to get something less than. What is going on you think? – Bobson Dugnutt Sep 07 '16 at 07:36
  • The bad distributions can be counted as the coefficient of $x^N$ in the expansion $(1+x+x^2+\cdots+x^{n-1})^M = (1-x^n)^M(1-x)^{-M}$ –  Sep 07 '16 at 07:42
  • @Lovsovs: I don’t know; I’d have to play with it. I did just now spot and fix a small error, where I had $n+1$ instead of $n$, but if you were looking at a variety of values of $N,M$, and $n$, the error shouldn’t have made much difference in the overall pattern. It’s almost four in the morning here, and I’m about to head for bed, but I’ll take a look tomorrow. – Brian M. Scott Sep 07 '16 at 07:44
  • Thank you (and sleep well!). – Bobson Dugnutt Sep 07 '16 at 07:46
  • @Lovsovs: I’ve calculated a few small examples by hand, both using the summation formula and, to check, using alternative ad hoc approaches, and they all seem to work out correctly. In particular, I get a ratio of $1$ only when $N>M(n-1)$, so that some bin necessarily has at least $n$ balls. Are you sure that you coded it right? – Brian M. Scott Sep 07 '16 at 16:25
  • I think I'm misunderstanding something`fundamental here: Let's say we have as many balls as bins, so $N=M$. We have a size of the set of all possible configurations, which is $\binom{2N-1}{N}$. I'm interested in finding the size of the subset in which there are at least $n$ balls in some (or more) bins. But surely the subset is always smaller than the original set (for $n>0$)? How could this ever give a ratio of one? – Bobson Dugnutt Sep 07 '16 at 17:00
  • @Lovsovs: Suppose that $N=M=3$, and $n=1$. It’s impossible that every bin is empty, so some bin must have at least $1$ ball, and the ratio will be $1$. – Brian M. Scott Sep 07 '16 at 17:02
  • Yes, but let's say $n=3$ - there are then only three (out of ten) configurations that have at least $n$ balls in one bin. Do you then get the ratio to be $\frac{3}{10}$, because I still get it to be $1$? – Bobson Dugnutt Sep 07 '16 at 17:14
  • @Lovsovs: Yes, I get $\frac3{10}$. The calculation is $$\sum_{i=1}^3(-1)^{i+1}\binom3i\binom{3+3-1-3i}{3-1}=\sum_{i=1}^3(-1)^{i+1}\binom3i\binom{5-3i}2=\binom31\binom22=3;;$$ the other two terms are $0$. – Brian M. Scott Sep 07 '16 at 17:25
  • Ah, because of the convention that binomial coefficients are zero when their arguments are negative? Thanks for clearing that up! :) – Bobson Dugnutt Sep 07 '16 at 17:29
  • @Lovsovs: Yes. I define $\binom{x}k$ to be $\frac{x^{\underline k}}{k!}$ for arbitrary real $x$ and non-negative integers $k$, where $x^{\underline k}$ is the falling factorial, and $0$ in all other cases. You’re welcome! – Brian M. Scott Sep 07 '16 at 17:31
-1

Seems that it's not correct, since you going to have double counting for the case where cell 1 and cell 2 both have $n$ balls.

Try use inclusion-exclusion principle.

It's easy using the properties $p_i = \mathrm{The\space ith\space cell\space has\space at\space least\space n\space balls}$ to calculate $E(0)$ the case when no property holds. For $r$ different properties to hold, we want that $r$ specific cells will have at least $n$ balls we first put $n$ balls in each of them and then the rest $N - rn$ we split however we want, so we get: $$ w(p_{i_1},...,p_{i_r}) = {{N + M - rn - 1}\choose N - rn}$$ and with the number of ways to pick $r$ different properties and the fact that the properties are symmetric we get $$ w(r) = {M \choose r} \cdot {{N + M - rn - 1}\choose N - rn} $$

Now we have that $$E(0) = {{N+M-1}\choose{N}} - \sum_{r=1}^M (-1)^r\cdot w(r)$$

After calculating $E(0)$ use the fact that whats youre loking for is the complement of $E(0)$ which gives you that the desired number is: $${{N+M-1}\choose{N}} - E(0) = \sum_{r=1}^M (-1)^r\cdot w(r)$$

Snufsan
  • 2,125
  • Thanks for the answer. I haven't had any experience with IE-principle, so it would be a great help if you could demonstrate how to use it on this problem. – Bobson Dugnutt Sep 06 '16 at 12:05
  • I edited my answer... try reading https://en.wikipedia.org/wiki/Inclusion%E2%80%93exclusion_principle if you still cant understand... – Snufsan Sep 06 '16 at 12:17
  • Doesn't $r$ running from $1$ to $M$ (giving $N+M-Mn-1$ in the end) potentially give negative values in the binom-coeff.? For instance, what if $N=M$? 2) Should the final expression then be summed (as in the question) to answer the question in the yellow box?
  • – Bobson Dugnutt Sep 06 '16 at 13:16
  • if the one of the terms is negative in the binomial coefficient then we usually define that in that case the coefficient is 0 – Snufsan Sep 06 '16 at 15:15