Trying to understand solution: string of eight English letters that start and end with X that contain at least one vowel, if letters can be repeated?

441 Views Asked by At

For the problem of finding the number of strings of eight English letters that start and end with X that contain at least one vowel, if letters can be repeated, I tried to come up with a solution but it does not match the solution in the book. I am having a hard time wrapping my head around this.

What I tried: Since there are 8-2 positions (the 2 X's), for the 6 positions, there are 5 vowels and $21^5$ consonants. This would mean that there are $5*6*21^5 = 122523030$ strings.

The solution says the answer is $26^6 - 21^6 = 223,149,655 $. Wouldn't this solution just be the number of ways all letters can be positioned subtracted by number of ways all consonants can be positioned? I'm having a hard time understanding why this would be the solution.

2

There are 2 best solutions below

6
On BEST ANSWER

Trying to build by hand as you have is tough; for instance, you have not accounted for any such strings that have 2 vowels in them, or 3, etc.

Instead, lets try an old trick and count the number of ways we can fail, instead of succeed. What does a failure look like? It looks like a string with no vowels at all.

So, how many strings are there with no vowels? Just place consonants (21 of these) into the 6 positions (for a total of $21^6$ strings). Well how many strings were possible to begin with? There were 6 free positions, so out of $26^6$ possible strings, only $21^6$ were bad.

0
On

There are only $6$ letters to make decision for. The book solution consider the number of length $6$ strings without restriction subtract away strings without any vowel (that is the complement of at least one vowel).

For your approach, you chose a single vowel, choose a position to place it and then fill the rest with consonants but remember it is possible to have more than one vowel.