I'm trying to count this using the principle if inclusion-exclusion. I've done the following:
- Counting the number of permutations of $aabbbccdd$.
- $9!$
- Counting the number of permutations of $aabbbccdd$ without repetitions.
- $\displaystyle\frac{9!}{2!3!2!2!}$
- Now I guess I need need to count the number of permutations in which all letters are together which is $4!$.
- $\displaystyle\frac{9!}{2!3!2!2!}-4!$
- Now counting the number of permutations in which $a,c,d$ are adjacent, I guess that this number is $\displaystyle \frac{3\cdot 7!}{3!2!2!}$.
- $\displaystyle\frac{9!}{2!3!2!2!}-4!-\frac{3\cdot 7!}{3!2!2!}$
- Now counting the number of permutations in which we have permutations of 2 $b$'s together and then the number of permutations which have $3$ $b$'s together, I have $3\cdot 2/2!$, then $\displaystyle\frac{3 \cdot 7!}{2!2!2!}+\frac{6!}{2!2!2!}$
- $\displaystyle\frac{9!}{2!3!2!2!}-4!-\frac{3\cdot 7!}{3!2!2!}-\frac{3 \cdot 7!}{2!2!2!}-\frac{6!}{2!2!2!}$
- Now I know that are intersections in there. But I'm unable to think about something to count them, I guess that I should add the number of intersections to the result:
- $\displaystyle \frac{9!}{2!3!2!2!}-\left( 4!-\frac{3\cdot 7!}{3!2!2!}-\frac{3 \cdot 7!}{2!2!2!}-\frac{6!}{2!2!2!}+ \cap_n \right)$
Is this correct? If so, how can I count the intersections? I guess that the actual formula would be expressed as:
$$\displaystyle \frac{9!}{2!3!2!2!} \cap (4! \cup \frac{3\cdot 7!}{3!2!2!} \cup \frac{3 \cdot 7!}{2!2!2!} \cup \frac{6!}{2!2!2!})$$
Use the principle of inclusion and exclusion, iterated for the tripplet and the three pairs.
$$\left(\tfrac{9!}{3!\;2!^3}-\tfrac{8!\;2}{2!^3}+\tfrac{7!}{2!^3}\right) -\tbinom{3}{1}\left(\tfrac{8!}{3!\;2!^2}-\tfrac{7!\;2}{2!^2}+\tfrac{6!}{2!^2}\right) +\tbinom{3}{2}\left(\tfrac{7!}{3!\;2!}-\tfrac{6!\;2}{2!}+\tfrac{5!}{2!}\right) -\left(\tfrac{6!}{3!}-5!\;2+4!\right)$$
$\frac{9!}{3!\;2!^3}$ counts all the permutations of the multiset.
$-\frac{8!\; 2}{\;2!^2}$ over excludes the permutation where two
bare adjacent.$+\frac{7!}{2!^3}$ reincludes permutations where all three
bare adjacent$-{3\choose 1}\left(\frac{8!}{3!\;2!^2}-\frac{7!\;2}{2!^2}+\frac{6!}{2!^2}\right)$ excludes (as the above) for where also one pair of
a,c, ordare togetherThen we reinclude where also two pair of those three are together.
Finally rexcluding where also all three of those are together/