How many permutations of $ABCDEFG$ contain $AB$ and $DC$

binomial-coefficientscombinatoricsdiscrete mathematicsfactorial

Consider this question: Consider permutations of the sequence of seven letters $ABCDEFG$. How many of the permutations contain the strings $AB$ and $DC$?

If we think of $AB$ and $DC$ as one element, we see that we're just looking for permutations of the set ${AB, DC, E, F, G}$. There are 5 elements in this set, so there are $5! = 120$ permutations.

However, think of this way: we're looking to place $AB$ and $DC$ somewhere within the string $EFG$. There are $4$ possible positions (an underscore signifies a possible position): $\_E\_F\_G\_$

There are $4\choose2$ $=6$ ways to choose the positions of the elements $AB$ and $DC$.

Of course, the letters $EFG$ can be arranged in any way. There are $3! = 6$ permutations of a $3$-element set.

So in total we have $4\choose2$ $3! = 36$ possible permutations.

Which of these two ways of thinking is correct, and what's wrong with the other one? Is the answer $120$ or $36$? Any help is appreciated!

Best Answer

The $120$ is correct.

With the other approach, you cannot have $AB$ and $DC$ next to each other. So, both can end up in any of the four places before, in between, or after the $E,F,G$, so that's another $4 \cdot 6=24$ options.

OK, but that's still only $36+24=60$ ...?

Well, note that your second method also does not differentiate between something like $ABEDCFG$ and $DCEABFG$, i.e. where the $AB$ and $DC$ are swapped. So, you need to double the $60$ ... and you're back at $120$