P&C q1

Saumyojit

Senior Member
Joined
Jan 21, 2020
Messages
1,032
Five balls of different colors are to be placed in three boxes of different sizes. Each box can hold all five. In how many different ways can we place the balls so that no box remains empty?
Possible distribution sizes are (3,1,1) and (2,2,1)

Lets go with (311) .. suppose triplets chosen are c1 c2 c3 , pairs are c4c5. SO with a particular combination of distribution sizes, there are 3! arrangements


Largest box2nd largersmallest box
C1C2C3C4 C5C6
C1C2C3C6C4C5
C4 C5C1C2C3C6
C6C1C2C3C4C5
C6C4 C5C1C2C3
C4 C5C6C1C2C3






Let me choose 3 balls out of 5 --> 5C3 , then choose 1 ball out of 2--> 2c1 , then choose 1 ball out of 1 ->1
Now they will arrange Among the Boxes in 3! ways
5c3 * 2c1 *1 *3! = 120
Similarly goes for (2,2,1) distribution groups .
Then, I will add both the Cases.

But where am i wrong?


Why in the question it is said " Each box can hold all five" when
no box remains empty? CONTRADICTION
 
Five balls of different colors are to be placed in three boxes of different sizes. Each box can hold all five. In how many different ways can we place the balls so that no box remains empty?
This is a counting problem known as an occupancy where we put \(m\) different items into \(m\) distinct cells with no cell empty. The last condition means that it must be the case that \(m\ge n\).
To solve we count the number of surjections from as set of \(m\) to a set of \(n\):
\[\displaystyle{Surj(m,n) = \sum\limits_{k = 0}^n {{{( - 1)}^k}\dbinom{n}{k}{{(n - k)}^m}}} \]
 
Why in the question it is said " Each box can hold all five" when
no box remains empty? CONTRADICTION
When someone says something that appears to be a contradiction, the first assumption to make is that you are interpreting it wrong (especially when it is not written in your first language!). Let's examine the wording:

Five balls of different colors are to be placed in three boxes of different sizes. Each box can hold all five. In how many different ways can we place the balls so that no box remains empty?​

My first question when I read this was, what is the meaning of "different sizes"? Since their sizes don't prevent all balls from being put in any of them, the only reason for mentioning difference sizes is to say that they are distinguishable. We can just call them box 1, box 2, and box 3. (We are also told that the balls have different colors, so they are distinguishable -- so the "stars and bars" technique won't work.) This is often the first issue I look for in a problem like this.

Then I notice the statement that no box remains empty. This tells us, not something about the boxes themselves, but about the placement of balls: We are not allowed to leave any box empty. This is why you can say there are two main cases, either 3 in one box and 1 in each of the others, or 1 in one box and 2 in each of the others.

Your question is different, and appears to be a misunderstanding of the word "can". The fact that a box can hold all five balls, does not imply that it actually holds any at all! I don't see why you see a contradiction. All it tells us is that we don't have to worry about a limit on how many balls can fit in any given box.

Lets go with (311) .. suppose triplets chosen are c1 c2 c3 , pairs are c4c5. SO with a particular combination of distribution sizes, there are 3! arrangements

Largest box2nd largersmallest box
C1C2C3C4 C5C6
C1C2C3C6C4C5
C4 C5C1C2C3C6
C6C1C2C3C4C5
C6C4 C5C1C2C3
C4 C5C6C1C2C3
I don't understand. What do the C's represent? There are 3 boxes and 5 balls; what are there 6 of??

Let me choose 3 balls out of 5 --> 5C3 , then choose 1 ball out of 2--> 2c1 , then choose 1 ball out of 1 ->1
Now they will arrange Among the Boxes in 3! ways
5c3 * 2c1 *1 *3! = 120
Similarly goes for (2,2,1) distribution groups .
Then, I will add both the Cases.

But where am i wrong?
So there are 10 ways to choose a group of 3 balls, 2 ways to choose two distinguished single balls, and 6 ways to choose an order in which to place them. But in doing so, you have twice chosen the places for the single balls, so you have overcounted.

