6
$\begingroup$

A friend and I recently talked about this problem:

Say my friend feels a little adventurous and tells me that exactly three of four digits of his PIN-code are the same, what is the probability that I will guess it in three tries?

At first I thought this shouldn't be too difficult to count, but the digit restriction threw me off. Essentially I want to count how many possible PIN-codes there are with the restriction that $3$ of $4$ digits are the same. I tried thinking in terms of using sums, but I got stuck. I actually ended up making a quick MATLAB-script that computed the number of possible PIN-codes using a brute force method. Assuming that my script is correct there are $360$ codes that abide by this restriction out of a total of $10^4=10\hspace{4 px}000$ possible PIN-codes. Using this it is easy to calculate the rest, but I am now wondering how one might go about this in a more elegant way.

A PIN-code is a $4$-digit number where the possible digits are $0,1,2,...,9$. So for my question two examples of possible codes are $3383$ and $2999$. Let's assume that there are no further restrictions, although in reality there likely are, and that each digit is equally likely. It is important to note that I do not know if it is $0,1,...,8$, or $9$ that appears three times.

This question is not homework or anything, it is really just for curiosity. Thanks for any help!

(By the way I saw this question: Combinatorics and Probability Problem but it did not help me.) EDIT: I made an error in my script. Updated.

$\endgroup$
6
  • $\begingroup$ Related question: math.stackexchange.com/q/357296/3301 $\endgroup$ Aug 4, 2014 at 13:48
  • 2
    $\begingroup$ And because (answers below), the number of possibilities is equal to 360, the probability that you will guess it in three tries is equal to $1-(1-1/360)^3 ≈ 0.83%$ (assuming you guess randomly. But if you learn from your mistakes and don't try a combination twice, the real answer becomes $1-(\frac{359 \times 358 \times 357}{360^{3}}) ≈ 0.98%$. $\endgroup$ Aug 4, 2014 at 19:10
  • 1
    $\begingroup$ @AnonymousPi actually answered the question, the others just told you how many options there were. My answer would be "slim to none" :) $\endgroup$
    – crthompson
    Aug 4, 2014 at 23:35
  • $\begingroup$ Edit: By $0.83$ and $0.98$ I meant $0.83$% and $0.98$%. The "%"'s didn't display in LaTeX. $\endgroup$ Aug 4, 2014 at 23:39
  • 1
    $\begingroup$ Just wanted to point out that the above comment by @AnonymousPi seems incorrect: If you learn from your mistakes it should be $1 - (\frac{359 \cdot 358 \cdot 357}{360 \cdot 359 \cdot 358})$ $\endgroup$
    – Elias
    Mar 9, 2017 at 16:22

6 Answers 6

8
$\begingroup$

Suppose $n$ is repeated. There are 9 other numbers that can occur. And the other digit can occur in 4 possible positions giving $36$ possibilities.

There are $10$ possibilities for $n$ so the total number of combinations with exactly three digits the same is $360$.

$\endgroup$
1
  • 1
    $\begingroup$ Thanks a lot everybody. Of course it is much easier to think of the digit that is unique, instead of the repeating ones. This makes it quite simple in fact, didn't think of that! Upvoted all answers since they are essentially the same. Accepted this since you were the first to answer. $\endgroup$
    – Eff
    Aug 4, 2014 at 13:48
5
$\begingroup$

There are ten choices for the repeating digt, nine choices for the different digit, and four choices for its position. Hence there are indeed $10\cdot 9\cdot 4=360$ matching PINs.

$\endgroup$
2
$\begingroup$

The way I approached the problem is to break it down into three possibilities. The repeating number from $0,1,...,9$ with ten possibilities. The unique number $0,1,...,9$ excluding the first pic, so nine possibilities. After that the location of the unique number in the combination which can be $1,2,3,4$ for four possibilities.

This gives us $10*9*4 = 360$ different possible combinations which match your conditions.

$\endgroup$
2
$\begingroup$

$4$ possibilities for position of the digit that is different from all others.

$10$ possibilities for this digit itself.

$9$ possibilities left for the three others.

That gives $4\times10\times9=360$ possibilities.

$\endgroup$
2
$\begingroup$

Number of possibilities:

  1. The repeated number has 10 options.
  2. The forth number has 9 possibilities remaining.
  3. The forth number can be found in each of the four places of the PIN number (4 options) thus, we get: 10*9*4 = 360.

Probabilities:

The probability of guessing the PIN code in one try is simply: 1/360.

The probability of failing is: 359/360.

Using Bernoulli trials formula:

The probability of guessing the PIN code in exactly the third try is: (1/360)^3.

But the probability of guessing the PIN code in exactly one of 3 tries is: 3*(359/360)^2*(1/360)

$\endgroup$
-1
$\begingroup$

10000 guesses that would be including double and triple and four same number 0000,0001,0002, 1000 ,1111,2245 ,5001 ,8768 ,9990. .eg So the chance of get a four number pin is 1 in 10, 000 that's is 0000 is included

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .