[Math] Number of 8-digit Passwords with at least 1 digit and/or 1 symbol

combinatoricsdiscrete mathematicsinclusion-exclusion

I think I know how to calculate the number of 8-digit passwords with 1 digit or 1 symbol.
The sets are lowercase (26), uppercase (26), symbols (32), digits(10). That means there are $(26 + 26 +32 + 10)^8 = 94^8$ total passwords and I just have to remove the all letter combinations $(52)^8$, so $94^8 – 52^8$.

For the number of passwords with a digit and a number, I am confused.

All Combos: $94^8$

All Letters: $52^8$

Letters + Digits: $62^8$

Letters + Symbols: $84^8$

I think I need inclusion/exclusion. I know that I am removing too many numbers, if I just subtract $94^8 – 52^8 – 62^8 – 84^8$, but I'm not sure how to build the intersections.
S AND D

Best Answer

The passwords which aren't allowed are:

i) those with no symbol, but at least one digit: there are $62^n-52^n$ of these
ii) those with no digit, but at least one symbol: there are $84^n-52^n$ of these
iii) those with no digits or symbols: there are $52^n$ of these.

Overall, therefore, $62^n-52^n+84^n-52^n+52^n=62^n+84^n-52^n$ aren't allowed, so $94^n-84^n-62^n+52^n$ are allowed.