# How many ways can you arrange 5 identical balls into 4 boxes?

## Homework Statement

Say you have 5 identical balls. You want to put them into 4 different boxes. What is the total number of ways the balls can be arranged?

For example, you could have all 5 balls in one box. You could have 3 balls in one box and 2 balls in another, etc.

## The Attempt at a Solution

Since the balls are identical, order doesn't matter and this is a combination. So I drew it out, and figured out the correct number of ways - basically by doing a tree diagram.

But what I'm actually trying to figure out is what the equation looks like. I want to generalize it so that it works for m boxes and n balls, so I thought I'd make up a more concrete example to help me.

Related Precalculus Mathematics Homework Help News on Phys.org
In questions like these, it's good to consider one ball at a time:

Take one ball, how many possible options are there? Four, since there are four boxes in which it could be placed.

Take the second ball, how many possible options are there? Four again. So in total, for the two balls, I have 4 x 4 = 16 different combinations.

If you keep going, what do you end up with?

HallsofIvy
Homework Helper
That is, of course, for "distinguishable boxes". If the boxes were NOT distinguishable, that is if "3 balls in boxe A and 2 balls in box B" were counted as only one way, divide by 5!.

Hurkyl
Staff Emeritus
Gold Member
In questions like these, it's good to consider one ball at a time:

Take one ball, how many possible options are there? Four, since there are four boxes in which it could be placed.

Take the second ball, how many possible options are there? Four again. So in total, for the two balls, I have 4 x 4 = 16 different combinations.

If you keep going, what do you end up with?
The wrong answer -- your method would work for distinguishable balls (and distinguishable boxes). However, the following two sequence of choices are the same outcome in the problem:

• 11234
• 43211

In problems like these, once you think you have a way to model the actual problem with descriptions you can count, it's usually a good idea to actually check the two sets are bijective: every actual outcome corresponds to some description, every description corresponds to some outcome, and that the two correspondences are actually inverses.

For your method, if you thought about how to turn an outcome into a description, you probably would have noticed the problem.

But now that I've thought about it, it gives me an idea... (@ the opening poster) the answer is 56, right?

(... process the idea ... remove a redundant part ...)

Lay the five balls out in a row:
* * * * *​
Now, the first box begins on the left. Put a mark '|' in the space where the first box ends and the second box begins, and so forth. 3 marks in all.

Edit: Oh, hrm, it might have been even better to invert that: put the box edges in:
| | |​
and now add 5 '*' marks in the spaces where the balls go.

Last edited:
ehild
Homework Helper
But now that I've thought about it, it gives me an idea... (@ the opening poster) the answer is 56, right?

(... process the idea ... remove a redundant part ...)

Lay the five balls out in a row:
* * * * *​
Now, the first box begins on the left. Put a mark '|' in the space where the first box ends and the second box begins, and so forth. 3 marks in all.
This is exactly the way as "combination with repetitions" is explained in books. And the result is indeed 56.

ehild

uart
For example, you could have all 5 balls in one box. You could have 3 balls in one box and 2 balls in another, etc.
I'm not sure from some of what the OP said that the boxes are even distinguishable? (jumbogala you need to clarify this).

So the answer may be 56, but then again it might be just 6.

phinds
Gold Member
2019 Award
I'm not sure from some of what the OP said that the boxes are even distinguishable? (jumbogala you need to clarify this).

So the answer may be 56, but then again it might be just 6.
I'm going with 6 based on the wording of the problem.

Sorry everyone, the boxes are distinguishable.

I believe the result is 56 then.

ehild
Homework Helper
You are right. You can imagine that the boxes are ordered in a row, box 1 first, then box 2, and so on along with the balls, but the walls of the boxes can be placed at different positions, and the walls are indistinguishable, as Hurkyl explained in post 4. There has to be one wall at the front and one wall at the end, so you can set tree walls. You have then arrangements of 3 indistinguishable walls and 5 indistinguishable balls, these are permutations of 8 elements, from which 3 is one kind and 5 is an other kind.

ehild

Thanks everyone! This makes a lot of sense. I understand now =)

A general formula would then be (n + m -1 )! / (n!)(m-1)!

Where n = number of indistinguishable balls, and m = number of distinguishable boxes.

ehild
Homework Helper
Thanks everyone! This makes a lot of sense. I understand now =)

A general formula would then be (n + m -1 )! / (n!)(m-1)!

Where n = number of indistinguishable balls, and m = number of distinguishable boxes.
Very good! You are ! I needed very long time to understand these problems first, and after a couple of years, I have to think very hard to understand it again.

ehild

I can come up with 96 distinct combinations!

Scratch that ... make it 126 distinct combinations!

(That is, assuming the boxes can be individually identified)

Last edited:
Pardon me, I incorrectly red "5 boxes!"