How many strings of six lowercase letters from the English alphabet contain the letters a and b with all letters different? Answer: 7650720

I saw a resolution that considered the two types of strings different:

1) Possible strings not containing a nor b.

2) Possible strings not containing a and b.

But I do not understand why. Can someone explain or present another solution?


Here’s one solution: there are $6$ choices for the position of a, and then $5$ choices for the position of $b$. After this we have $24$ remaining possibilities for the next letter (because all letters must be distinct, and we have used two letters already), and then $23$ possibilities, and so on... We then apply the rule of product to give

$$6 \cdot 5 \cdot 24 \cdot 23 \cdot 22 \cdot 21 = 7650720$$

To address your other question, consider the string ‘xya’. It is a string ‘not containing a and b’ because it doesn’t contain both a and b, but it is not a string ‘containing a nor b’ because it contains a.


Another solution:

  • First, calculate how many sets of 6 different letters that include a and b there are. The two letters are fixed so we have 24 remaining letters at our disposal and we need to pick 4. It is possible in $\binom{24}{4}$ ways.
  • Second, calculate the number of permutations of each such set. Clearly, this is $6!$.
  • Finally, multiply the two numbers to get the total:

$$\binom{24}{4} \cdot 6! = 7650720$$


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.