I would choose 3 balls (10 ways) and then where to put them (3 ways); then choose a ball to put in the first still-empty box (2 ways), and a ball to put in the last box (1 way). This is 60, not 120.
 
I don't understand. What do the C's represent? There are 3 boxes and 5 balls; what are there 6 of??
Yes you are right.
C means balls of diff color


Largest box2nd large BoxSmallest Box
B1B2B3B4B5
B1B2B3B5B4
B4B1B2B3B5
B5B1B2B3B4
B5B4B1B2B3
B4B5B1B2B3


Now why are you saying the 2nd,4th,6th are of no use . My intuition suggests that Becoz in the first & 2nd arrangement three balls are in Same box .

Now if we compare 1st box to 3rd box , then B1B2B3 is in new place although B5 is in Smallest box still.

What is happening? Why are we giving importance to B1 B2 B3 's LOCATION and deciding according to that.
 
Now if we compare 1st box to 3rd box , then B1B2B3 is in new place although B5 is in Smallest box still.

What is happening? Why are we giving importance to B1 B2 B3 's LOCATION and deciding according to that.
Are you thinking that the "size" of a box means "how many balls are in it"? As I said, they mention box size (the size of the box itself) only to say they are distinguishable.

I thought for a moment that I'd figured out what you are misunderstanding; but, no, your table shows the "smallest box" with three balls in it, so you can't be thinking that.

But then what is it that you are thinking? The question is all about the location of each ball, so what are you asking???

Now why are you saying the 2nd,4th,6th are of no use . My intuition suggests that Becoz in the first & 2nd arrangement three balls are in Same box .
Huh? I said nothing of the sort. (I said nothing about the table because your original table was nonsense.) Your table correctly (now) lists the 6 ways to place the balls in the 3-1-1 case.

What I said is that this already takes into account the two different orders in which to place the single balls, so you can't separately choose an order for the two single balls.

To put it differently, calling the blue ball B4 and putting it in the second box is the same as calling the blue ball B5 and putting it in the second box.
 
They say that each box can hold all five balls just to point out that there is no box that for example can hold no more than 2 balls. They could have said instead that each box can hold up to OR at least three balls. Is this clear?
 
the size of the box itself) only to say they are distinguishable.
yes.

The question is all about the location of each ball
exactly that's what i think.

See triplets in one event is at largest box , then in another event at 2nd larger box , then in another event Smallest box.

I am separately choosing an order for the two single balls.

Just take this two events,

Now when triplets is at largest box , one blue color ball is at 2nd larger box and one black ball at smallest box
Now that blue color ball can be at the Smallest box and black at 2nd larger keeping triplets at Largest box .


Both the above arrangement is unique right ? The location of triplets is same in the above two cases but the location of blue and black ball is changing.

Where is the prob?
 
See triplets in one event is at largest box , then in another event at 2nd larger box , then in another event Smallest box.

I am separately choosing an order for the two single balls.

Just take this two events,

Now when triplets is at largest box , one blue color ball is at 2nd larger box and one black ball at smallest box
Now that blue color ball can be at the Smallest box and black at 2nd larger keeping triplets at Largest box .


Both the above arrangement is unique right ? The location of triplets is same in the above two cases but the location of blue and black ball is changing.

Where is the prob?
The problem is that you are counting each such event twice.

Look again:

Let me choose 3 balls out of 5 --> 5C3 , then choose 1 ball out of 2--> 2c1 , then choose 1 ball out of 1 ->1
Now they will arrange Among the Boxes in 3! ways
5c3 * 2c1 *1 *3! = 120
Similarly goes for (2,2,1) distribution groups .
Then, I will add both the Cases.

But where am i wrong?
I told you where you're wrong. The 3! includes arranging everything, so you don't have to previously choose the order of the single balls (the 2C1). After you select the 3, you have that set, and another ball, and the last ball, and arranging those three provides all possible positions for the single balls.

As I said,
I would choose 3 balls (10 ways) and then where to put them (3 ways); then choose a ball to put in the first still-empty box (2 ways), and a ball to put in the last box (1 way). This is 60, not 120.
This is your 5C3 * 3!, without the 2C1.
 
