1

This is related to a lot of other combinatorics problems but I am struggling with it:

How many ways are there do distribute $n$ objects into $k$ bins of given size $\mathbf{(n_1, \dots, n_k)}$, where $n_k \geq 1$?

Here is an example: Given $n=4$ objects $x_1,x_2,x_3,x_4$, consider the problem of distributing them among $k=2$ bins of sizes $(n_1 = 1, n_2 = 3)$. There are 4 ways to do this: $$ [(x_1),(x_2,x_3,x_4)],[(x_2),(x_1,x_3,x_4)],[(x_3),(x_1,x_2,x_4)],[(x_4),(x_1,x_2,x_3)] $$

Here is what I have understood so far:

1) We can identify some constraints: $\sum_{i=1}^k n_i = n$ (number of objects is $n$) and $k \leq n$ (at least $1$ item per bin so there can be at most $n$ bins).

Assume these are always satisfied, i.e. the problem is always correctly posed.

2) Stars and Bars gives the number of different bin size distributions, given $n$ objects and $k$ bins. For example, to distribute $n=4$ objects into $k=2$ bins there are $\binom{n-1}{k-1} = \binom{3}{1} = 3$ possibilities, which are the bin sizes (1,3),(2,2),(3,1). This isn't directly useful because in this case I want to treat bin sizes $(1,3)$ and $(3,1)$ as indistinguishable.

3) The leading answer here seems related, but I am unsure how to generalize this case. This kind of problem is related to the problem of finding the number of solutions to $$ \sum_{i=1}^k x_i = n $$ where each of the $x_i$ has to be one of the $n_i$ seems related. For example, consider the problem: distributing $n=4$ objects into $k=2$ bins of sizes $(n_1=2,n_2=2)$. There are 3 ways to do this: $$ [(x_1,x_2),(x_3,x_4)],[(x_1,x_3),(x_2,x_4)],[(x_1,x_4),(x_2,x_3)] $$

but the equation $$ x_1 + x_2 = n = 4 $$

where $x_1,x_2$ have to be one of $(n_1=2,n_2=2)$ has only two solutions: $(x_1=n_1,x_2=n_2)$ and $(x_1=n_2,x_2=n_1)$, so this is also not correct.

Thanks for your help!

smörkex
  • 601

1 Answers1

1

Since bins with the same size are indistinguishable we assume ordered arrangements \begin{align*} 1\leq n_1\leq n_2\leq \ldots \leq n_k\leq n \end{align*} with \begin{align*} n_1+n_2+\cdots+n_k=n \end{align*} and classify them in tuples according to equal bin sizes:

Let $(c_1,c_2,\ldots,c_j)$ be a $j$-tuple with \begin{align*} &n_1=n_2=\ldots=n_{c_1}\\ &\qquad <n_{c_1+1}=n_{c_1+2}=\ldots=n_{c_2}\\ &\qquad <\ldots\\ &\qquad <n_{c_{j-1}+1}=n_{c_{j-1}+2}=\ldots=n_{c_j}\qquad\qquad 1\leq j\leq k \end{align*} with $n_{c_1}=n_1$ and $n_{c_j}=n_k$.

We conclude

The number of different assignments is \begin{align*} \frac{n!}{n_1!\cdots n_k!\cdot c_1!\cdots c_j!}=\frac{n!}{\left(n_{c_1}!\right)^{c_1}\cdots\left(n_{c_j}!\right)^{c_j}\cdot c_1!\cdots c_j!} \end{align*}

Reasoning:

  • There are $n!$ different arrangements of $x_1,\ldots,x_n$.

  • The order of $n_j$ ($1\leq j\leq k$) elements in a bin does not matter, so we divide by $n_j!$.

  • The order of $c_l$ bins ($1\leq l\leq j$) with equal size $n_{c_l}$ does not matter, so we divide by $c_l!$.

OPs first example with $n=4, k=2, n_1=1, n_2=3$ implies $c_1=c_2=1$ and we obtain \begin{align*} \frac{n!}{n_1!n_2!c_1!c_2!}=\frac{4!}{1!3!1!1!}=4 \end{align*}

OPs second example with $n=4, k=2, n_1=2, n_2=2$ implies $c_1=2$ and we obtain \begin{align*} \frac{n!}{n_1!n_2!c_1!}=\frac{4!}{2!2!2!}=3 \end{align*}

Markus Scheuer
  • 108,315