Number of ways to put $n$ balls in $m$ buckets subject to constraints

balls-in-binscombinationscombinatoricspermutationsprobability

I am looking at Sextus's answer in Balls are placed into 3 urns. Expected time until some urn has 100 balls..

Essentially, we have $n$ balls that we'd like to place in $m$ buckets. There is a set of constraints on the number of balls in each bucket. Let $k_i$ denote the number of balls in the $i$-th bucket, we require

$$
\sum_{i=1}^m k_i = n \\
0 \leq k_i < k
$$

for some constant $k$.

Then his answer states that "the number of ways to put $k_i$ balls in urn/bucket $i$" is

$$
\frac{n!}{\prod_{i=1}^m k_i!}
$$

I am confused. $k_i$ is a constant, so isn't the number of ways to put $k_i$ balls in to bucket $i$ simply 1 since the balls are indistinguishable?

Best Answer

I think the reason is the number of ways to place the balls is $1$, however, the number of procedures of putting these $n$ balls is $\frac{n!}{\prod_{i = 1}^{m} k_i!}$. You can consider a sequence $S$ consisting of $k_1$ characters of $1$, $k_2$ characters of $2$, etc. In this sequence, if $S[i] = x$, then you should place a ball in the $x-th$ box on the $i-th$ step. This sequence describes a procedure, thus the number of ways we can create this sequence is the number of procedures. The number of ways you can create this sequence is $P(n; k_1, k_2, k_3, ..., k_m) = \frac{n!}{\prod_{i = 1}^{m} k_i!}$.

Therefore, the number of ways you can place these indistinguishable balls is $1$, while the number of procedures of doing this is $\frac{n!}{\prod_{i = 1}^{m} k_i!}$.

I hope my answer was helpful.

Related Question