3
$\begingroup$

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?

$\endgroup$
1
  • 3
    $\begingroup$ I think your answer is correct. There are $36^6$ possible strings of $6$ digits/letters. Of those, there are $10^6$ strings that contain only digits $\endgroup$
    – Moko19
    Sep 2, 2021 at 13:12

4 Answers 4

4
$\begingroup$

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.

$\endgroup$
1
  • $\begingroup$ Thanks @Alira! Glad I'm taking the right approach for this one. $\endgroup$
    – WhatMDoing
    Sep 2, 2021 at 13:41
3
$\begingroup$

Your answer is the correct one and your explanation for it is correct.

The answer of $36^5\cdot 26$ is the number of passwords who start with a letter... but what you want to count doesn't care necessarily where the letters appear. (Equivalently, it is also the number of passwords who end with a letter)

The answer of $26\cdot 6\cdot 36^5$ is wrong because it makes a distinction about which is the "first" "guaranteed" letter placed when such a distinction is impossible when looking at the final result. The value is even larger than the number of strings when no restrictions were in place.

The answer of $36^6-10^5$ makes little sense how such an error occurred... likely just a typo.

$\endgroup$
1
  • $\begingroup$ Thanks @JMoravitz! Yep! It is now very clear to me! Thank you both for you help on this one. $\endgroup$
    – WhatMDoing
    Sep 2, 2021 at 13:42
1
$\begingroup$

Your answer is totally correct. Since you must remove all the possible combinations where not even a single alphabet is used. To do this you must subtract $10^6$ and not $10^5$.

$\endgroup$
0
1
$\begingroup$

Your solution of $36^6$ - $10^6$ is correct as $36∗36∗36∗36∗36∗26$ would only be applicable if the last digit of the password was required to be a lowercase letter.

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .