A valid password for the bank's website consists of 8 characters (digits and letters in English) and must contain at least one digit, at least one small English letter, and at least two capital letters. How many legal passwords are there?
I considered four sets:
$|A|$ = number of ways for no digits appearing in the password = $52^8$,
$|B|$ = number of ways of no small letter in the password = $36^8$,
$|C|$ = number of ways of no capital letter in the password = $36^8$,
$|D|$ = number of ways of only 1 capital letter in the password = $26*36^7$, and
$|U|$ = number of ways of forming the bank's password without restriction = $62^8$.
Using the formula for inclusion and exclusion for 4 sets $|U| - [ |A| \cup |B| \cup |C|\cup |D|]$
such that
$$ \begin{align} &|A\cup B\cup C\cup D|\\[3pt] &=|A|+|B|+|C|+|D|\Big\}\text{ all singletons}\\ &-(|A\cap B|+|A\cap C|+|A\cap D|+|B\cap C|+|B\cap D|+|C\cap D|)\Big\}\text{ all pairs}\\ &+(|A\cap B\cap C|+|A\cap B\cap D|+|A\cap C\cap D|+|B\cap C\cap D|)\Big\}\text{ all triples}\\ &-|A\cap B\cap C\cap D|\Big\}\text{ all quadruples.}\\ \end{align} $$
Now what I'm stuck at is when it comes to triples and quadruples.
$|A\cap B\cap C\cap D|$, to find the number of ways of union of this is kinda contradicting because we have to find a password with no digits, no small letters, no big letters, but only 1 small letter..
or when
$|A\cap C\cap D|$ is also contradicting because how we can find number of ways of password with no big letters and also 1 big letter..
There is no contradiction, just note that $C\cap D=\emptyset$ and therefore all intersection sets including $C\cap D$ have zero cardinality. Moreover, by a similar reason, also $A\cap B\cap C=\emptyset$ and $A\cap B\cap D=\emptyset$. Thus it remains to compute $$\begin{align} &|U|-(|A|+|B|+|C|+|D|)+(|A\cap B|+|A\cap C|+|A\cap D|+|B\cap C|+|B\cap D|) \end{align} $$ P.S. One more thing, your number for $|D|$ should be multiplied by $8$, i.e. the possible positions of the capital letter.