# How many 8-character passwords are there if at least one of each A-Z, a-z, and 0-9 are used?

How many 8-character passwords are there if each character is either A-Z, a-z, or 0-9, and where at least one character of each of the three types is used?

The complement of "at least one of each" is "either A-Z, a-z, or 0-9 is NOT used"

I defined a set |A|=62^8, all possible passwords. I then defined three more sets: B - those passwords without A-Z, C - those passwords without a-z, and D - those passwords without 0-9.

|B| = 36^8, |C|=36^8, and |D| = 52^8.

Then by counting the complement, |A| - |BUCUD| = |A|-|B|-|C|-|D| + |BinterC| + |BinterD| + |CinterD|.

|BintersectC| = Those without A-Z and without a-z = 10^8, etc.

Therefore I got $$62^8 - 36^8 - 36^8 - 52^8+ 10^8 + 26^8 + 26^8$$ as the answer.

Not sure if I counted my sets right, please let me know!

-

Depends on whether order matters or not. Are you allowed to have numbers and letter repeat etc etc. That will dictate on whether you are going to use a permutations or a combination.

-
No restrictions - order doesn't matter & repetition allowed –  user64025 Feb 27 at 19:28
Bump to Cameron –  EhBabay Feb 27 at 19:43
If order matters (so that $12345678$ and $87654321$ would be different passwords, for example) and repetition is allowed, then you've done it exactly right.
If order doesn't matter, and repetition is allowed, then we need to proceed differently. We'll need one each from the capital letters, the lower case letters, and the digits, with the other $5$ chosen from the general pool. Hence, the total number in that case is $$26\cdot 26\cdot 10\cdot 62^5.$$
If we don't allow repetition, and order doesn't matter, then we have $$\binom{26}{1}\cdot\binom{26}{1}\cdot\binom{10}{1}\cdot\binom{59}{5}$$ options.