[Math] How to calculate the number of potential combinations in a password

combinatorics

If I create a $10$ digit password with the following requirements:

  • At least one uppercase letter A-Z : $26$
  • At least one lowercase letter a-z : $26$
  • At least one digit from $0-9$ : $10$
  • At least one common symbol $(\#,\$,\%,$ etc) : $32$

By inclusion-exclusion, I can calculate I have ~ $3.2333\mathtt E+19$ possible combinations

However, if I change one of the requirements to at least TWO digits $0-9$, how can I calculate the possible combinations?

Best Answer

You have to choose 10 letters, and 2 of them must be digits. Furthermore, there must be one each of a lowercase letter, an upper case letter, and a common symbol. For the others, there are 5 choices to be made, and these are to be made from $26+26+10+32 = 94$ characters.

This gives

$94^5 \approx 7.339e9$

choices for the the 6 other characters that do not have to be digits. And for the digits, there are 2 choices from 10 characters. So this gives

$ 10^2 = 100$

choices. And for the one each of lower-case letters, upper-case letters, and common symbols there are

$ 26 * 26 * 32 = 21632$

choices.

Now lastly, there are $10!$ permutations of these 10 characters, so the total number of combinations of these characters is:

$26*26*32*100*94^5 * 10! \approx 5.76e22$