After you select the 3, you have that set, and another ball, and the last ball, and arranging those three provides all possible positions for the single balls.
Yes , this is where I don't understand .

why Arranging only those three does the work?

According to my logic the table in post 4 is right as the single ball should also give arise to a new arrangement .

What crime those single ball has done that we are not considering their "rearrangement" as a arrangement.
Why only we are paying attention to the rearrangement of triplets?



According to your logic(RIGHT ONE) , the table looks like this

Largest2nd largerSmallest box
B1B2B3B4B5
B4B1B2B3B5
B5B4B1B2B3

If you compare this table to Comment4 table, you will find that the arrangement where B1B2B3 stays the same and only single ball rearranges those arrangement after excluding we get 3 ways. But why so?

[ b1b2b3 , b4 , b5] and [ b1b2b3 , b5 , b4] are the same event how so ? For me the single ball are in different boxes so new arrangement.
 
According to my logic the table in post 4 is right as the single ball should also give arise to a new arrangement .
I'm not criticizing post #4; that doesn't contain a calculation. Don't answer me by talking about the tables; talk about the calculation.

We're talking about your calculation:
Let me choose 3 balls out of 5 --> 5C3 , then choose 1 ball out of 2--> 2c1 , then choose 1 ball out of 1 ->1
Now they will arrange Among the Boxes in 3! ways
5c3 * 2c1 *1 *3! = 120
Similarly goes for (2,2,1) distribution groups .
Then, I will add both the Cases.
The 2C1 doesn't belong there; or else the 3! should just be 3C1 = 3. Once the order of the single balls is picked, you don't need to rearrange them again.

What crime those single ball has done that we are not considering their "rearrangement" as a arrangement.
Why only we are paying attention to the rearrangement of triplets?
The problem is that you are rearranging the same things twice. I've explained several times now, but you have not interacted with that, so there's no sense in saying it again.

Just make a complete list, and you'll find that you run out at 60, not 120.
 
Where am i counting twice?

PLEASE Show me a eg of an arrangement .

WHY?? Why cannot i rearrange the singles ,that's where my confusion lies otherwise I understood everything.
You have not mentioned your calculation in a long time. This is not about arrangements themselves, so that an example would help; it's about your calculation, so I want to see that you are thinking about what you wrote. As far as I can tell, you might agree with me if you just looked at your calculation again.

Please do this for me: Explain again how you are calculating the number, so I can see that you are thinking about it. Explain it in more detail than before; the more carefully you explain something, the more likely you are to catch an error in it.


By the way, here's a little English lesson: "eg" does not mean "example"; "e.g." is an abbreviation of the phrase (in Latin) "for example". Youi would not say "show me a for example of an arrangement". (Many Americans do not know this!)
 
Five balls of different colors are to be placed in three boxes of different sizes. Each box can hold all five. In how many different ways can we place the balls so that no box remains empty?
To Saumyojit. This is my concern: you do not need to derive the formula for the number of ways to place \(M\) distinct items into \(N\) distinct cells each time you need to use it. If we have \(A=\{R,O, Y, G, B\}\) a set of five, \(\text{red, orange, yellow, green, & blue}\), balls.
We have set of cells \(B=\left\{ {\underbrace {\{ \quad \} }_1,\underbrace {\{ \quad \} }_2,\underbrace {\{ \quad \} }_3} \right\}\)
Now the notation \(B^A\) stands for the set of all functions from \(A\text{ to }B\), & \(|B|^{|A|}=3^5=243\).
So there are \(243\) functions from \(A\) to \(B\). that is the number of ways to place five items into three cells.
But your question requires that no cell can be empty. So we need to count the onto functions(surjections).
In general if \(M\ge N\) then the number of surjections from a set of \(M\) to a set of \(N\) is: \(\sum\limits_{k = 0}^N {{{( - 1)}^k}\dbinom{N}{k}{{(N - k)}^M}} \).
As you can see here there are \(150\) such functions(surjections) in this case.
 
To Saumyojit. This is my concern: you do not need to derive the formula for the number of ways to place M distinct items into N distinct cells each time you need to use it.

