Velvet Star Monitor

Standout celebrity highlights with iconic style.

updates

Probability concerning a 6-digit password

Writer Andrew Mclaughlin
$\begingroup$

Consider the situation of decoding a 6-digit password that consists of the symbols $A$ to $Z$ and $0$ to $9$, where all possible combinations are tried randomly and uniformly.

(a) What is the probability that the correct password will never be entered?

(b) What is the probability that eventually the same combination will be entered two consecutive times?


I am so bad in these combinatorial things.

Can anybody explain me how to calculate these two probabilities, please?

I know that there are $36^5$ possibilities to try.

Edit

For (a) I think I have to look at $$ \left(\frac{36^5-1}{36^5}\right)^n\to 0\text{ as }n\to\infty. $$ So the probability that the correct password will never be entered is 0.

$\endgroup$ 2

2 Answers

$\begingroup$

Answering (a):

  • The probability that the correct password will be entered is $\frac{1}{36^6}$

  • The probability that the correct password will not be entered is $1-\frac{1}{36^6}$

  • The probability that the correct password will not be entered after $n$ attempts is $(1-\frac{1}{36^6})^n$

  • Hence the probability that the correct password will never be entered is $\lim\limits_{n\to\infty}(1-\frac{1}{36^6})^n=0$


Answering (b):

Having entered a password:

  • The probability to enter the same password is $\frac{1}{36^6}$

  • The probability to enter a different password is $1-\frac{1}{36^6}$

  • The probability to enter a different password over $n$ attempts is $(1-\frac{1}{36^6})^n$

  • Hence the probability to always enter a different password is $\lim\limits_{n\to\infty}(1-\frac{1}{36^6})^n=0$

  • Hence the probability to eventually enter the same password is $1-\lim\limits_{n\to\infty}(1-\frac{1}{36^6})^n=1$

$\endgroup$ 2 $\begingroup$

If there are $6$ digits with $36$ possible values each, I think there are $36^6$ possible combinations altogether.

Regardless of the exact number of combinations, your reasoning for part (a) is sound.

For part (b), if you keep on making guesses indefinitely (not stopping after you guess the correct password), then eventually you will guess the same value twice in a row with probability $1$ (for reasons similar to part (a)).

If the question is which will happen first, guessing the correct password or making the same guess twice consecutively, consider that after the first guess, each time you guess another sequence of six digits you have an equal chance to guess the correct password or to guess the same sequence as the previous guess. There is a possibility that you will guess the correct password on the very firstattempt, however.

Addendum: Calculations for part (b).

If you interpret the problem to mean that guessing will stop when a correct password is guessed, then one way to work the answer is as follows.

Let $p$ be the probability of each possible outcome of each guess. In this particular problem, $p = \frac1{36^6}.$ Consider the first pair of consecutive guesses that are the same. For this to occur on guesses number $n+1$ and $n+2$ requires the following sequence of events:

  1. The first guess is not the correct password. This occurs with probability $1-p.$
  2. Each of the next $n$ guesses is neither the correct password nor the same as the previous guess. Each of these events has probability $1-2p$ given that all the previously required events occurred (that is, given that no previous guess was the correct password).
  3. The guess after that sequence (that is, guess number $n+2$) is the same as the guess before it. This occurs with probability $p.$

This is the story for any non-negative integer $n$, and there is no other way to guess the same password twice. Moreover, the cases for $n = 0, 1, 2, \ldots$ are all disjoint outcomes, since you can only have one "first pair of equal guesses" in any given experiment. The probability that we will have at least one pair of consecutive equal guesses is therefore the sum of probabilities over all these cases: $$\sum_{n=0}^\infty p(1-p) (1-2p)^n.$$ This is the sum of a geometric series, so it is not hard to evaluate.

A simpler method is to consider that to guess the same password twice, our first guess must differ from the correct password (which happens with probability $1-p$), and on each guess after that we have an equal chance either to guess correctly (in which case we stop guessing) or to guess the same password as the previous guess. By symmetry, neither of these events is more likely than the other to occur first. But if a correct guess occurs first, then we never have a duplicate, whereas if a duplicate guess occurs first then of course we do have a duplicate. That gives us a $\frac12$ chance of a duplicate if the first guess is not correct, which gives us an overall probability of $\frac12(1-p).$

$\endgroup$ 7

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy