Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

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.

share|improve this question
    
Related question: math.stackexchange.com/q/357296/3301 –  ja72 Aug 4 at 13:48
2  
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%$. –  Anonymous Pi Aug 4 at 19:10
1  
@AnonymousPi actually answered the question, the others just told you how many options there were. My answer would be "slim to none" :) –  paqogomez Aug 4 at 23:35
    
Edit: By $0.83$ and $0.98$ I meant $0.83$% and $0.98$%. The "%"'s didn't display in LaTeX. –  Anonymous Pi Aug 4 at 23:39
    
If you try three different PINs, the probability that you will get it right is simply 3/360. –  Alex Zorn Aug 8 at 5:59

5 Answers 5

up vote 6 down vote accepted

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$.

share|improve this answer
1  
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. –  user112061 Aug 4 at 13:48

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.

share|improve this answer

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.

share|improve this answer

$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.

share|improve this answer

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)

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.