I found this problem in a contest of years ago, but I’m not very good at probability, so I prefer to see how you do it:

A man gets drunk half of the days of a month. To open his house, he has a set of keys with 5 keys that are all very similar, and only one key lets him enter his house. Even when he arrives sober he doesn’t know which key is the correct one, so he tries them one by one until he chooses the correct key. When he’s drunk, he also tries the keys one by one, but he can’t distinguish which keys he has tried before, so he may repeat the same key.

One day we saw that he opened the door on his third try.

What is the probability that he was drunk that day?

**Answer**

The key thing here is this: let T be the number of tries it takes him to open the door. Let D be the event that the man is drunk. Then

P(D∣T=3)=P(T=3,D)P(T=3).

Now, the event that it takes three tries to open the door can be decomposed as

P(T=3)=P(T=3∣D)⋅P(D)+P(T=3∣¬D)⋅P(¬D).

By assumption, P(D)=P(¬D)=12. So, we just need to compute the probability of requiring three attempts when drunk and when sober.

When he’s sober, it takes three tries precisely when he chooses a wrong key, followed by a different wrong key, followed by the right key; the probability of doing this is

P(T=3∣¬D)=45⋅34⋅13=15.

When he’s drunk, it is

P(T=3∣D)=45⋅45⋅15=16125.

So, all told,

P(T=3)=16125⋅12+15⋅12=41250.

Finally,

P(T=3,D)=P(T=3∣D)⋅P(D)=16125⋅12=16250

(intentionally left unsimplified). So, we get

P(D∣T=3)=1625041250=1641.

**Attribution***Source : Link , Question Author : iam_agf , Answer Author : Nick Peterson*