A woman has n keys

982 Views Asked by At

A woman has n keys, of which one will open her door. After trying one she discards it and tries again if it does not work. What is the expected number of attempts needed?

Its straight forward to see that the probability of opening it on any go is $1/n$. Does this mean that, as $p$ is constant, the expected number is $\frac{1}{\frac{1}{n}}=n$.

This seems counter intuitive though as I would have expected it to be more like $n/2$

2

There are 2 best solutions below

0
On

Probability that the woman opens the door on the $1^{st}$ attempt is $\dfrac1n$.

Probability that the woman opens the door on the $2^{nd}$ attempt is $\dfrac{n-1}n \cdot \dfrac1{n-1} = \dfrac1n$.

Probability that the woman opens the door on the $3^{rd}$ attempt is $\dfrac{n-1}n \cdot \dfrac{n-2}{n-1} \cdot \dfrac1{n-2} = \dfrac1n$.

Hence, in general the probability that she opens the door on the $k^{th}$ attempt is $\dfrac1n$.

Hence, the expected number of attempts is $$\sum_{k=1}^n k \cdot \dfrac1n = \dfrac{n+1}2$$

0
On

Suppose she rather compulsively tries all the keys, even after finding the one that works. On average, she will try as many keys before the right key as after the right key; since there are $n-1$ wrong keys, the average number for both is $(n-1)/2$. That plus the correct key yields the average number of attempts as $(n-1)/2 + 1/2 = (n+1)/2$.