# Probability of a given password

A password consists of 4 alphabet letters and 4 numbers. Calculate the following two probabilities:

1. $p_1$: the probability that the letters are all equal and that the numerical part contains one eight.
2. $p_2$: the probability that the password has 3 numbers followed by 4 letters.

Although it sounds like an easy question, but how would I apply the definition of permutations and combinations here? Here is how I thought of solving it.

$p_1= (1/21)^4*(1/10)*(9/10)^2$

Do I need to calculate all the possible combinations here?

$p_2= 1/\binom{7}{7}=1/7!/(7-7)!= 1/7!$

since we are considering only one case among a permutation of 7 elements over 7 places.

• Is this homework or some sort of assignment? If so, please add the self-study tag. – Peter Flom Oct 30 '13 at 10:30
• One thing is that in your 2nd equation, your calculation is wrong. $1/(7,7) = 1/(7!/7!) = 1$ – Peter Flom Oct 30 '13 at 10:34

Suppose that each symbol of the password occupies one of $8$ numbered boxes. First you choose $4$ of the $8$ boxes to put the letters, and each choice gives you $26^4$ possible letters configurations. Now, in the remaining $4$ boxes you put the digits, and each choice gives you $10^4$ possible digits configurations. Therefore, the total number of passwords is $$\binom{8}{4} \times 26^4 \times \binom{4}{4} \times 10^4 \, .$$ For the password with the letters all equal and one digit $8$, from the $8$ boxes you choose $4$ to put the letters, and each choice gives you $26$ possible letters configurations. From the remaining $4$ boxes you choose $3$ to put digits, and each choice gives you $10^3$ digits configurations. In the last remaining box you put the digit $8$, which gives us $$\binom{8}{4} \times 26 \times \binom{4}{3} \times 10^3 \times \binom{1}{1} \times 1$$ paswords. I'm supposing that we can have more than one digit $8$.
P.S. For Huber's simplified problem, the number of possible passwords is $$\binom{4}{2} \times 1 \times \binom{2}{2} \times 2^2 = 24 \, .$$
• To see whether your formula is correct, let's apply it to a simpler problem with just one letter (say $a$) and two possible digits (say $0$ and $1$) available, and suppose we want to use two letters and two digits. Adjusted for these changes, the formula appears to claim there are $\binom{1+2-1}{2}\binom{2+2-1}{2}4!$ = $72$ distinct configurations. I can only find $2^2=4$ two-digit numbers and $\binom{4}{2}=6$ ways to intersperse a pair of $a$'s among them, for just $24$ possibilities. – whuber Oct 31 '13 at 6:44