# 6 keys and a door( probabilities)

We have a key ring with 6 keys, but only one key opens the door. We test the keys to the door with no preference until we find the right key. Now we have two different cases:

1) At the first case when a key is not the right one we discard it and try the next one until we find the right one.

2) At the second case we have amnesia so when we try a key and its a wrong one we put it back in the key ring and we start again from the beginning to find the right key.

For both cases find the probabilities to: How many tries we will need in average, and the probability to find the right key exactly at the 4th try.

• What have you tried so far? Can you break the problem down into smaller parts? Can you think of a simpler version of the problem that you can try solving first? – Elliott May 4 '14 at 17:12

## 2 Answers

For 1), let X be the number of tries. Then E(X) is the expected number of tries. Recall that $E(X)=\sum_{x=1}^{x=6}xP(X=x)$.

$E(X)=1(\frac{1}{6})+2(\frac{5}{6})(\frac{1}{5})+3(\frac{5}{6})(\frac{4}{5})(\frac{1}{4})+4(\frac{5}{6})(\frac{4}{5})(\frac{3}{4})(\frac{1}{3})+5(\frac{5}{6})(\frac{4}{5})(\frac{3}{4})(\frac{2}{3})(\frac{1}{2})+6(\frac{5}{6})(\frac{4}{5})(\frac{3}{4})(\frac{2}{3})(\frac{1}{2}(\frac{1}{1})=\frac{7}{2}$

For 2) if you pick the correct key, it's a success and if you don't it's a failure. Let p be the probability of a success. Then $p=\frac{1}{6}$. So, you should notice that $X is Geometric(p)=Geometric(\frac{1}{6})$.

Now, you know that for a Geometric Distribution, $E(X) = \frac{1}{p}=6$
Finally, $P(X=4) =(1-p)^3p$

• yes i know what geometric distribution is. – Aggelos May 4 '14 at 18:25
• I've edited the answer to question 2 based on your response. – user137481 May 4 '14 at 20:23

Hint:

Let random variable $X$ be defined as the number of keys that are tryed when the door opens.

(1) What values can $X$ take and with what probabilities? Find $\mathbb{E}X$ on base of this distribution.

(2) $$\mathbb{E}X=\mathbb{E}\left(X\mid X=1\right)P\left(X=1\right)+\mathbb{E}\left(X\mid X>1\right)P\left(X>1\right)$$ Note that here: $\mathbb{E}\left(X\mid X>1\right)=1+\mathbb{E}X$.