You just rented a large house and the realtor gave you five keys, one for the front door and the other four for each of the four side and back doors of the house. Unfortunately, all keys look identical, so to open the front door, you are forced to try them at random. Find the distribution and the expectation of the number of trials you will need to open the front door. (Assume that you can mark a key after you’ve tried opening the front door with it and it doesn’t work.)

I started doing this problem by setting r.v. $X$ to be the number of trials (keys) you have to try in order to unlock the front door. Then in order to find the distribution, I know I have to find the probability of success for each number of trials.

This is what I came up with X Pr[X] 1 1/5 2 1/4 3 1/3 4 1/2 5 1/1

I thought this was true because for example

The probability of 1 key opening the front door is 1/5

The probability of 2 keys opening the door is 1/4 because one of the keys have already been marked as incorrect (sampling without replacement)

However, the answer turned out to be this:

enter image description here

I'm confused as to why $Pr[K=2] = \frac{4}{5} \times \frac{1}{4}$ ... where did those values come from? I think if I understand the method used for the first one I can figure out the rest

  • 2
    $\begingroup$ Wait... there's a door on all 4 sides AND there's a front door? Where's the front door? Are you suggesting there's two doors in the from side of the house, and the house also has 3 extra entrances? Also shouldn't they only need 1 key...? Someone call the architect!!! $\endgroup$ – Eric Lee May 22 '17 at 5:10
  • $\begingroup$ @EricLee sounds like a security concern! $\endgroup$ – Carpetfizz May 22 '17 at 5:11
  • 1
    $\begingroup$ They find 1 of your keys, you're screwed! $\endgroup$ – Eric Lee May 22 '17 at 5:13

You're reasoning can't be correct, since you claim that there's a $100$% chance that $X=5$. What you actually calculated is the probaility that the $n^{th}$ key will be correct given that all the previous keys were incorrect. But this is a distinct probability.

For example, consider the scenario $X=2$. That is, the first one doesn't work, and then the second one does. The probability that the first one doesn't work is $\frac 4 5$, and the probability that the second does work given that the first one didn't is $\frac 1 4$, as you reasoned. Therefore, the total probability is the product of these two numbers, namely $\frac 1 5$.

Here's another way to think about this problem: for each $1\leq n \leq 5$, the probability that the correct key is the $n^{th}$ one tried is the same regardless of $n$, since no position in this sequence is preferred. Therefore, $P[X=n]=\frac 1 5$ for each $n$.

  • $\begingroup$ Thank you for providing a reason to why my original reasoning was incorrect. $\endgroup$ – Carpetfizz May 22 '17 at 5:22

If $k=2$ that means two things happened: the first key did not work (which happens with probability $\frac{4}{5}$) and the second key did work (which happens with probability $\frac{1}{4}$)

  • $\begingroup$ Thanks! Yours was the first reply and I get it now. Will accept as soon as it lets me $\endgroup$ – Carpetfizz May 22 '17 at 5:12

For $K=2$ you should also consider the first try as well. That is, the probability of failure. $4$ keys out of $5$ keys are wrong AND then one key can open the door. This becomes $(\frac{4}{5})(\frac{1}{4})$.

In general, the probability of success at the $K$th trial (assuming independence) is the product of the probability of failure at the first $K-1$ trials, multiplied by the probability of success at the last try.


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.