# 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
{"ft_lang_label":"__label__en","ft_lang_prob":0.9674724,"math_prob":0.95500827,"size":1072,"snap":"2022-05-2022-21","text_gpt3_token_len":287,"char_repetition_ratio":0.12734082,"word_repetition_ratio":0.0,"special_character_ratio":0.27518657,"punctuation_ratio":0.07053942,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9913478,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2022-05-16T15:55:35Z\",\"WARC-Record-ID\":\"<urn:uuid:2812a831-7e64-4e0f-8ff2-af528705513d>\",\"Content-Length\":\"231709\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:a9744380-69fd-4150-bf02-b02b574b034e>\",\"WARC-Concurrent-To\":\"<urn:uuid:c3dcd86c-9cb0-4c1b-a0d1-c1f0f6e09d09>\",\"WARC-IP-Address\":\"151.101.1.69\",\"WARC-Target-URI\":\"https://math.stackexchange.com/questions/1910025/number-of-ways-to-pick-balls-with-conditions-on-their-colors\",\"WARC-Payload-Digest\":\"sha1:TXH6YKOO4OA2MQDJO2VIKNFJQXIRKB5R\",\"WARC-Block-Digest\":\"sha1:JXA4E7GAGLJCFYLTZJI3JMHWPKGA3SSB\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2022/CC-MAIN-2022-21/CC-MAIN-2022-21_segments_1652662510138.6_warc_CC-MAIN-20220516140911-20220516170911-00453.warc.gz\"}"}