Counting the number of passwords with at least one digit, one consonant and one vowel How many $7$-key long passwords are there with at least one consonant and at least one vowel and at least one digit? Note that there are $5$ vowels and $21$ consonant and $10$ digits.
I tried to count the number of passwords without vowels ($31^7$), consonants ($15^7$) and digits ($26^7$). First I counted the number of passwords with at least vowel ($36^7-31^7$) (and then with consonants and digits too). Then I counted the number of passwords with at least one vowel and consonant($36^7-31^7-15^7$). Then I applied PIE to get the answer $36^7-31^7-15^7-26^7$. Is this correct? If not, where am I going wrong?
 A: What you have done thus far is correct.  However, your answer is not correct since you have subtracted those passwords which are missing both consonants and vowels, both consonants and digits, and both vowels and consonants twice, once for each way you could have designated one type of character as the missing type of character.  We only want to subtract them once, so we must add them to the total.
If we define $C$ to be the set of passwords with at least one consonant, $D$ to be the set of passwords with at least one digit, and $V$ to be the set of passwords with at least one vowel, then we wish to find
$$|C \cap D \cap V| = |U| - |C' \cup D' \cup V'|$$
where $|U|$ is the set of all possible passwords of length $7$.
By the Inclusion-Exclusion Principle,
\begin{align*}
|C' \cup D' \cup V'| & = |C'| + |D'| + |V'|\\
                     & \qquad - |C' \cap D'| - |C' \cap V'| - |D' \cap V'|\\ 
                     & \qquad\quad + |C' \cap D' \cap V'|
\end{align*}
$|U|$:  There are $36$ ways to fill each of the seven positions, so $|U| = 36^7$.
$|C'|$:  If the $21$ consonants are missing, there are $36 - 21 = 15$ ways to fill each of the seven positions, so $|C'| = 15^7$.
$|D'|$:  If the $10$ digits are missing, there are $36 - 10 = 26$ ways to fill each of the seven positions, so $|D'| = 26^7$.
$|V'|$:  If the $5$ vowels are missing, there are $36 - 5 = 31$ ways to fill each of the seven positions, so $|V'| = 31^7$.
$|C' \cap D'|$:  If both the consonants and digits are missing, there are $36 - 21 - 10 = 5$ ways to fill each of the seven positions with vowels, so $|C' \cap D'| = 5^7$.
$|C' \cap V'|$:  If both the consonants and vowels are missing, there are $36 - 21 - 5 = 10$ ways to fill each of the seven positions with digits, so $|C' \cap V'| = 10^7$.
$|D' \cap V'|$:  If both the digits and vowels are missing, there are
$36 - 10 - 5 = 21$ ways to fill each of the seven positions with consonants, so $|D' \cap V'| = 21^7$.
$|C' \cap D' \cap V'|$:  It is not possible to create a password if all the consonants, digits, and vowels are missing, so $|C' \cap D' \cap V'| = 0$.
By the Inclusion-Exclusion Principle, the number of admissible passwords is
$$36^7 - 15^7 - 26^7 - 31^7 + 5^7 + 10^7 + 21^7$$
