# Homework Help: Probability with combinatrics and distribution (big question)

1. Apr 23, 2012

### hb2325

Q. The digital security code needed to open a safe in a bank is 7835. A thief tries to open the safe by entering a randomly chosen sequence of 4 digits ( each digit is independent and equally likely to be any number from 0 to 9 )

A. Find the probability that the thief enters the correct code.

B. Find P that the thief gets first or 2nd digit right (or both)

C. Thief carries on entering digits till he gets it right, forgets which sequences he entered so all sequences are equally likely and successive attempts are independent. Let Y be the number of attempts till he enters the correct code. Name the distribution of Y and find P ( y>= 200)

D. Suppose thief knows that the code is composed of digits 2,5,7,8, he enteres them in random orders.

i) find P of thief entering right code.
ii) Find p of entering exactly 2 of 4 digits in correct position.

Attempt at Ansers :

A: Probability of entering correct code = (1/10)^4 = 1/10,000

B: P of getting first digit right = 1/10, second = 1/10 so first or 2nd = 2/10 or 1/5, getting both right = 1/10*1/10 = 1/100 so, B = 20/100 + 1/100 = 21/100

C: I'm not sure what to call this distribution. Not uniform, binomial, exponential? Geometric I think but I can't explain why, I kind of don't understand exponential/geometric distributions.

P(y>=200) erm I'm stumped. I know in a geometric is p x=k is q^k-1 * p where q is probability of first trial failing but I dont know how to go from x=k to x>k or x<k.

Very confused and any input would be appreciated, thank you.

D i) Correct code = 1/4! = 1/24
ii) Exactly 2 in correct order = ( 1/4 * 1/3 ) * 2, because you can arrange any 2 numbers in 2 ways. = 1/6.

Last edited: Apr 23, 2012
2. Apr 23, 2012

A,B,D look correct.
C. it is the geometric distribution. To find P(y>=200), you have to find 1 - F(199), where F is the cdf of the geometric distribution.

3. Apr 23, 2012

### PAllen

I think B is incorrect. The 1/10 of guesses that are right for the first digit include those that are also right for the second digit. Same for second digit right including first digit correct case. Thus, both right is double counted if you just add these. Further, the 1/10 probability includes cases of all digits correct, etc.

What I would say, based on this, is that the probability of getting at least one of the first two digits correct is .1 + .1 - .01 = .19. This includes the possibility of getting more than two correct. If you want to exclude those, you need more adjustments.

4. Apr 23, 2012

### PAllen

Note, for C, your definition that prior sequences are forgotten, so the same might be chosen twice, makes this a problem 'sampling with replacement'. The key difference, is 'with replacement', after 10,000 tries, it is still possible the key has not been found (and some wrong keys will have been found multiple times). 'Without replacement', it is certain that you have the key in 10,000 tries.

So p(y>=200) is simply 1-.9999^199

5. Apr 24, 2012

### PAllen

I think D)ii) is also incorrect. Consider that there are 6 choices for which two digits are in the correct positions. For each of these, the 'correct digits' must be placed in the correct positions (one choice), and the incorrect digits must be placed incorrectly (also one choice - the other way is correct). Thus of the 24 permutations, 6 are correct in exactly two positions. Thus p=1/4, not 1/6.

6. Apr 25, 2012

### hb2325

PAllen thanks for taking the time to look at this I really appreciate it.

For B so If I subtract the probability of getting both of the first two correct from the addition of first or second, that's it but it's still double counting three and four? What would be the further adjustments if you could please help me with them?

For D)ii) Ok what you say makes sense and after writing the 4 numbers down in sequences of 2 I can see that you are correct, but I don't understand still how even though we are looking at permutations since order matters, why do I have to take combinations of the 2 numbers :S.

Thanks again.

For C

7. Apr 25, 2012

### PAllen

To correct B to a precise answer is actually easy. Just: .19 *.9 *.9

As for better explaining D)ii, I will have to punt. I actually thought quite a bit how to explain it, and couldn't come up with anything better than what I wrote. Hopefully, someone else might help with an explanation, or just continue thinking about it and playing around with similar problems.