Number of possible passwords with same characters

combinatorics

We have a password with length of 6 characters, out of a possible 27 letters, 10 digits and 8 special characters.

My questions are:

  • A: How many possible combinations there are?

  • B: How many combinations have at least two same characters?

  • C: How many combinations have at least one special character?

  • D: How many combinations have exactly two same characters (and others are different characters)?

The answer to A is $(27+10+8)^6$ but B, C and D are a mystery to me. Could I have some advice on the problem?

Best Answer

  • B: Consider the opposite event, that no characters are repeated. Choose the first character. Once having chosen the first character, choose the second character noting that it can not be the same as the first. Then choose the third character noting it cannot be either of the first two characters, etc... Apply rule of product and conclude.

$45\times 44\times 43\times 42\times 41\times 40$, the falling factorial written commonly as $~_{45}P_6$, as $P(45,6)$, or my preference being $45\frac{6}{~}$

Using this count, subtracting it away from the result from A gives the count we are interested in

$45^6-45\frac{6}{~}$

  • C: Again, consider the opposite event, the number of sequences with no special characters. The same logic used in A can be used here to count the opposite event. The same logic used in B taking the opposite event away from the overall total will work here as well.

$45^6 - 37^6$

  • D: Pick the character which is to be repeated. Pick the locations of that character. Then, from left to right, pick what characters occupy the remaining positions noting that we may not repeat for these.

$\binom{6}{2}45\frac{5}{~}$