Least number of trials to find a can with bad food out of a batch.

  • Thread starter Thread starter sachins
  • Start date Start date
  • Tags Tags
    Batch Food
Click For Summary

Discussion Overview

The discussion revolves around a problem involving a batch of 400 cans, one of which contains a poisonous chemical instead of food. Participants explore the minimum number of cans that need to be checked to ensure the identification of the bad can, considering various strategies and assumptions about the problem's parameters.

Discussion Character

  • Exploratory
  • Technical explanation
  • Debate/contested
  • Mathematical reasoning

Main Points Raised

  • Some participants suggest that to guarantee finding the bad can, one must check all 400 cans, while others propose that testing one can could suffice if it happens to be the bad one.
  • There is a discussion about using probabilistic methods, such as the Binomial distribution, to determine the number of cans to check based on a desired probability of finding the bad can.
  • One participant argues that the loss from leaving the bad can undetected is greater than the cost of discarding the entire batch, suggesting that checking zero cans could be a practical approach.
  • Another participant introduces a sampling strategy involving halving the number of cans to check, although this approach raises questions about its efficiency compared to simpler methods.
  • Some participants emphasize that the problem may require additional information, such as the weight difference between the bad can and the good ones, to formulate a more effective strategy.
  • There is a mention of a hypothetical scenario where the problem is framed differently, involving a fallout shelter stocked with cans, which could influence the approach to finding the bad can.
  • Several participants note that if the bad can is known to exist, the order of checking does not matter, and one must continue until the bad can is found.
  • One participant humorously suggests that the problem may be designed to challenge assumptions about minimizing strategies in such scenarios.
  • Another participant clarifies that if the cans do not differ in weight, the problem loses its mathematical complexity.

Areas of Agreement / Disagreement

Participants express multiple competing views on the best approach to the problem, with no consensus on a single strategy or minimum number of cans to check. The discussion remains unresolved regarding the optimal method for identifying the bad can.

Contextual Notes

Participants note that the problem's assumptions, such as the existence of a weight difference or the nature of the bad can, significantly affect the strategies discussed. The lack of clarity on these assumptions leads to varied interpretations and proposed solutions.

sachins
Messages
2
Reaction score
0
hi everyone . i came across this interesting problem but am not able to figure it out .
In a factory that packs food in cans , there is a report that in a particular batch of 400 cans by error a poisonous chemical has been packed instead of food item. Checking 400 cans would be a big loss but neither the manager can allow a can with poisonous chemical to remain undiscovered as it is dangerous. What is the minimum number of cans that need to be checked so that the bad Can is discovered with certainty ?
 
Computer science news on Phys.org
I think you are saying that there is one bad can in 400 cans and there is no way other than opening that bad can to detect that bad can.

So open and test the cans one at a time until the bad can is discovered.

The minimum number of cans that need to be tested is one. But sometimes you will not be that lucky. On average you will need to open half the cans. If you are very unlikely you will need to open 400 cans to find the bad can.
 
Hey sachins and welcome to the forums.

If you are looking at complete certainty, then you need to check every can.

If however you want to do so with some kind of probability, then you will need to use some kind of Binomial or related distribution and find a valid n value (number of cans you need to check) that corresponds to a particular probability.

If everything is independent (same chance for every can to have poison) then the Binomial is your distribution and you have to solve for a value of n corresponding with your probability.

If not, then you have a more complex model ranging from a PGF model (probability generating function), markov model of some order, or a model with a complex joint density function that has all kinds of dependencies.

In these kinds of problems, the binomial model is often used but it may not be appropriate.
 
@sachins: welcome to PF;
IRL - the loss to the company of accidentally leaving the bad can in is usually much greater than that of pulling the entire batch and just chucking them is usually cheaper than checking them all ... so that's what happens.
Thus the minimum number of cans that need to be checked is zero - you know they are certainly inside the 400 batch: chuck the lot.

Where did you come across this problem?
For "certainty" you normally get some extra information - like the bad can weighing exactly 10g less than the good ones.
 
