[Math] Permutations when some objects are alike

permutations

I am trying to find the total number of signals that can be created from $3$ pink, $3$ white and $2$ black flags when arranged in a straight line. But, only $5$ flags are allowed in a signal.

I know how to find permutations in this situation when all are taken at a time i.e. a signal has $8$ flags, which would be $\frac{8!}{3! \cdot 3! \cdot 2!}$, but cannot see how to start solving a scenario where all are not taken at the same time.

Formula when all are taken at a time with some like objects

$$\frac{n!}{a! \cdot b! \cdot c! \cdot d!…}$$

Question

Is there a modified formula that will give permutations of $n$ objects taken $r$ at a time when some of these objects are alike and $r < n$?

Best Answer

Let's generalize the problem slightly and find the number of signals with $r$ flags, say $a_r$. Let $f(x)$ be the exponential generating function for $a_r$, i.e. $$f(x) = \sum_{r=0}^{\infty} \frac{1}{r!} a_r x^r$$ Since there are 3 pink, 3 white, and 2 black flags, $$f(x) = \left( 1 + x + \frac{1}{2!} x^2 + \frac{1}{3!} x^3 \right)^2 \left( 1 + x + \frac{1}{2!} x^2 \right)$$ Expanding this polynomial (I cheated and used a computer algebra system), we find

$$f(x) = 1+3 x+\frac{9 x^2}{2}+\frac{13 x^3}{3}+\frac{35 x^4}{12}+\frac{17 \ x^5}{12}+\frac{35 x^6}{72}+\frac{x^7}{9}+\frac{x^8}{72}$$ so the number of signals with 5 flags is $$5! \; \frac{17}{12} = 170$$