I agree with Mark. Note that you use the fact that you subtract the number of words with no consonants and no vowels, and that these cases are jmutually exclusive. In general you have to proceed in this way.
First some notations:
N denotes total number of possibilities, in this case it is 9!/5!
c1, c2, c3, etc. denote conditions that need to be satisfied. In this case:
c1 = "there must be at least one consonant "
c2 = "there must be at least one vowel"
N[c1] is the number of possibilites such that c1 is satisfied
N[c2] is the number of possibilites such that c2 is satisfied
N[c1 AND c2] is the number of possibilites such that c1 AND c2 is satisfied
etc.
We want to know N[c1 AND c2]. We can write:
N[c1 AND c2] = N - N[NOT(c1 AND c2)]
You now use the fact that
NOT(c1 AND c2) = NOT(c1) OR NOT(c2)
So we have:
N[c1 AND c2] = N - N[NOT(c1 AND c2)] =
N - N[NOT(c1) OR NOT(c2)]
In general:
N[a OR b] = N[a] + N - N[a AND b]
All the possibilities that make a true are counted in N[a], those that make b true are counted in N, those that make both a and b true are counted in both N[a] and N, so they would be double counted, but the last term N[a AND b] subtracts these possibilites once so that they are counted once.
So, we can write:
N - N[NOT(c1) OR NOT(c2)] =
N - N[NOT(c1)] - N[NOT(c2)] + N[NOT(c1) AND NOT(c2)]
NOT(c1) means no consonants
NOT(c2) means no vowels.
NOT(c1) AND NOT(c2) thus cannot be satisfied and the last term is thus zero.
N = 9P4 = 9!/5!
N[NOT(c1)] = 5P4 = 5!
N[NOT(c2)] = 4P4 = 4!
Answer is 2880.
If you have more than two condition then the formula generalizes to:
N[a1 OR a2 OR a3 OR a4...] = N[a1] + N[a2] + ... - [N[a1 AND a2] +
N[a1 AND a3]+...all combinations of two a's] +
N[a1 AND a2 AND a3 ] + all combinations with three a's
- N[a1 AND a2 AND a3 AND a4 ] + etc.
The signs in this formula keep alternating when we add another argument in the N function, this is easy to prove. The formula is known as the principle of inclusion and exclusion.