Two brothers share a car. They each have n keys in their pocket. They try one key at random and discard it until they can get the right one to start the car. Brother $A$ has only $1$ compatible key in his pocket. Brother $B$ has $2$ compatible keys. The probability that brother A gets the car in the garage each night is $\frac{1}{2}$ and same for brother B. Given that 5 attempts were made to start the car before it got in the garage, what is the probability that it was brother $B$?
Let $X$ be the number of attempts to start the car including the final successful one i.e. $X = \{1 \ldots n\}$.
Probability $A$ starts car in $5$ attempts $$\mathbb{P}(X=5|A) = \frac{(n-1)(n-2)(n-3)(n-4)}{n(n-1)(n-2)(n-3)(n-4)}=\frac{1}{n}$$
Probability $B$ starts car in $5$ attempts $$\mathbb{P}(X=5|B) = \frac{(n-2)(n-3)(n-4)(n-5)3}{n(n-1)(n-2)(n-3)(n-4)}=\frac{2(n-5)}{n(n-1)}$$
And we want to find
$$\mathbb{P}(B|X=5)=\frac{\mathbb{P}(X=5|B)\mathbb{P}(B)}{\mathbb{P}(X=5|B)\mathbb{P}(B)+\mathbb{P}(X=5|A)\mathbb{P}(A)}$$
where $$\mathbb{P}(A)= \mathbb{P}(B) = \frac{1}{2}$$.
Does this reasoning make sense?
EDIT continued:
$$\frac{\frac{2(n-5)}{n(n-1)}\frac{1}{2}}{\frac{2(n-5)}{n(n-1)}\frac{1}{2}+\frac{1}{2}\frac{1}{n}}$$
$$\frac{\frac{2(n-5)}{(n-1)}}{\frac{2(n-5)}{(n-1)}+1}$$
$$\frac{2(n-5)}{3n-11}$$
All the steps seem reasonable,
But for $ℙ(X=5|B)$, I think it should be $\frac{2(n-5)}{n(n−1)}$ because B only have 2 compatible keys and he/she needs to pick these any of these two out from the remaining (n-4) unchecked keys.
The Bayes rule will give you the answer of $ℙ(B|X=5)$