[Math] Guessing password within 10 tries

probabilitystatistics

A password is either 4, 5, 6 characters long, and can only contain 2, 3, 5, 7 and must contain at least 1 two. Find the probability that your friend guesses the password within 10 attempts.

There are a total of: $5364 – 1044 = 4320$ possible passcodes that work.

But how do I fit in the 10 attempts?

First try + second try + … + tenth try?

$=1/4320 + 1/4319 + .. + ?$

Im not sure, would like help!

Best Answer

The total number of passwords should be the number of 4-6 digit passwords using the characters 2, 3, 5, and 7 minus the number of passwords using just 3, 5, and 7. For this you compute

$$(4^4 + 4^5 + 4^6) - (3^4 + 3^5 + 3^6) = 5376 - 1053 = 4323.$$

The probability that your friend guesses on the first attempt is $\frac{1}{4323}$, as you said.

The probability that your friend guesses your password on the second attempt is the probability that she guesses wrong on the first attempt and right on the second attempt. That's $\frac{4322}{4323}\cdot\frac{1}{4322} = \frac{1}{4323}$.

Similarly, let's say you look at the third attempt: you want the probability that your friend guesses wrong on the first and second tries, and then guesses your password on the third try. That happens with probability $\frac{4322}{4323}\cdot\frac{4321}{4322}\cdot\frac{1}{4321} = \frac{1}{4323}$.

The same pattern continues: assuming your friend guesses a different password every time, the probability that she guesses on the $n^\text{th}$ attempt is $\frac{1}{4323}$.

Now, as you suggested, you can add the probabilities corresponding to the first try + second try + ... + tenth try, since you want to know the odds that she guesses right on the first try or the second try or the third try, and so on.

This gives you a probability of

$$10 \cdot \frac{1}{4323} = \frac{10}{4323}.$$

Related Question