# When should the Geometric Distribution be used?

I tried solving the following problem:

A man has $n$ keys on his keyring, out of which only one opens a door. How many times is he expected to try his keys if he tries them completely randomly, without excluding unsuccessful keys from his further trials?

I thought it would be suitable to model the number of trials using $X \sim Geom(\frac{1}{n})$ giving the answer $E(X) = \frac{1}{\frac{1}{n}} = n$.

However the solution is given as follows: Why is it wrong to use the geometric distribution in this scenario and what is the intuition to using the solution above instead?

EDIT: I was looking at the wrong solution. The correct solution to the stated problem is as proposed: • Your problem says "without excluding", but your solution has "excluding". These are 2 different assumptions. In other words, you've posted a solution to a different problem... – user940 Jan 7 '16 at 16:07
• Ah I see! There's a discrepancy between the problem and solution sheets I've been given. Thanks for spotting. This makes a lot more sense. – kw3rti Jan 7 '16 at 16:33

## 2 Answers

In addition to drhab's answer, the reason why your formula doesn't work is that your use of $E[X] = \frac{1}{\frac{1}{n}} =n$ is derived from an infinite sum, i.e. $\sum_{i=1}^{\infty} ip(X=i)$, but you do not have an infinite sum in this problem. Once you know one key of the $n$ doesn't work, you're not going to try it again. If you picked a key and random and then you could try it again later before you found the right key, then you could consider using a geometric distribution

In this situation $P(X\leq n)=1$ wich is not the case by geometric distribution with $p=\frac1{n}$.

I don't manage to say something deeper about the solution, since it speaks for itself.

You just have $P(X=i)=\frac1{n}$ for $i=1,\dots,n$ and based on that you can find the expectation of $X$.

P.S. My answer is based on the description of the problem under "However the solution is given as follows:" wich differs (as @Byron remarked) from the first description.

• The solution makes sense when the unsuccessful keys are excluded in the later trials, however if the question was as I interpreted (that keys are not excluded), would my solution then give the correct answer? – kw3rti Jan 7 '16 at 16:39
• Yes, in that case your solution is correct. – drhab Jan 8 '16 at 8:24