Why do I get two different answers for this counting problem?

Solution 1:

It is worth noting that to count properly with the second approach, you would have to write $$3 \cdot 5 \cdot 21^2 + 3 \cdot 5^2 \cdot 21 + 5^3 = 8315.$$ The first term counts all cases where there is exactly one vowel, and there are three positions for the location of this vowel. The second term counts all cases where there are exactly two vowels, and there are three positions for the location of the sole consonant. The third term counts all cases where there are exactly three vowels, but we do not multiply by three because all three letters are of the same type. You only have to consider the ordering of the types of letters (vowel vs. consonant) when there is more than one type of letter used.

Solution 2:

When wondering why (or if) something is wrong, a general approach is to make the numbers as small as you can while still maintaining the error but so that you can brute-force the answer. So let's try an alphabet with one vowel A and one consonant B. (Note that this way you can never prove that something is correct, but it's a valuable tool for finding some errors.)

You get 1 word with no vowels (BBB), 3 words with one vowel (ABB, BAB, BBA), 3 words with two vowels (AAB, ABA, BAA), and 1 word with three vowels (AAA). Your first approach finds the correct number, $2^3-1^3=7$.

However, the second approach claims for example that there is only $1 \cdot 1^2 = 1$ word with exactly one vowel. From here, you can try to see why it gives the wrong answer work (which has already been answered by the other answers).

Solution 3:

Take the number of all three letter words, $26^3$, and subtract from it the number that have only consonants, $21^3$.

Your second method does not address all possible sequences of vowels, such as vowel-consonant-vowel or vowel-vowel-consonant or consonant-vowel-vowel...

Solution 4:

Refer to Binomial Expansion

$$(21+5)^3=21^3+\tbinom 31\cdotp 21^2\cdotp5+\tbinom 32\cdotp21\cdotp 5^2+5^3$$

so$$26^3-21^3= (3\cdot21^2\cdotp 5)+(3\cdot21\cdotp 5^2)+5^3$$

The binomial coefficients count the ways to select elements from a set.

In your case, that is positions to place the vowels in the word.

There are $3\cdot21^2\cdotp 5$ ways to select 1 vowels and two consonants where the vowel is in the first, second, or third place. And so on.