Possible number of passwords combinations

combinatoricspermutations

We have been given the following question for our mock exam:

Each student has a password, which is 6 characters long and each character
is either a digit or a lower case letter. Each password must contain at least
ONE letter. How many possible passwords are there?

26 lower case letters
10 digits
6 characters long
At least one letter

The way I understood, is that it would be easier using inclusion-exclusion, therefore:

$36^6 – 10^6 $ = 2175782336

However another student mentioned it would be:

$36^6 – 10^5 $ = 2176682336

And I also heard:

$36*36*36*36*36*26$ = 1572120576

I think the word "at least ONE letter" is throwing me off a bit. Would anyone mind explaining this to me, please?

Best Answer

Your understanding, and your solution of $36^6 - 10^6$, are correct.


The problem with the answer of $36 \times 36 \times 36 \times 36 \times 36 \times 26$ is that it does not account for the number of different arrangements that are possible. This would be the solution if the password rules were:

  • 6 characters long
  • The first five characters are lower case letters or digits
  • The sixth character is a non-digit character

However in the actual rules, the restriction on digits is that at least one character has to be a non-digit. There is no specification of which digit this has to be.


Inclusion-exclusion is the perfect way to approach the problem. There are $36^6$ sequences of six digits satisfying the first three rules you posted. The fourth rule, At least one letter, rules out all the passwords that are composed entirely of digits. There are $10^6$ of these, so this can be subtracted from the $36^6$ figure. The person who suggested subtracting $10^5$ either made a mistake, or got slightly confused.