0

my problem is the following: I have $n$ identical items and $m$ enumerated boxes with unlimited capacity. I have to put all my items in the boxes such that all the boxes have at least one item. If $n>m$, I want to know how many ways there are to distribute the items.

For instance, with $n=5$ items and $3$ boxes I can use $(1,2,2)$ (which means 1 item in box 1, 2 items in box 2, 2 items in box 3). Or maybe $(2,1,2)$,$(3,1,1)$ etc.

The problem reduces to count the number of elements in the set $$\left\{(x_1,...,x_m)\in \mathbb{Z}^m: \sum_{i=1}^m x_i=n, 1\le x_i\le n \right\}$$ If I call $\beta(n,m)$ to this number then I have the following recursion $$\beta(n,m)=\sum_{k=1}^{n-1} \beta(k,m-1),$$ and I know $\beta(n,1) = 1$, $\beta(n,m)=0$ if m>n.

It is possible to get an explicit expression for $\beta(n,m)$??

Thank you very much for any help.

1 Answers1

6

This problem is standard, we have:

$$x_1+...+x_m=n \ \ \ x_i\geq 1 \ \ \ \forall i\in{1,...,m}$$

Since there is this condition I can make this position:

$$x_i=y_i+1$$

And the problem becomes:

$$y_1+...+y_m=n-m$$

Now that we got rid of condition there is a standard formula for this:

$$x_1+...+x_k=n \Rightarrow \text{Ways}={{n+k-1}\choose{k-1}}$$

In our case:

$${{n-m+m-1}\choose{m-1}}={{n-1}\choose{m-1}}$$

If you want a proof of the formula we used you can see my answer at this link that contains the general idea

:)

Kandinskij
  • 3,709