# Number of ways to pick balls with conditions on their colors

The problem it's in my native language which isn't English so this is my translation:

There are 12 balls with different colors (12 colors) and you need to pick 5 balls, which at least 1 is red and you can't have more than 2 balls of same color. On how many ways can you pick the balls (1 by 1). Example: Red Red Green Blue Yellow or Green Red Blue Blue Purple

Edit: New translation: You go in a ice cream store. There are 12 different flavors you can pick from. You want to buy ice cream with 5 ice-cream balls/flavors, but you must have(pick) at least one chocolate flavor/ball and you cannot have more than 2 flavors(balls) of the same kind. How many ways there are to build(buy) the ice-cream?

This is my solution which I don't know if its correct:

You must pick at least 1 red ball so it can be on 5 different spots. Then you can pick from all 12 balls and after that you can pick 11 caz red could be in those 12 so it can't be picked again. Again 11 (for the 4th spot) and in the end 10 ways. So in the end we got 5*12*11*11*10 = 7260 ways the you can pick the balls.

• We’ll need more information: how many different colors are there? Aug 31, 2016 at 17:52
• How many colors are there and how many balls of each color? Aug 31, 2016 at 17:52
• There are 12 balls with different colors (12 colors) Aug 31, 2016 at 17:57
• @Mickey: If they are all of different colors, then you can’t even have more than one ball of the same color, so the condition that you can’t have more than two balls of the same color is superfluous. Are you sure that you’ve translated the problem correctly? If you have, I would count like this: There are $\binom{11}4=330$ different sets of $4$ balls that do not include the red ball, so there are $330$ different sets of $5$ balls that do include the red ball. Each of these sets can be picked in $5!=120$ different orders, so there are altogether $330\cdot120=39600$ different ways. Aug 31, 2016 at 18:02
• But if there are 12 balls, all with a different colour, then how would it even be possible to pick two balls of the same colour? Do you have to pick from all twelve balls for each 5 balls you need to pick?
– Abby
Aug 31, 2016 at 18:04

There are $\binom{11}4=330$ ways to choose $4$ non-chocolate flavors and $5!=120$ ways to arrange them and chocolate in a cone with $5$ different flavors; that accounts for $330\cdot120=39600$ different possibilities.

We could also have a cone with $4$ different flavors, one of them occurring twice. There are $\binom{11}3=165$ ways to choose the $3$ non-chocolate flavors and $4$ ways to choose which flavor will appear twice. Finally, there are $\binom52=10$ ways to decide which two scoops will be the repeated flavor, and there are then $3!=6$ ways to arrange the remaining $3$ scoops. This adds another

$$165\cdot4\cdot10\cdot6=39600$$

possibilities.

Finally, we could have just $3$ different flavors, two of them occurring twice. There are $\binom{11}2=110$ ways to choose the two non-chocolate flavors and $\binom32=3$ ways to choose which two flavors are repeated. Say that the repeated flavors are $A$ and $B$, and the non-repeated flavor is $C$. Then there are $\binom52=10$ ways to choose which two scoops are $A$ and $\binom32=3$ ways to choose which two are $B$, for a total of

$$110\cdot3\cdot10\cdot3=9900$$

possibilities.

The grand total is therefore $39600+39600+9900=89100$ different possibilities.

• Thank you so much Brian, I wouldn't think of this solution in a million years, I wish I have the knowledge you have one day. I would up vote your solution but "Thanks for the feedback! Votes cast by those with less than 15 reputation are recorded, but do not change the publicly displayed post score." Aug 31, 2016 at 19:01
• @Mickey: You’re very welcome. Aug 31, 2016 at 19:02