the question is roughly this;

A bank requires you to have a 4 digit pin, and a 6 digit/ character password which includes lower and upper case letters. Upon logging in the bank requests 3 digits from your pin and 3 digits from your password, what is the probability some will access your bank account in 3 attempts?

For the pin, the probability is $\frac{1}{1000}$, and for the password the probability is $\frac{1}{62\cdot62\cdot62}=\frac{1}{238328}$.

The probability of guessing both correctly and access the bank account is $\frac{1}{238328000}$.

The solution states that because you have three attempts, the probability to access the account is $$\frac{3}{n}=\frac{3}{238328000}.$$

I think this is wrong however, and the reason is because you wouldn't try the same guess another two times so I think the correct answer is actually, $$\frac{1}{238328000}+\frac{1}{238327999}+\frac{1}{238327998}.$$

Who is right?

  • 1
    $\begingroup$ I presume that with "digits" for the password you actually mean "characters" (52 choices for a slot). The probability will be different if some of the digits or letters are the same. Must all digits and characters be different? $\endgroup$ – Parcly Taxel Feb 2 '17 at 14:57
  • 1
    $\begingroup$ the second expression is a good approximation, I think accurately it is $1 - (1 - \frac{1}{238328000})(1 - \frac{1}{238327999})(1 - \frac{1}{238327998})$ that is 'one minus the chance of failing 3 times' what info you get back is a factor, for example whether or not you know which code was wrong - i presume you mean [a-z][A-Z][0-9] for the 62 choices $\endgroup$ – Cato Feb 2 '17 at 15:03
  • $\begingroup$ I fixed your comment about the digits. It's allowed to have both digits and lower/upper case letters. It doesn't specify whether each input has to be unique sorry. $\endgroup$ – Ryan Tandy Feb 2 '17 at 15:08
  • 2
    $\begingroup$ @cato: nope, the probability for the right code to be in a subset of $3$ among $238328000$ is simply that ratio. $\endgroup$ – Yves Daoust Feb 2 '17 at 15:17

The solution is right and does assume three different guesses.

The probability to succeed at the first attempt is


Then in case of a failure, the probability to succeed at the second attempt is $$\left(1-\frac1{238328000}\right).\frac1{238327999}=\frac1{238328000}.$$

Finally, a third attempt is successful with probability


The probability to succeed simply grows linearly as the number of attempts over the number of possibilities, and reaches one at exhaustion.


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.