2

I asked a question, but have not got any answer. So, I decided to break the question down into more simple questions. Here, you may see the main question, here the first part of question.

Assume that there are $m$ boxes each of which contains $n$ compartments. There are also $l$ balls, where $\ m\ <\ l\ <\ (m−1)n+2$. Moreover, the balls are the same.

$\bullet\ $ I would like to know how many ways there are to place the balls in the boxes such that

1) Each compartment can hold up to one ball.

2) Each box must have at least one ball.

3) There are exactly $j$ boxes which contain only one ball.

Without the constraint 3, you may see some answers here which I am not sure about the correctness. For sure, there some $j$s for which constraint 3 can be satisfied. I think $2m-l \leq j\leq \lfloor \frac{mn-l}{n-1}\rfloor $.

I highly appreciate any help in advance.

Majid
  • 3,357

1 Answers1

1

The answer given here is actually to be considered an addendum to the answer given to the other post, where it has been considered the number of ways $C(m,n,l)$ to arrange:
- $l$ undistinguishable balls
- into $m$ distinguishable boxes, each provided with $n$ distinguishable compartments
- counting only the arrangements that contain no empty boxes = at least $1$ ball per box.

Let's now call $C_{2}(m,n,l)$ the number of ways to arrange balls in boxes same as above, but - counting only the arrangements that contain at least $2$ balls per box.

It is evident that the approach described in the previous answer and leading to the involutory recurrence 4) therein, can be applied here as well.
Briefly,
- imagine to have the sketch of all the configurations pertaining to $C_{2}(m,n,l)$;
- add an additional box aside;
- transfer one ball at time from the original block to the new box;
- starting from the 2nd ball, you are constructing a partition of the $(m+1, \, n,\, l)$ arrangement, that at each step accounts for $C_{2}(m,n,l-k) \cdot C_{2}(1,n,k)$;
- the process stops when $k=n$ or $k=l$, but we can sum for $0 \leqslant k \leqslant l$ because by definition $C_{2}(m,n,j) = 0$ for $j \leq 2m$ .

Thus we have

$$ C_{\,2} (m + 1,n,l)\quad \left| {\;0 \leqslant \text{integer}\;m,n,l} \right.\quad = \sum\limits_{\left( {0\, \leqslant } \right)\;k\,\,\left( { \leqslant \,l} \right)} {C_{\,2} (m,n,l - k)\;C_{\,2} (1,n,k)} \tag {4.a} $$

that is the same recurrence as in previous answer.
But now the initial conditions will be

$$ C_{\,2} (1,n,l)\quad = \quad \begin{array}{*{20}c} {n\backslash l} &| & 0 & 1 & {2 \leqslant l} \\ \hline 0 &| & 0 & 0 & 0 \\ 1 &| & 0 & 0 & 0 \\ {2 \leqslant n} &| & 0 & 0 & {\left( \begin{gathered} n \\ l \\ \end{gathered} \right)} \\ \end{array} \quad \quad = \quad \left( \begin{gathered} n \\ l \\ \end{gathered} \right) - \left( \begin{gathered} 0 \\ l \\ \end{gathered} \right) - n\left( \begin{gathered} 0 \\ l - 1 \\ \end{gathered} \right) $$

so, we have $$ \begin{gathered} C_{\,2} (2,n,l) = \sum\limits_{\left( {0\, \leqslant } \right)\;k\,\,\left( { \leqslant \,l} \right)} {\left( {\left( \begin{gathered} n \\ l - k \\ \end{gathered} \right) - \left( \begin{gathered} 0 \\ l - k \\ \end{gathered} \right) - n\left( \begin{gathered} 0 \\ l - k - 1 \\ \end{gathered} \right)} \right)\;\left( {\left( \begin{gathered} n \\ k \\ \end{gathered} \right) - \left( \begin{gathered} 0 \\ k \\ \end{gathered} \right) - n\left( \begin{gathered} 0 \\ k - 1 \\ \end{gathered} \right)} \right)} = \hfill \\ = \left( \begin{gathered} 2n \\ l \\ \end{gathered} \right) - \left( \begin{gathered} n \\ l \\ \end{gathered} \right) - \left( \begin{gathered} n \\ l - 1 \\ \end{gathered} \right) - \left( \begin{gathered} n \\ l \\ \end{gathered} \right) + \left( \begin{gathered} 0 \\ l \\ \end{gathered} \right) + n\left( \begin{gathered} 0 \\ l - 1 \\ \end{gathered} \right) - n\left( \begin{gathered} n \\ l - 1 \\ \end{gathered} \right) + n\left( \begin{gathered} 0 \\ l - 1 \\ \end{gathered} \right) + n^{\,2} \left( \begin{gathered} 0 \\ l - 2 \\ \end{gathered} \right) = \hfill \\ = \left( {\left( \begin{gathered} 2n \\ l \\ \end{gathered} \right) - 2\left( \begin{gathered} n \\ l \\ \end{gathered} \right) + \left( \begin{gathered} 0 \\ l \\ \end{gathered} \right)} \right) - 2n\left( {\left( \begin{gathered} n \\ l - 1 \\ \end{gathered} \right) - \left( \begin{gathered} 0 \\ l - 1 \\ \end{gathered} \right)} \right) + n^{\,2} \left( \begin{gathered} 0 \\ l - 2 \\ \end{gathered} \right) = \hfill \\ = \sum\limits_{\left( {0\, \leqslant } \right)\;j\,\,\left( { \leqslant \,2} \right)} {\left( { - 1} \right)^{\,j} \left( \begin{gathered} 2 \\ j \\ \end{gathered} \right)\left( {\sum\limits_{\left( {0\, \leqslant } \right)\;k\,\,\left( { \leqslant \,2} \right)} {\left( { - 1} \right)^{\,k} \left( \begin{gathered} 2 - j \\ k \\ \end{gathered} \right)\left( \begin{gathered} \left( {2 - j - k} \right)n \\ l - j \\ \end{gathered} \right)} } \right)n^{\,j} } \hfill \\ \end{gathered} $$ Bringing the convolution a few steps forward, we can realize that the pattern of the upper and lower terms of the binomials follows the same pattern as that of $$ \text{conv}\left( {\left( \begin{gathered} n \\ l \\ \end{gathered} \right) - \left( \begin{gathered} 0 \\ l \\ \end{gathered} \right) - n\left( \begin{gathered} 0 \\ l-1 \\ \end{gathered} \right)} \right) = \sum\limits_{k,\;j} {c_{\,k,\;j} \left( \begin{gathered} k \\ l-j \\ \end{gathered} \right)} \quad \overset {\text{pattern}} \longleftrightarrow \quad \left[ {x^{\;k} y^{\;j} } \right]\text{mult}\left( {x^{\,n} - 1 - ny} \right) $$ so that we arrive to:

