# Counting the number of 4-letter strings containing A and B and having no repeated letters

The letters ABCDEFGH are to be used to form strings of length 4. How many strings contain the letters A and B if repetitions are not allowed?

The total number of possible combinations are $8×7×6×5$
The total number of combinations if A and B are not allowed is $6×5×4×3$

So the answer is the difference of the two, which is $(8×7×6×5) - (6×5×4×3) = 1320$

Please tell me if I am correct and if not, point me in the right direction.

• You counted the strings that have A or B or both. Nov 22 '15 at 21:14

If you choose the positions of A and B in that 4-letter string, then you get 6.5 possible strings. But then you can choose the positions of A and B in how many ways: 4.3, right? So in total you get 4.3.6.5 such strings. So my answer is 360.

• Um, when A and B are taken, aren't there only 6 more letters to choose from? So it should be 4.3.6.5 ? Nov 22 '15 at 21:20
• @satjav Right, thanks. Nov 22 '15 at 21:21

If the four-letter string must contain A and B, then there are $\left(6 \atop 2 \right) = 15$ pairs of letters you could choose from the remaining six letters C, D, E, F, G and H.

You now have $15$ possible sets of four letters. Each set of four letters can be arranged in $4! = 24$ different ways, giving you $15 \cdot 24 = 360$ possible strings.