# How many rats are needed to find 3 poisoned bottles out of n bottles of wine?

You organized a party with 1000 bottles of wine but you know that 1 bottle was poisoned before the party and you don’t want anybody to die.Luckily you are in the lab and you have 10 lab rats so you decide to use them to test which bottle is poisoned.The poison takes 1 hour to take effect also the party occurs in 1 hour.

That was the original statement of the drunk rats problem. I was wondering how many rats you would need to need to detect for certain which 3 bottles of wine that are poisoned out of n bottles?

• Is there a reason you chose to not only generalize to $n$ bottles, but also assume $3$ (instead of $1$) are poisoned? – pjs36 Apr 16 '17 at 23:22
• I have a pet rat :( – mrnovice Apr 16 '17 at 23:40

You can find one bottle from among $1000$ with $10$ rats because there are $1000$ possible one element subsets and $2^{10} > 1000$. So you number the bottles in base $2$ and the rats from $0$ to $9$ and give rat $r$ a sample from each bottles with a $1$ bit in place $r$.

For one bad bottle out of $n$ you need $\lceil \log_2(n)\rceil$ rats.

To solve the $k$ bottle problem, number the $N ={{n}\choose{k}}$ possible subsets of bad bottles, count them in binary. You'll need $\lceil \log_2(N)\rceil$ bits, so that many rats.

Caveat. I'm pretty sure that will provide enough information to find the bottles, but I haven't thought through the proof in detail. If I'm wrong I'm sure someone here will catch my error.

Edit: Here's a reference from the OP's web page that points to a solution with fewer rats than mine. So I still think I have enough information, but perhaps too much.

https://mathoverflow.net/questions/59939/identifying-poisoned-wines

Edit (2): @Arby 's comments below prompted this second edit. I'm glad I was cautious making my naive claim. It's easy to show it's wrong. With $2$ bad bottles in $4$ I predicted $3$ rats could find the bad pair. If you write out my recipe for the $6$ possible pairs you'll find that all the rats die.

Finally, I'm surprised that the OP accepted this wrong answer given that his question linked to a correct one. At least I enjoyed solving the $1$ bottle puzzle, which I'd never seen.

• In your reference, they say 1000 bottles with two poisoned would require 43 rats, but I only get 18 with your formula $\log_2 ({\binom {1000} 2})$. Am I making some boneheaded mistake? I thought I followed your reasoning until this came up. – Arby Apr 17 '17 at 0:40
• The first part is correct. – wang ray Apr 17 '17 at 2:42
• Yes, the first part, where we have one poisoned bottle, works fine. However, in the second case, with more than one poisoned bottle there's a problem. Say $k$ bottles are poisoned; if we assign one number to each subset of size $k$, then rats will die for all subsets containing at least one bottle of wine, not just the single subset containing all the poisoned bottles. The best explanation I've seen is in [this answer related to Ethan Bolker's link above]. : math.stackexchange.com/questions/639/… – Arby Apr 17 '17 at 5:27
• The above comment should read " for all subsets containing at least one bottle of poisoned wine" not as written. – Arby Apr 17 '17 at 11:35
• @Arby See my edit. – Ethan Bolker Apr 17 '17 at 13:08