That's true if one has been taught such a formula, or knows what to look up to find it; and if one is doing a problem hard enough to need it. On the other hand, if Saumyojit is being taught (or trying to learn) general ways of thinking in combinatorics, then providing a memorizable formula and discouraging thought may be the opposite of what is needed.

I'll be honest: I don't happen to know this formula offhand. I do know how to use inclusion-exclusion to do this sort of thing, and I know that this particular problem is small enough that what Saumyojit has done (when done correctly) is appropriate, and perhaps even easier. My focus tends to be on helping people (a) figure out why what they are currently doing is wrong (so they can correct wrong habits of thinking), and (b) learn to recognize multiple ways to solve a problem, and to decide when a powerful tool is not the most effective method.
 
Explain again how you are calculating the number
Choosing 3 out of 5 balls--> 5c3
Choosing 1 out of 2 balls --> 2c1
Choosing 1 out of 1 --> 1c1

Now for a particular combination (b1 b2 b3 , b4, b5)

Main point: For a event suppose, Triplets have three options of sitting in any one box so it chooses one , then there are two boxes left for 2 Single Distinct balls ; so ball 4 have 2 options so suppose b4 sits in any ONE out of 2 box and the remaining one box can be taken by b5 . So , 6 ways ?

So, 5c3 * 2c1 * 1c1 * 3! . What is so hard to understand?

What is the mistake that am i not able to catch?




Another explanation :

This is one particular CHOSEN combination of triplets , single , single --> (b1 b2 b3 , b4 , b5)
There are six ways of arranging of each Chosen combo that means for another unique combo of
triplets , single , single--->(b1 b2 b4 , b3 , b5) there are also six ways .

Unitary method :
For each combination, there are six ways to arrange (triplets , single , single) between 3 boxes.
for (5c3 * 2c1 * 1c1) unique Combinations of Triplets and Double singles --> 5c3 * 2c1 * 1c1 * 6 ---> this no of ways



How much do i have to explain .
 
Last edited:
I think i have understood where I am wrong .
So the below two arrangements are the same or different?


box1box2box3
b1 b2 b3b4b5
b1 b2 b3b5b4
 
They are different. That is not where any double counting is coming in.

Here is how I would do this problem.

We have two basic ways to meet the constraints of the problem.

One is three balls in one box and one ball in each of the other two boxes.

The other is one ball in one box and two balls in each of the other boxes

Let's analyze them one at a time

How many distinct ways can I pick the box with three balls? 3

How many ways distinct ways can I pick the three balls in that box? 10.

How many distinct ways can I distribute the remaining two balls between the remaining two boxes? 2.

3 * 10 * 2 = 60.

Now let's think about the alternative.

How many ways can I pick the one box with one ball? 3

How many ways can I pick the ball to go into the box with one ball? 5

Now I need to select two balls out of the remaining four to go into the smaller remaining box.
How many ways can I do that? 6.

Now I need to select two balls out of the remaining two to put into the one remaining box. How many ways can I do that? 1.

Now that I have selected those balls, how many ways can I pick a box to put them in? 2

3 * 5 * 6 * 1 = 90.

60 + 90 = 150.

Like Dr. Peterson, I am leery of formulas. People do not always remember them accurately, and even more often, they do not remember when it is appropriate to use them. But notice I got the same answer as pka did with the formula. His formula condenses my thought. They are not fundamentally different.

Also like Dr. Peterson, it is impossible for me to say where your thinking went astray because you give so few details of how your thinking fits with all your calculations.
 
As a follow on to the above, you started this thread by saying you got the wrong answer, but did not tell us what answer you did get and exactly how you computed it.

How in the world can we tell you where your calculations went off the rails if we do not know what your calculations were?

EDIT: By the way, if your original answer was 240, you did double count, I suspect I know in that case where you went astray, but I cannot know for sure unless I see each step in your reasoning along with the associated calculation.
 
Last edited:
As a follow on to the above, you started this thread by saying you got the wrong answer, but did not tell us what answer you did get and exactly how you computed it.

How in the world can we tell you where your calculations went off the rails if we do not know what your calculations were?

