# Permutations/Combinations: How many different passwords are possible?

Hello everyone. I have a couple questions this time, but I think if I understand how to do this one, I'll understand the others.

A particular online banking system uses the following rules for its passwords:
a. Passwords must be 6-8 characters in length
b. Passwords must use only alphabetical and numeric characters, and must have at least one alpha and one numeric character.
c. Letters are case sensitive.

Under these rules, how many different passwords are possible?

• Count all possible passwords of length 6, 7, 8, add them up, then count all possible all-letter and all-number passwords of length 6, 7, 8, and subtract them. Mar 9 '14 at 20:05

Count the number of legal passwords of length $6$, $7$, $8$ separately, and then add up.

We do the length $7$ case.

If we are using the standard alphabet, there are $26$ lower case characters, $26$ upper case characters, and $10$ digits, for a total of $62$.

There are $62^7$ words of length $7$ made up by choosing symbols from our $62$-element symbol set.

This is because the first symbol of the word can be chosen in $62$ ways, and for each of these ways the second symbol can be chosen in $62$ ways, and so on.

However, some of these words are forbidden. We count the forbidden words.

There are $52^7$ "all-letter" words. There are $10^7$ "all-digit" words. So there are $52^7+10^7$ forbidden passwords of length $7$. This leaves $62^7 -52^7-10^7$ allowed passwords of length $7$.

• Thank you so much. I think that makes perfect sense! Mar 9 '14 at 20:17
• You are welcome. In principle we could have counted the "allowed" passwords directly, but that is quite a bit more complicated. The "tick" of counting the "bads" and subtracting from total is often useful. Mar 9 '14 at 20:20

Permutation formula for ordered with repetition is n^r where n is the number of things to choose from and r is how many we are choosing to form another set. Total possible permutations is 62^8 However the rules state one numeric and one alpha must be used. The largest legal set considering all rules is 52^7 + 10^1. This is where 7 characters chosen are alpha and 1 character is numeric. The general formula to consider for this problem takes in to consideration sets to be used and the positions and order used. n1^r1 + n2^r2
where n1 is the number of the first set of characters to used and r1 is the number of positions those characters can be used in. The second term and any subsequent terms used are for how many items are in the that set n2 and how many positions it can occupy r2