Probability Problem with $n$ keys

For $(a)$, probability that she will open on the first try is $\dfrac1n$. You have this right.

However, the probability that she will open on the second try is when she has failed in her first attempt and succeeded in her second attempt. Hence, the probability is $$\underbrace{\dfrac{n-1}n}_{\text{Prob of failure in her $1^{st}$ attempt.}} \times \underbrace{\dfrac1{n-1}}_{\text{Prob of success in $2^{nd}$ attempt given failure in $1^{st}$ attempt.}} = \dfrac1n$$

Probability that she will open on the third try is when she has failed in her first and second attempt and succeeded in her third attempt. Hence, the probability is $$\underbrace{\dfrac{n-1}n}_{\text{Prob failure in her $1^{st}$ attempt.}} \times \underbrace{\dfrac{n-2}{n-1}}_{\text{Prob of success in $2^{nd}$ attempt given failure in $1^{st}$ attempt.}} \times \underbrace{\dfrac1{n-2}}_{\text{Prob of success in $3^{nd}$ attempt given failure in first two attempts.}} = \dfrac1n$$ Hence, the probability she opens in her $k^{th}$ attempt is $\dfrac1n$. (Also note that the probabilities must add up-to one i.e. $$\sum_{k=1}^{n} \dfrac1n = 1$$ which is not the case in your answer).

For $(b)$, the probability that she will open on her $k^{th}$ attempt is the probability she fails in her first $(k-1)$ attempts and succeed in her $k^{th}$ attempt. The probability for this is $$\underbrace{\dfrac{n-1}{n}}_{\text{Fails in $1^{st}$ attempt}} \times \underbrace{\dfrac{n-1}{n}}_{\text{Fails in $2^{nd}$ attempt}} \times \cdots \underbrace{\dfrac{n-1}{n}}_{\text{Fails in $(k-1)^{th}$ attempt}} \times \underbrace{\dfrac1{n}}_{\text{Succeeds in $k^{th}$ attempt}} = \left(1-\dfrac1n \right)^{k-1} \dfrac1n$$ Again a quick check here is the sum $$\sum_{k=1}^{\infty} \left(1-\dfrac1n \right)^{k-1} \dfrac1n$$ should be $1$. Note that here her number of tries could be arbitrarily large since she doesn't discard the keys from her previous tries.


In (a) you’re calculating the probability that she will open the door on the $k$-th try given that she did not open it earlier; this is not the same as the probability that she will open it on the $k$-th try. Perhaps the easiest way to look at it is to notice that there are $n!$ equally likely orders in which she can try the keys. She opens the door on the $k$-th try if and only if the right key is in position $k$ in the order that she actually uses. The other $n-1$ keys can be in any order, so there are $(n-1)!$ orders with the right key in position $k$, and the probability that she will choose one of those orders is $$\frac{(n-1)!}{n!}=\frac1n$$ irrespective of $k$.

I see nothing wrong with your answer to (b).


Every key in the sequence is equally likely to be the one that opens the door, so the probability is $1/n$.

The first key works with probability $1/n$.

The conditional probability that the second key works, given that the first failed, is $1/(n-1)$.

Next we have $1/(n-2)$, and so on.

So for example, the probability that the fourth one works is $$ \Pr(\text{1st fails})\cdot\Pr(\text{2nd fails}\mid\text{1st fails})\cdot\Pr(\text{3rd fails}\mid\text{first 2 fail})\cdot\Pr(\text{4th works}\mid\text{first 3 fail}) $$ $$ = \frac{n-1}{n}\cdot\frac{n-2}{n-1}\cdot\frac{n-3}{n-2}\cdot\frac{1}{n-3}. $$ Do the obvious cancelations and get $1/n$.