-3
$\begingroup$

Straight-forward: given $x$ identical balls and $n$ boxes, how many different ways can we place the balls into the boxes? A box can be empty.

example: x = 4, n = 3

|OOOO| - |    | - |    |
|OOO | - |O   | - |    |
|OOO | - |    | - | O  |
|OO  | - |OO  | - |    |
|OO  | - |O   | - |O   |
|OO  | - |    | - |OO  |
|O   | - |OOO | - |    |
|O   | - |OO  | - |O   |
|O   | - |O   | - |OO  |
|O   | - |    | - |OOO |
|    | - |OOOO| - |    |
|    | - |OOO | - |O   |
|    | - |OO  | - |OO  |
|    | - |O   | - |OOO |
|    | - |    | - |OOOO|

ANS = 15

In this case, seems like we have a sum $(1+2+3+4+5)$.

example: x = 3, n = 4

|OOO| - |   | - |   | - |   |
|OO | - |O  | - |   | - |   |
|OO | - |   | - |O  | - |   |
|OO | - |   | - |   | - |O  |
|O  | - |OO | - |   | - |   |
|O  | - |O  | - |O  | - |   |
|O  | - |O  | - |   | - |O  |
|O  | - |   | - |OO | - |   |
|O  | - |   | - |O  | - |O  |
|O  | - |   | - |   | - |OO |
|   | - |OOO| - |   | - |   |
|   | - |OO | - |O  | - |   |
|   | - |OO | - |   | - |O  |
|   | - |O  | - |OO | - |   |
|   | - |O  | - |O  | - |O  |
|   | - |O  | - |   | - |OO |
|   | - |   | - |OOO| - |   |
|   | - |   | - |OO | - |O  |
|   | - |   | - |O  | - |OO |
|   | - |   | - |   | - |OOO|

ANS = 20

In this case, seems like we have a sum $(1+3+6+10)$.

$\endgroup$
  • $\begingroup$ This has been answered many times before on this site. Please do some research before asking questions. $\endgroup$ – K.defaoite Jun 22 '20 at 19:49
  • $\begingroup$ Are balls identical or distinct? Are boxes identical or distinct? $\endgroup$ – UmbQbify Jun 22 '20 at 20:35
  • $\begingroup$ The balls are identical. $\endgroup$ – Daniel Jun 22 '20 at 20:46
  • 1
    $\begingroup$ Have you ever heard about stars and bars? $\endgroup$ – user Jun 22 '20 at 21:12
0
$\begingroup$

The way to place x balls in n boxes (where boxes can be empty) is:

$$\binom{x + n - 1}{n - 1}$$

$\endgroup$

Not the answer you're looking for? Browse other questions tagged or ask your own question.