# Combinations of collections with repeating elements

I don't know why I am having so much trouble with this, but I can't figure it out. I need to determine the number of combinations of a set where the order matters, but the original set has some (not unlimited) repeated elements.

Example: I have a box with 2 yellow, 3 green, 1 red, and 2 blue balls. I want to know how many unique selection orders there are when selecting all 8. So, here are a few choices:

YYGGGRBB YYGGGBRB YYGGGBBR YYGGRGBB ...

The key is that the balls of the same color are not unique, so BRB is the same regardless of which blue ball is taken first, but BBR is different.

Is there a formula for this? I know it's not simply n! or nCr.

If the balls were all distinct, you would have $8!$ orders. Now we say that two orders are the same if the only difference is swapping the two yellow balls, so would have to divide by $2!=2$. They are also the same if you change the order of the green balls, which is a division by $3!=6$ as there are that many ways to order them. The final answer is $\frac {8!}{2!3!2!}=1680$ These are the multinomial coefficients

• @MarcvanLeeuwen: makes sense to me. I'll update. I think I will keep the reference, just change the text. – Ross Millikan Nov 23 '13 at 16:48