I have a homework question that I want to see if I did correctly.
The question asks
How many strings of $4$ letters begin or end with one of the five vowels?
I got $5 \cdot 26^2 \cdot 5$ for my final answer. My thinking was that for the first spot, you only have $5$ possible choices, the next $2$ spots of the string can be any letter of the alphabet, and then the last spot also has to be a vowel, so you only have $5$ choices for that. Is my thinking and answer correct?
To summarizer the discussion in the comments:
The question is asking for the number of four letter strings that can be formed out of the usual $26$ (repetitions allowed) where we require that at least one of the first and last letters be chosen from the $5$ standard vowels. The solution proposed in the original post is incorrect, as it counts those strings in which both the first and last letters are vowels.
Two methods of solution were discussed in the comments.
Method I: direct
There are $5\times 26^3$ strings of length $4$ that begin with a vowel, and the same number that end in a vowel. If we simply add these, we double count those strings which both begin and end in a vowel. Hence we have to subtract those. Thus the answer is $$2\times 5\times 26^3-5^2\times 26^2=158860$$
Method II: from the complement
It is easy to count the strings which fail our test; these are the strings that both begin and end with one of the $21$ consonants. Thus there are $21^2\times 26^2$ of these. As there are $26^4$ strings in total, the answer is $$26^4-21^2\times 26^2=158860$$