Calculate total combinations for AABB and ABBB sets

combinatorics

Although both belong to a much broad combination of N=2 and n=4 (AAAA, ABBA, BBBB…), where order matters and repetition is allowed, both can be rearranged in different ways:

  • First one: AABB, BBAA, ABAB, BABA, ABBA, BAAB (6 possible combinations)
  • Second one: ABBB, BABB, BBAB, BBBA (4 possible combinations)

The first one could be seen as: "How many 2-pair of 6 can we get from 4 dices?"
The second one: "How many 3-pair of 6 can we get from 4 dices?"

Both have "pre-determined" repetitions, additional repetition isn't allowed and order matters (except A1A2A3B=A2A1A3B). Doing this manually is time consuming and would like to know an efficient approach for these type of problems.

Best Answer

The number of sequences of length $n$ composed of $k$ $A$s and $n - k$ $B$s is $$\binom{n}{k} = \frac{n!}{k!(n - k)!}$$ since selecting which $k$ of the $n$ positions will be filled by $A$s completely determines the sequences since all of the remaining $n - k$ positions must be filled by $B$s.