Suppose a sequence of 8 nucleotides contains 2 each of A, C, G, T. How many such sequences are there?

The answer is $${8\choose 2} \cdot {6\choose2} \cdot {4\choose2} \cdot {2\choose2} = 2520$$ -- by choosing the location of A, C, G, then T.

Why can't I say the choices are: A,A,C,C,G,G,T,T and then choose the permutation of it? Isn't it the same as permuting the string "AACCGGTT" = 8! = 40320? Where does my logic fail here?

• The same logic would conclude there are $8!$ nucleotide sequences with eight A's, wouldn't it--but obviously there is only one such sequence. BTW, you meant to write "$\times$" in place of "$+$" in your formula.
– whuber
Apr 30, 2015 at 17:11
• Using your idea of choosing a permutation, my post at stats.stackexchange.com/a/288198/919 immediately shows the answer must be $8!/(2!)^4$ and so it may provide some insight.
– whuber
May 26, 2020 at 12:51

Here's a thought experiment that may be helpful: imagine that you have some kind of linear pegboard with 8 slots, all in a row. Now imagine that you have 2 pegs, labeled $A_{1}$ and $A_{2}$. How many ways are there to arrange these two pegs in the 8 different holes or slots? Well, you can put the first peg, $A_{1}$, into any of the 8 slots, and after that, you have 7 choices left over for the remaining peg, so the total is $8 \times 7 = 56$ distinct configurations. Another way of writing the same thing is $8 \times 7 = \frac{8!}{6!}$. Now suppose that you erase the labels, so that the two $A$'s, previously distinguishable, are no longer distinguishable. Now how many ways are there to arrange the two pegs, both now simply labeled identically as $A$? The answer is half as many as before, because every previous arrangement among the original set of 56 will have exactly one mirror image arrangement with the labels swapped, which will become indistinguishable from its partner when the labels are removed. So, with the labels removed, there are $\frac{8!}{2 \cdot 6!} = 28$ ways of arranging the two pegs. Taking advantage of the fact that $2 = 2!$, this can be rewritten as $\frac{8!}{2! \cdot 6!}$ or, using combinatoric notation, as $\left(\begin{array}{c} 8 \\ 2 \end{array} \right)$.

For every one of your 28 ways of arranging the two $A$ pegs in the original 8 slots, you will always be left with 6 remaining holes or slots. Now, suppose you have two identical pegs both labeled $C$; how many ways are there of arranging those in the remaining 6 slots? Following the same pattern as before, you will have $\left(\begin{array}{c} 6 \\ 2 \end{array} \right)$ distinct arrangements.

Continue carrying the same process through with two $G$'s and two $T$'s, and you have your answer: $\left(\begin{array}{c} 8 \\ 2 \end{array} \right) \cdot \left(\begin{array}{c} 6 \\ 2 \end{array} \right) \cdot \left(\begin{array}{c} 4 \\ 2 \end{array} \right) \cdot \left(\begin{array}{c} 2 \\ 2 \end{array} \right) = \frac{8!}{2^{4}} = 2520$.

• Correct: but the question asks for something a little different. What exactly is the error in concluding that $8!$ is the answer? BTW, the answer for the pegboard is only around half as large as $2520$, because it can be turned around. (A nucleotide sequence has an inherent order but a pegboard does not.)
– whuber
Apr 30, 2015 at 17:14
• Well, I suppose that if it helps to make the explanation clearer, we could stipulate that we will write the symbols 3' and 5' on either ends of the string of 8 holes, just like a real strand of DNA, but that strikes me as being needlessly fussy and pedantic about relatively minor details. To spell out the error a bit more : 8! is the correct answer if all bases were individually distinguishable from one another. The division by $2^{4}$ is necessary because we have 4 sets of 2 identical items. Apr 30, 2015 at 19:14

The problem is that if you choose a permutation such as $(1 2) (3 4) (5 6) (7 8)$ (using one-line permutation notation), then you will get back the original sequence. So you're double-counting it.

In fact, your approach counts each sequence $2^4$ times (since you can either switch or not-switch each of the four types of base pair), so another way to get the same answer is $\frac{8!}{2^4} = 2520$.