# In how many ways can the balls be put in the box?

Five balls of different colors are to be placed in three boxes of different sizes. Each box can hold all five balls. The number of ways in which we can place the balls in the boxes so that no box remains empty is

The solution to this problem has been given using the inclusion-exclusion approach in this link.

But I approached the problem from a different perspective and wanted to know where am I going wrong. Here's my solution:

So to ensure that no box remains empty, here are the possible configurations: (3 1 1) (2 2 1) Since the boxes are of different size so altering the configuration will also give rise to another possibility.

Now going with the first configuration i.e. (3 1 1), we see that:

The number of ways to select 1 box which will have 3 balls is 3C1. Now the number of ways to select 3 balls from 5 different balls is 5C3.

Hence the ways to put 5 balls in any of the three boxes will be: 3C15C3 Now for the other box, we have 1 box choice and 1 ball choice of remaining 2 balls. So the combination will be: 2C12C1

The last box will be chosen in 1 way and so will be the last ball.

Hence total possible ways:= 3C15C32C22C1=120 ways.

Now going with the second case that is: 2 1 1: Number of ways to select the box is: 3C1 Number of ways to select 2 balls: 5C2 Hence the configuration results in: 3C15C2 Similarly for the remaining two configurations we have: 2C13C2 and 1 ways.

Now if we compute combinations of second case we get: 3C15C22C13C2=180 ways. So the total number of ways should be 120+180 that is 300 ways. But answer seems to be 150. I know I have considered some factors twice, but couldn't figure it out where exactly it's happening. Kindly help me.

• Welcome to MathSE. This tutorial explains how to typeset mathematics on this site. – N. F. Taussig Nov 24 '19 at 16:15

For your first case, you should have $$\binom{3}{1}\binom{5}{3}\binom{2}{1}=60.$$ You wrote $$\binom{2}{1}\binom{2}{1}$$ as the number of ways to place the balls in the boxes that will contain one ball. However, it should be just $$\binom{2}{1}$$ since you only need to choose 1 ball from the 2 remaining to put in the second box, and then there will be only one choice for the last box.
Your second case should be for the configuration 2, 2, 1, not 2, 1, 1. So there are $$\binom{3}{1}$$ ways to choose the box that will have 1 ball and $$\binom{5}{1}$$ ways to choose the ball for that box. For the remaining two boxes, there are $$\binom{4}{2}$$ ways to choose the two balls for one of the boxes, and only one choice for the balls in the last box. So we get $$\binom{3}{1} \binom{5}{1}\binom{4}{2}=90.$$
So in total, $$60+90=150$$.
• No, by choosing a box and then choosing a ball you are double counting. Say the last two boxes are B and S (big and small) and the last two balls are numbered 1 and 2. According to you, the number of ways to place the balls in the boxes is $\binom{2}{1}\binom{2}{1}=4$. However, there are only two choices - B1 and S2, or B2 and S1. Since the boxes are different sizes, we can start with the bigger of the two and say there are 2 choices for the ball that goes in that one. Then there is only 1 choice for the smaller box. – kccu Nov 24 '19 at 16:09