How many passwords of exactly 8 upper case letters contain the letters X and Y with X appearing before Y, with all letters distinct?

105 Views Asked by At

For the password to contain both X and Y:

$a = 26^8- 2 \cdot 25^8 + 24^8$

Would the answer to this question be $\frac{a}{2}$? Because all the strings with x appearing in front of y would be different from y in front of x, but they should be the same number of strings so we can just divide?

Am I doing this right/what am I missing?

2

There are 2 best solutions below

0
On

That all letters are distinct invalidates your work and suggests that we

  • pick X and Y first and then six more letters out of the remaining 24: $\binom{24}6$
  • permute the letters: $8!/2$, where the divisor of 2 arises because each password with X before Y is in bijection with a password with Y before X

Thus there are $\binom{24}6\frac{8!}2$ passwords.

0
On

The dividing by $2$ idea is correct, but not your initial calculation.

There are ${\large{\binom{24}{6}}}$ choices for the $6$ letters other than $X,Y$.

Once those $6$ letters are chosen, there are $8!$ ways to order all $8$ letters.

Hence the total number of legal words is $$\frac{\binom{24}{6}8!}{2}$$

As one indication of where you went wrong, note that $26^8$ counts the number of $8$-letter words, where the letters are not required to be distinct.