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

In summary, the problem asks for a way to find a minimum number of cans that need to be checked in order to find a bad can. The answer is zero - you simply chuck the whole batch if one is present.
  • #1
sachins
2
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
  • #2
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.
 
  • #3
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.
 
  • #4
@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.
 
  • #5
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.
 
  • #6
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?
 
  • #7
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.
 
  • #8
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.
 
  • #9
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.
 

1. How do you determine the least number of trials needed to find a can with bad food in a batch?

The least number of trials needed to find a can with bad food in a batch can be determined using a statistical method called the "binomial distribution". This method takes into account the number of cans in the batch, the probability of a can having bad food, and the desired level of confidence in finding a can with bad food.

2. Is there a specific formula or equation for calculating the least number of trials?

Yes, there is a formula for calculating the least number of trials. It is known as the "binomial distribution formula" and it is based on the probability of success, the number of trials, and the desired level of confidence. The formula is n = ln(1-C)/ln(1-p), where n is the number of trials, C is the desired level of confidence, and p is the probability of success.

3. Can the least number of trials vary depending on the type of food in the batch?

Yes, the least number of trials can vary depending on the type of food in the batch. This is because different types of food may have different levels of probability for having bad food. For example, canned meat may have a higher probability of containing bad food compared to canned vegetables.

4. Is there a way to reduce the number of trials needed to find a can with bad food?

Yes, there are a few ways to potentially reduce the number of trials needed to find a can with bad food. One way is to increase the probability of success, meaning choosing a batch of cans with a higher likelihood of containing bad food. Another way is to increase the level of confidence, which would require a larger number of trials but would provide a more accurate result.

5. Can the least number of trials be used for other types of quality control tests?

Yes, the concept of finding the least number of trials can be applied to other types of quality control tests. This method can be used to determine the minimum number of trials needed to find a defective product in a batch, for example. It can also be used in various industries such as manufacturing, healthcare, and finance to ensure the quality of products or services.

Similar threads

  • Materials and Chemical Engineering
Replies
1
Views
2K
Replies
16
Views
2K
Replies
2
Views
759
  • STEM Academic Advising
2
Replies
54
Views
4K
Replies
33
Views
5K
  • Sci-Fi Writing and World Building
Replies
9
Views
2K
  • Sci-Fi Writing and World Building
3
Replies
96
Views
6K
Replies
2
Views
6K
  • Sci-Fi Writing and World Building
Replies
3
Views
2K
Back
Top