1
$\begingroup$

In this question on Information Security, different options are given for passwords. One example states that a password contains a mixture of numbers, letters and special characters.

Assuming that there are 52 letters, 10 numbers and 20 special characters, how many passwords would be possible assuming each password was required to have at least 1 number, letter, and special.

The leading answer lists that 52^10 would be the combinations in 10 letter password, but assuming it was required to have at least 1 of each case what would the number of possible passwords be?

$\endgroup$
1
$\begingroup$

You have to fill in ten "spaces", which you do as follows:

$\underline{ }\ \underline{ } \ \underline{ } \ \underline{ } \ \underline{ } \ \underline{ } \ \underline{ }\ \underline{ }\ \underline{ }\ \underline{ }$

You pick three spaces for the ones which need to be filled with one kind only in ${10 \choose 3}$ ways and multiply for each option (52),(10) and (20), next you pick any of the (82) remaining choices (which is 52 + 20 + 10) for the next seven spaces.

$\underline{(52)}\ \underline{(10)} \ \underline{(20)} \ \underline{(82)} \ \underline{(82)} \ \underline{(82)} \ \underline{(82)}\ \underline{(82)} \ \underline{(82)} \ \underline{(82)} $

So the answer is : ${10 \choose 3}(52)(10)(20)(82)^7$

So the leading answer is wrong because it counts for the number of passwords of length ten that contain ONLY letters.

In general, for passwords of lenght n containing at least one of each kind you count as follows:

${ n \choose 3}(52)(10)(20)(82)^{n-3}$

$\endgroup$
  • $\begingroup$ @EricJohnson I edited my answer because I thought you were asking about lenght 7 passwords. It could be easily generalized for lenght n. $\endgroup$ – Alfredo Lozano Oct 7 '16 at 22:18
  • $\begingroup$ By designating particular characters as special, you are counting passwords with more than one letter, more than one number, or more than one special character more than once. Say the password is $A7cb6!*5dT$. You count the password once when you designate $A$ as the letter, $7$ as the number, and $!$ as the special character and count it again when you designate $A$ as the letter, $7$ as the number, and $*$ as the special character. Obviously, you would be counting it yet again if you were to change the designated letter or number. We need to use the Inclusion-Exclusion Principle. $\endgroup$ – N. F. Taussig Oct 8 '16 at 10:55
  • $\begingroup$ That's right, thank you @N.F.Taussig $\endgroup$ – Alfredo Lozano Oct 8 '16 at 17:12
1
$\begingroup$

How many ten character passwords consisting of uppercase and lowercase letters contain at least one letter of each case?

Since there are $26$ uppercase and $26$ lowercase letters, the number of ten character passwords that could be formed if there were no restrictions is $52^{10}$. From these we must exclude those ten character passwords that contain only uppercase letters and those passwords that contain only lowercase letters. Since there are $26^{10}$ ten character passwords that contain only uppercase letters and $26^{10}$ ten character passwords that contain only lowercase letters, and there are no ten character passwords that contain neither an uppercase nor a lowercase letter, there are $$52^{10} - 2 \cdot 26^{10}$$ ten character passwords comprised only of uppercase and lowercase letters that contain at least one uppercase letter and at least one lowercase letter.

How many seven character passwords containing letters, numbers, and special characters can be formed if they contain at least one letter, number, and special character?

In what follows, I will assume that you wish to include an uppercase or lowercase letter, a number, and a special character. Since there are $26$ uppercase letters, $26$ lowercase letters, $10$ numbers, and $20$ special characters, the number of seven character passwords that could be formed if there were no restrictions would be $(26 + 26 + 10 + 20)^7 = 82^7$. From these, we must exclude those that do not contain a letter, a number, and a special character. There are $(10 + 20)^7 = 30^7$ passwords that do not contain a letter, $(26 + 26 + 20) = 72^7$ passwords that do not contain a number, $(26 + 26 + 10) = 62^7$ passwords that do not contain a special character, $20^7$ passwords that contain neither a letter nor a number, $10^7$ passwords that contain neither a letter nor a special character, and $(26 + 26) = 52^7$ passwords that contain neither a number nor a special character. Since there are no seven character passwords that contain neither a letter nor a number nor a special character, by the Inclusion-Exclusion Principle, the number of passwords that contain a letter, a number, and a special character is $$82^7 - 30^7 - 72^7 - 62^7 + 20^7 + 10^7 + 52^7$$

$\endgroup$
  • $\begingroup$ Your result is correct! (+1) $\endgroup$ – Markus Scheuer Oct 8 '16 at 12:36
1
$\begingroup$

Given an alphabet $V$ consisting of $52$ letters, $10$ numbers and $20$ special characters, we are looking for the number of different words of length $7$ containing at least one letter, one number and one special character.

We count the wanted words by calculating the number of all words of length $7$ built from the alphabet $V$ and subtract those which contain only one type or precisely two different types of characters.

  • The number of different words of length $7$ built from characters from $V$ is $$|V|^7=(52+10+20)^7=82^7$$

  • The number of different words containing precisely one type of characters is \begin{align*} 52^7+10^7+20^7 \end{align*}

  • The number of different words containing precisely two types of characters is \begin{align*} \sum_{k=1}^6\binom{7}{k}\left(52^k\cdot 10^{7-k}+52^k\cdot 20^{7-k}+10^k\cdot 20^{7-k}\right) \end{align*} The first term $\sum_{k=1}^6\binom{7}{k}52^k\cdot 10^{7-k}$ is the number of possibilities to place $52$ letters and $10$ numbers at $7$ places where at least one letter and at least one number occurs. The other summands are interpreted analogously.

We obtain the number of wanted words: \begin{align*} &82^7-\left(52^7+10^7+20^7\right)-\sum_{k=1}^6\binom{7}{k}\left(52^k\cdot 10^{7-k}+52^k\cdot 20^{7-k}+10^k\cdot 20^{7-k}\right)\\ &\quad=12383811148800 \end{align*}

in accordance with the result of @N.F.Taussig.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.