$$ \begin{gathered} C_{\,2} (m,n,l)\quad \left| {\;0 \leqslant \text{integer}\;m,n,l} \right.\quad = \hfill \\ = \sum\limits_{\left( {0\, \leqslant } \right)\;j\,\,\left( { \leqslant \,m} \right)} {\left( { - 1} \right)^{\,j} \left( \begin{gathered} m \\ j \\ \end{gathered} \right)\left( {\sum\limits_{\left( {0\, \leqslant } \right)\;k\,\,\left( { \leqslant \,m} \right)} {\left( { - 1} \right)^{\,k} \left( \begin{gathered} m - j \\ k \\ \end{gathered} \right)\left( \begin{gathered} \left( {m - j - k} \right)n \\ l-j \\ \end{gathered} \right)} } \right)n^{\,j} } = \hfill \\ = \sum\limits_{\left( {0\, \leqslant } \right)\;j\,\,\left( { \leqslant \,m} \right)} {\left( { - 1} \right)^{\,m - j} \left( \begin{gathered} m \\ j \\ \end{gathered} \right)\left( {\sum\limits_{\left( {0\, \leqslant } \right)\;k\,\,\left( { \leqslant \,m} \right)} {\left( { - 1} \right)^{\,k} \left( \begin{gathered} j \\ k\\ \end{gathered} \right)\left( \begin{gathered} \left( { j - k} \right)n \\ l-m+j \\ \end{gathered} \right)} } \right)n^{\,m - j} } \hfill \\ \end{gathered} \tag {5} $$

which I could check on computer for a small range of the parameters and looks correct.

This time, for $m=0$, by definition the result should be null, for whichever values of $n$ and $l$. The formula above instead gives $C_{2}(0,n,0) = 1$, which does not look plausible. So we shall limit its validity to $1 \leqslant m$, or correct it for $m=l=0$.

For an algebraic verification of 5), let us consider an additional relation.
We can partition the $C(m,n,l)$ arrangements with no empty box into those that contain
- $0$ boxes with exactly 1 ball, ${m \choose 0}$ ways to choose them, and $C_{2}(m,n,l)$ boxes with at least $2$ balls
- $1$ boxes with exactly 1 ball, ${m \choose 1}$ ways to choose the box and $n$ ways to place the ball in it, and $C_{2}(m-1,n,l-1)$ boxes with at least $2$ balls
...
- $k$ boxes with exactly 1 ball, ${m \choose k}$ ways to choose the box and $n^k$ ways to place the balls , and $C_{2}(m-k,n,l-k)$ boxes with at least $2$ balls
...
- $m$ boxes with exactly 1 ball, ${m \choose m}$ ways to choose the box and $n^m$ ways to place the balls , and $C_{2}(0,n,l-m)$ boxes with at least $2$ balls.

We can see here that , for $l=m$, the $n^m$ arrangements with exactly $1$ ball per box are legitimate and that this demands that $$C_{2}(0,n,0) = 1$$

The above translates into:

$$ C(m,n,l) = \sum\limits_{\left( {0\, \leqslant } \right)\;k\,\,\left( { \leqslant \,m} \right)} {\left( \begin{gathered} m \\ k \\ \end{gathered} \right)n^{\,k} \,C_{\,2} (m - k,n,l - k)} \tag {6} $$

Computing this relation numerically, for $0 \leqslant n,m \leqslant 10$ and $0 \leqslant l \leqslant nm$ returns a full check, and it is also fully demonstrable algebraically.

Then each addendum in formula 6) is exactly what you are looking for.

G Cab
  • 35,272
  • @G Cab, this is not only a correct but also a perfect answer! I really appreciate your taking time to do so. Only, you need to add a "$" a line before the Eq. (6). You made my day! – Majid Jan 25 '17 at 22:03
  • @Majid: thanks, corrected. I got very interested to your question because related to this subject which I was studying for a while. There is much more about to say, but don't know your interest on the topic, and space here is limited. – G Cab Jan 25 '17 at 22:30