# Searching for keys in a desk

Here’s a representative example of a situation I think about all the time.

I was at the lab and noticed my keys were missing. I was fairly sure I had left them in one of the ten drawers of my desk, but I didn’t know which one.

I opened the first drawer and the keys weren’t there. I opened the second drawer and they weren’t there either.

As I opened each additional drawer, I started to feel more and more certain that the keys would be in the next one, since I was fairly confident they were in the desk (prior probability of perhaps 90%), and there were fewer and fewer unsearched drawers remaining.

On the other hand, each time I open an empty drawer, it’s additional evidence that the keys aren’t in the desk at all, so I should become somewhat less confident to find them in the remaining drawers.

What is the rational way to feel here? As I open more drawers, should I be getting more or less confident that I’ll find my keys? Specifically, after I’ve searched drawers out of total,

1. What is the probability that I will find the keys in the next drawer?
2. What is the probability that I’ll find the keys in the desk at all?

After we’ve opened empty drawers, the probability of finding the keys in the next drawer is Since the keys could be in any of the remaining drawers with equal probability, What about the other term, ? We can use Bayes’ theorem to update our belief that the keys are in the desk (starting from prior ) after observing empty drawers in a row. The posterior is: Now to evaluate each of these terms. The likelihood of opening empty drawers given that the keys are in the desk, i.e., , is easy to calculate manually: The next term, , is just the prior: .

In the denominator, is clearly 1 — if the keys aren’t in the desk, it’s not surprising that we haven’t found them in the first drawers.

Finally, is just .

The resulting expression gives the probability that the keys are in the desk at all after we’ve opened empty drawers: And using the expression above, the probability that we’ll find the keys in the next drawer is: Plotting the results for , , we find that counterintuitively, with each additional drawer that’s opened, the probability of finding the keys in the next drawer increases, while the probability of finding the keys in the desk at all decreases: As we open more drawers without finding the keys, it becomes more likely that we’ll find them in the next drawer, but less likely that we’ll find them in the desk at all.

The two probabilities become equal at , since obviously at that point there’s only one drawer left to open — if the keys are still in the desk, they’re in the last drawer.

I wondered whether it was always the case that increased with , i.e., whether there are values of and for which it would become less likely to find the keys in the next drawer after opening a few empty ones (which I might imagine if e.g. we had low confidence that the keys were in the desk in the first place, and were small). However, you can work out that , which is strictly positive (but, as expected, it’s small if is small).

References
The ups and downs of the hope function in a hopeless search – a thorough discussion of this type of problem, where you are searching for an object where failure is possible. From chapter 15 of Subjective Probability