Counting number of strings with at least one consonant

combinatoricspermutations

The English alphabet contains $21$ consonants and $5$ vowels. How many strings of $7$ lowercase letters of the English alphabet
(repeats allowed) contain:

(a) exactly one consonant

(b) exactly two vowels

(c) at least one consonant

(d) at least one vowel and at least one consonant

For (a) I got $C(21,1) \times C(7,1) \times 5^6$

For (b) I got $5^2 \times C(7,2) \times 21^5$

I have no idea if these are correct. The ones I struggled with are (c) and (d), could someone help me with the last two please?

Edit: After reading the comment by David G. Stork:

For (c), I did $26^7 – 5^7$. Since each of the $7$ positions can be one of $26$ letters, so total number of strings is $26^7$, then minus all the strings that does not have a consonant to get the strings that has at least one consonant.

Best Answer

Your answers to the first three questions are correct.

How many strings of $7$ lowercase letters of the English alphabet (repeats allowed) contain at least one vowel and at least one consonant.

The strings that contain at least one vowel and at least one consonant are those that are those not composed only of vowels or only of consonants.

Let $S$ denote all strings of $7$ lowercase letters.

Let $V$ denote all strings of $7$ lowercase letters that contain at least one vowel.

Let $C$ denote all strings of $7$ lowercase letters that contain at least one consonant.

Then we wish to find $V \cap C$. To do so, we subtract those strings that contain no consonants or no vowels from the total number of strings.

$$|V \cap C| = |S| - |V^C \cup C^C|$$

If we subtract those strings with no vowels and no consonants from the total number of strings, we will have subtracted those strings with neither vowels nor consonants twice. Since we only want to subtract such strings once, we must add them back. However, it is not possible to form a string of length $7$ that contains neither consonants nor vowels. Hence, the answer can be obtained by subtracting the number of strings with no vowels and the number of strings with no consonants from the total. Since there are $21^7$ strings with no vowels and $5^7$ strings with no consonants, we obtain \begin{align*} |V \cap C| & = |S| - |V^C \cup C^C|\\ & = |S| - (|V^C| + |C^C| - |V^C \cap C^C|)\\ & = |S| - |V^C| - |C^C| + |V^C \cap C^C|\\ & = 26^7 - 21^7 - 5^7 + 0\\ & = 26^7 - 21^7 - 5^7 \end{align*}