1

Given $N$ boxes, with each box having maximum capacity to store and $M$ balls, find in how many ways can the balls be arranged in those boxes?

Example: $N=2$ such that their max capacity is $5$ and $5$ respectively, $M=3$.

Then answer is $4$: Possible arrangements are $(3,0) (0,3) (2,1) (1,2)$

Jimmy R.
  • 35,868

1 Answers1

1

Hint: Let $x_i$ denote the number of balls in box $i$ for $i=1,2,\ldots,N$. Then you need to find the number of integer solutions of the equation $$x_1+x_2+\ldots+x_N=M$$ subject to $0\le x_i\le m_i$ where $m_i$ denotes the maximum capacity of box $i$.

You can see here for some ideas on how to proceed.

Jimmy R.
  • 35,868
  • Isn't there any form of 2D recurrence evolving out of this to make the solution easier to compute? – user249117 Dec 19 '15 at 16:49
  • See the link I posted. This is a standard problem in combinatorics and yes there are standard methods for easy compution, but they do not involve recurrence relations, as far as I know. – Jimmy R. Dec 19 '15 at 16:50