Thank you Simon, Bill And Chiro .
I do think there must be more data given viz weight of bad can different from the good one . In such case there is no need to open the can . Else , one can apply any sampling method to keep checking by opening up the cans for eg : arrange the cans in a square array . Pick a random can ; if it is not bad find the half in which it lies and then again pick randomly from the other half . Again find out the half of the half in which it lies and pick the other half to choose a random can ...a dn so on till you get to a (half)^n which has just one can . Now if all of them do not have a bad can, you substract that number from 400 and begin the process again.

400 200 100 50 25 12.5 6.125 3. 1.
1 1 1 1 1 1 1 1 1 (9 cans checked , all good then repeat but with 400-9 =391 cans)
391 196 98 49 25 12.5 6. 3. 1.
1 1 1 1 1 1 1 1 1
382 .........

So there can be minimum one can that need to be checked . But it seems i have an inaccurate question here. It was asked by a friend to me. So if you guys come across the real version of this question do post.
 
That minimum of one is "a posteriori" ... that is, you have certainly found the bad can after the fact or opening just one, if the first one is bad.

Depending on the context, that may be the correct answer.

However, the question kinda seems more like you need to find a strategy which minimizes the number of cans you have to open a priori to be certain of finding the bad can ... so you can tell someone: follow this sampling strategy for the first 100 cans (or whatever). In which case your instructions, for certainty must be to "keep using this strategy until the bad can is found". So we cannot be certain, before the fact that opening any N<400 cans will uncover the bad can.

What you can try to do is to adopt a sampling strategy that minimizes the expectation of the number of cans you'll have to open.

The strategy you have picked still looks like an elaborate sampling without replacing - how would it have any advantage over, say, picking one at random from the 400, if it is bad, then end, if good, then pick again from the remaining 399, repeat.

For that matter, is it better than just lining the cans up and checking them in order?

As asked, the question could be aimed at getting you to examine different sampling strategies.

I suspect the real question is just asking how many cans you have to check before unearthing the bad one.
In that case you'd construct the statistics - median with upper and lower quartiles say.

I've seen it asked like this:
You take refuge from a nuclear war in your fallout shelter - which is well stocked with 400 cans.
Unfortunately, too late, you discover, from the shipping manifest, that some idiot stocked 399 cans of peaches and one of beef stew ... and none of the cans have labels. How many peach meals will you look forward to eating before you get to enjoy your stew?
 
If you MUST find the bad can, you have no choice but to keep opening them until you find it. The order of opening the cans makes no difference, that is: there is no particular strategy.
 
mathman said:
If you MUST find the bad can, you have no choice but to keep opening them until you find it. The order of opening the cans makes no difference, that is: there is no particular strategy.
If the report of one can being bad is made with certainty, in the extremely rare case of opening 399 good cans, the 400th can can be assumed to be bad.

As mentioned above, this doesn't seem like the intent of the problem, and it's likely that the "bad" can is supposed to weigh differently than the other cans (or it may be known to weigh less or weigh more), in which case a strategy can be used to reduce the number of weighings.
 
Though - that reckons without the perversity of math professors who may well set a problem like that specifically to force students who believe there may be some minimizing strategy to the realization that there isn't ;)
 
  • #10
I think this is the problem:
There exists 400 cans. One can weighs differently. Find the minimum number of measurements needed to find the special can.

So you do the thing where you split it into groups and weigh them against each other. Its a common math problem.

If there is no weight difference, well then its not really a math problem.
 
  • #11
@Hepth: that's right - see last sentence post #2.
 

Similar threads

  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 19 ·
Replies
19
Views
10K
Replies
2
Views
1K
  • · Replies 54 ·
2
Replies
54
Views
8K
  • · Replies 33 ·
2
Replies
33
Views
9K
  • · Replies 9 ·
Replies
9
Views
4K
Replies
1
Views
7K
  • · Replies 96 ·
4
Replies
96
Views
12K
Replies
2
Views
7K