In how many ways $5$ different balls be distributed to $3$ different boxes, when each box can hold any number of balls?

According to me: every ball can go to any of the $3$ boxes So ways of going in the first box $= 3$ In the second box $= 2$ In the third box $=1$ Same for every ball. So answer should be $3!$ ways. Similarly for every ball. So ways must be $3!^5$

According to solution Every ball can go to any of the 3 boxes. So no. of ways will be=$3^5$ way

  • 2
    $\begingroup$ Each ball can only be placed in one of the three boxes, so we have three choices for each ball. $\endgroup$ – N. F. Taussig Aug 27 '17 at 10:57
  • 3
    $\begingroup$ Could you elaborate on what the three different ways of putting the ball in the first box are? I would say that there is only one way of putting the ball into the first box, namely to simply put it in. Similarly there is one way to put the ball in the second box and one way to put it in the third box. Since these are all the things one can do with the ball, and they are mutually exclusive, there are $1+1+1=3$ things one can do with the ball. (You also need to explain why you multiplied $3\cdot2\cdot1$ rather than adding.) $\endgroup$ – Will Orrick Aug 27 '17 at 11:11
  • $\begingroup$ Is this not just stars and bars? $\endgroup$ – Certainly not a dog Oct 13 at 8:43

Imagine this as a tree where each node has 3 children and the height of the tree is the number of balls you have.

The choices for the first ball are the children of the first node(the root of the tree). There are 3 options to go from the start (root), so the first node will have 3 children (directions in which it can go). Now imagine each of those 3 children (nodes) as the different situations you could have potentially gotten yourself into. For each of those three cases we will have 3 more cases for the second ball, i.e. $3\times3=9$. Now, having 9 cases for each of those cases you can go on three different paths for the third ball, so the overall number of times becomes $9\times3=27$.

Continuing like that till the $5^{th}$ ball you get $3\times3\times3\times3\times3=3^5$ different scenarios for the positions of the balls.

This is a classic example of permutations with repetitions where the formula is $\tilde V_n^k=k^n$ for $n$ elements (balls) with $k$ choices (boxes).


What if we phrase it this way...

We have a multiple choice questionnaire. There are five questions Which box does ball X go into? and for each question you can select one answer box A, box B, or box C.

                                    box A   box B   box C
Which box does ball 1 go into?        x
Which box does ball 2 go into?                x
Which box does ball 3 go into?                        x
Which box does ball 4 go into?                        x
Which box does ball 5 go into?                x

There's three possible answers to the first question. Regardless of the answer the answer to the first question, there's three possible answers to the second question. And so on. So we count $3^5$ possibilities.

It would involve factorials (or a falling factorial) if we instead were not allowed to use a box more than once. (It wouldn't work in this case: we have more balls than boxes.)

For example, suppose we changed the problem to: In how many ways can 3 different balls be distributed to 5 different boxes, when each box can hold at most one ball?

Then there will be $5$ ways to place the first ball, $4$ to place the second ball, $3$ to place the third, giving $5 \times 4 \times 3$ ways in total.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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