Difference equations: number of ways to distribute k candy to n boxes

166 Views Asked by At

In the book of Difference equations: an introduction with applications, 2nd Edition by Peterson, at page 10, question 1.11, it is asked that

enter image description here

However, shouldn't it that formula be $$D(n,k) = D(n-1, k-1) + n * D(n-1, k)$$

I mean, the boxes are identical, and we can choose that specific candy $n$ different ways.

Edit:

I have considered the last candy that is put the boxes. There are two possibilities, either the the box that that last candy has been put contains some other candies, or not. In the latter case, the rest of the $n-1$ candy can be distributed among $k-1$ boxes (since we have assumed that the k-th boxes does not have any candy in it other than the one we choose). In this case, which candy has been put as the last one does not change the number of ways that the candies can be distributed, so the contribution from the this case is only $D(n-1, k-1)$.

In the former case, we have $n-1$ candy and $k$ boxes; however, when we put that last candy we can put it in one of the $k$ boxes, so we have $n$ different case, hence the contribution from this case is $k D(n-1, k)$.

I have figured the problem that I was having while writing this edit.

1

There are 1 best solutions below

0
On BEST ANSWER

No, it's correct. In case $(1)$, you have $D(n-1,k-1)$ ways of distributiong the other $n-1$ candies among the other $k-1$ boxes. In case $(2)$, you can distribute them among $k$ boxes so that none of them are empty, and then choose one of the $k$ boxes to add the specific candy to.