EDIT: By the way, if your original answer was 240, you did double count, I suspect I know in that case where you went astray, but I cannot know for sure unless I see each step in your reasoning along with the associated calculation.
as i double counted my answer not 240 but 300 .
I gave my reasoning and calculation in comment 15.
Please read.
 
Choosing 3 out of 5 balls--> 5c3
Choosing 1 out of 2 balls --> 2c1
Choosing 1 out of 1 --> 1c1

Now for a particular combination (b1 b2 b3 , b4, b5)

Main point: For a event suppose, Triplets have three options of sitting in any one box so it chooses one , then there are two boxes left for 2 Single Distinct balls ; so ball 4 have 2 options so suppose b4 sits in any ONE out of 2 box and the remaining one box can be taken by b5 . So , 6 ways ?

So, 5c3 * 2c1 * 1c1 * 3! . What is so hard to understand?

What is the mistake that am i not able to catch?
The mistake, again, is in including both the 2c1 and the 3!.

You choose 3 balls to go in the triple box (10 ways).
You choose 1 ball to go in the FIRST single box (2 ways).
You choose 1 ball to go in the SECOND single box (1 way).

At this point, you have to simply pick WHICH box will hold the 3 balls, which can be done in 3 ways. You DON'T also have to pick which of the single balls will go in which other box, because their order has already been picked. So the total number of ways is 10*3*3 = 60.

You could, instead, have just chosen the 3 balls (10 ways), and left it so you had a group of 3 and two (unordered) single balls, and then arranged those three items (3! = 6 ways). This gives 10*6 = 60 ways, again.

But you can't order the single balls, and then order them AGAIN as part of the whole set; that results in doubling the count, and is therefore wrong.

Now, let's look at what you did through one example. Suppose the balls are ABCDE. We choose three of them, say ACE to share a box, then one to be alone, say D, and another to be alone, B. One of the arrangements we can make of these is D, ACD, B; another is B, ACD, D. But these two arrangements would also have resulted from choosing ACD, then B, then D. That is where you have double counted.

Combinatorics is inherently difficult because of the ease with which we can miss details like overcounting. I always feel more confident when I can get the same result two different ways. You should never assume that an answer you find is right, without carefully thinking about whether you caught everything. (And that implies you should not insist you are right when someone else with more experience tells you you are wrong, and shows a better way.) The method both JeffM and I have explained, taking a series of steps to make a choice, is a good one, but even so it needs to be checked.


By the way, here is how pka's formula is derived, using your specific problem as an example:

We can put 5 distinct items in 3 distinct boxes in 3^5 = 243 ways.

We need to subtract the ways in which one box would be empty; there are 3 ways to choose the box in 3 ways, and then put the 5 items in the remaining 2 boxes in 2^5 ways, for a total of 3*32 = 96 ways.

But in subtracting that, we are double-counting ways in which two boxes would be empty, so we have to add that back on. There are 3 ways to choose which two boxes are empty, and 1 way to put all 5 items in the one remaining box, for a total of 3*1 = 3 ways.

So our result is 243 - 96 + 3 = 150.

The formula [MATH]\sum\limits_{k = 0}^N {{{( - 1)}^k}\dbinom{N}{k}{{(N - k)}^M}}[/MATH] gives

[MATH]\sum\limits_{k = 0}^3 {{{( - 1)}^k}\dbinom{3}{k}{{(3 - k)}^5}} =\\ {{{( - 1)}^0}\dbinom{3}{0}{{(3 - 0)}^5}} + {{{( - 1)}^1}\dbinom{3}{1}{{(3 - 1)}^5}} + {{{( - 1)}^2}\dbinom{3}{2}{{(3 - 2)}^5}} + {{{( - 1)}^3}\dbinom{3}{3}{{(3 - 3)}^5}} =\\ 1\cdot 3^5 - 3\cdot 2^5 + 3\cdot 1^5 - 1\cdot 0^5 = 243-96+3-0 = 150[/MATH]​

which is what I just did.

Now, the work of thinking through it, and even perhaps the work of calculating, is a little harder this way, but if you did this for a living (and were sure when the formula applies!), you would want to use the formula. If what you want is to learn how to think clearly, what we've shown you is better.
 
Top