Тёмный

The Poisoned Drinks Problem 

Zach Star
Подписаться 1,3 млн
Просмотров 558 тыс.
50% 1

Sign up with brilliant and get 20% off your annual subscription: brilliant.org/ZachStar/
STEMerch Store: stemerch.com/
Support the Channel: / zachstar
PayPal(one time donation): www.paypal.me/ZachStarYT
►Follow me
Instagram: / zachstar
Twitter: / imzachstar
Animations: Brainup Studios ( brainup.in/ )
►My Setup:
Space Pictures: amzn.to/2CC4Kqj
Magnetic Floating Globe: amzn.to/2VgPdn0
Camera: amzn.to/2RivYu5
Mic: amzn.to/35bKiri
Tripod: amzn.to/2RgMTNL
Equilibrium Tube: amzn.to/2SowDrh
►Check out the my Amazon Store: www.amazon.com/shop/zachstar

Опубликовано:

 

16 фев 2020

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 980   
@zachstar
@zachstar 4 года назад
Just want to acknowledge that this is simply one method more efficient than the worst case scenario of testing every one individually, no reason to think this is the most efficient. Already got a few comments on how you actually wouldn't need to test every drink in each individual group of 4 because a small percentage of the time you'll have 3 safe drinks in a row, meaning the 4th one is definitely poisoned and yes that would reduce the number of tests by a little bit more. Feel free to comment some other suggestions!
@Blox117
@Blox117 4 года назад
my suggestion is to bring your own drinks from now on. lol
@ajreukgjdi94
@ajreukgjdi94 4 года назад
If You split each group of 4 into 2 groups of two and test them, many of them will be clear. (Less than the 1-0.9^2 because it's now conditional probability but still some). If they come back clear, You just eliminated 2 with one test. If not, You only have to test one for the same reason as You mentioned in this comment. (Which means 2 tests per 2 glasses if the pair tests positive together, so no more than testing each one individually)
@marcosgutman6349
@marcosgutman6349 4 года назад
Hi zach! I was just wondering if the groups being constituted by 4 glasses has anything to do with the fact that 4 is just the next integer from 10/e=3.6788, because the probability of a drink being poisoned is 10%. And also the probability of 1 drink being poisoned in those groups of 4 is so close to that same value.
@muditkumar6659
@muditkumar6659 4 года назад
Sir please make informational video on environmental engineering
@Booone008
@Booone008 4 года назад
0:16 "The question is in the most efficient way, how can you determine exactly which drinks are the poisoned ones?" 1:59 "... but THE solution is similar." As someone who loves maths puzzles, that phrasing set up my expectations that there is some elegant construction that finds a provably optimal solution. Now I feel let down :( The explanation of the given solution was nice and clear, but I wish it would be more clearly stated from the beginning that you are not looking for "the most efficient way" after all.
@bbhrdzaz
@bbhrdzaz 4 года назад
mix them all together. the dilution brings the toxicity level down to a non lethal dose. 6/16/2023. I am surprised at all the replies to my post. To set things straight, this is meant to be a "sarcastic" response to the problem, not a solution.
@tdreamgmail
@tdreamgmail 4 года назад
yeah right, you wouldn't do that if it was your life in the line.
@tomerwolberg37
@tomerwolberg37 4 года назад
This the diluted mix would also be a cure for the poison (homeopathy logic)
@bbhrdzaz
@bbhrdzaz 4 года назад
@@tdreamgmail The problem did not stipulate that diluting the poison could not be a solution. So it remains a possibility. Some poisons in a diluted state are actually beneficial to combating disease.
@letao12
@letao12 4 года назад
You can't make assumptions about how concentrated or how poisonous the poison is. There's no way to tell if 1/1000 of a cup is still lethal.
@Blox117
@Blox117 4 года назад
thanks for the advice, bill cosby
@bug5654
@bug5654 4 года назад
They were both poisoned. I've spent the last few years building up an immunity to iocane powder.
@jonathankrider6170
@jonathankrider6170 4 года назад
nice "Princess Bride" reference
@dustt314
@dustt314 4 года назад
Ha-ha, you fool! You fell victim to one of the classic blunders, the most famous of which is “Never get involved in a land war in Asia,” but only slightly less well known is this: “Never go in against a Sicilian, when death is on the line!”
@theonlyone590
@theonlyone590 4 года назад
inconceivable
@elizimmerman5908
@elizimmerman5908 4 года назад
BreadyBogusBeButtBoiBaby you forgot about never attack Russia in the winter
@tuesdaywithanh
@tuesdaywithanh 3 года назад
Thank you for this
@birubu
@birubu 4 года назад
It’s cool that despite it seeming like a medical and math problem, this is basically explaining array/database search algorithms
@giosauquillo
@giosauquillo 4 года назад
i just learned about sorting algorithms and the first thing that came to my mind was the merge sort algorithm
@BakasuraOfficial
@BakasuraOfficial 4 года назад
@@giosauquillo and it is the merge algorithm
@LordHonkInc
@LordHonkInc 4 года назад
Mhmm, my first thought was "hey, this reminds me kind of how we learned about binary partitioning" :) I like examples of things we usually consider "computer algorithms" that can be explained without having to resort to abstract concepts like set or graph theory.
@MrCorrectify
@MrCorrectify 4 года назад
So what you're saying is that it's similar to a Hungarian dance?
@thepiratepeter4630
@thepiratepeter4630 4 года назад
Could you give an example of that? I'm using this video as a base for a school research, and seeing an application of the problem in informatics would be very interesting!
@yzbrian
@yzbrian 4 года назад
3:33 You don't have to test all four drinks. If you test the first 3 drinks and they are safe you know the last one WILL have poison in them because otherwise the group would have already been removed in the previous group. However if you test any drink to be poisonous you have to test all of them because there can be multiple poisonous drinks in a group. This means that the actuall number of tests is not 344 but less.
@drenz1523
@drenz1523 Год назад
"because otherwise the group wouldve been removed from the previous group" idk about you but this sounds like bullcrap word salad
@Flahtort
@Flahtort Год назад
@@drenz1523 , why so agressive? Yeah, it's better to say: "because otherwise the group wouldve been removed from the previous ITTERATION", but I understand that person well even wothout that. It's exsessive to say "bullcrap word salad" for that case.
@drenz1523
@drenz1523 Год назад
@@Flahtort i dont remember any iteration in that method oh and yes i am naturally aggresive cope
@katlandrie841
@katlandrie841 Год назад
@@drenz1523 naturally illiterate too it seems
@arianghorbani1305
@arianghorbani1305 Год назад
@@drenz1523lol im naturally aggressive” we get it, you’re friendless and 12, you’ll learn how to speak with others eventually
@obibellowme
@obibellowme 4 года назад
I’m surprised Eulers number didn’t show up here after the Eulers number Video convinced me that it’s everywhere haha
@zachstar
@zachstar 4 года назад
Honestly I bet it's in here somewhere lol.
@johnnydeep7089
@johnnydeep7089 4 года назад
It looks like if the number of drinks is infinite the probability of a drink being poisoned at which there is no beneficial grouping is 1/e but that might just be a coincidence
@aasyjepale5210
@aasyjepale5210 4 года назад
obviously if the % of poisoned drinks is unknown you deduce the percentage by testing n/e drinks individually
@tupaicindjeke275
@tupaicindjeke275 4 года назад
Me also. I thought the 37% was going to pop up.
@ARAVINDN1029
@ARAVINDN1029 4 года назад
How come this comment 1 week old while the video was uploaded just 1 hour ago?
@Lovuschka
@Lovuschka 4 года назад
"Any drink has a 10 percent chance of being poisoned" is a different case than "10 percent of all drinks are poisoned". In the latter case, the number of tests would be lower on average, and I think it should be easy to understand why.
@shiinondogewalker2809
@shiinondogewalker2809 Год назад
yes if 10% of drinks are poisoned you can adjust your group sizes as you go, and end early after finding the 100 poisoned ones
@cara-setun
@cara-setun Год назад
True, it becomes a binomial probability problem, with the chance that exactly 100 drinks are poisoned is fairly low
@saramorin4792
@saramorin4792 Год назад
it could be more drinks also ;)
@ZarHakkar
@ZarHakkar 4 года назад
Darnit. And here I was thinking about how I was gonna get to enjoy a whole video dissecting the game theory of a battle of wits between a Sicilian and a masked swordsman. Inconceivable.
@eandvwigle7510
@eandvwigle7510 Год назад
You keep using that word. I don’t think it means what you think it means.
@jeremypnet
@jeremypnet Год назад
The next video in the series is about how to win a land war in Asia.
@jeremypnet
@jeremypnet Год назад
The next video in the series is about how to win a land war in Asia.
@cerebraldreams4738
@cerebraldreams4738 4 года назад
This is called the "Binary Search Algorithm" in computer science. It can be used for finding an item in a sorted list, and ad-hoc versions of binary search are used in bug testing to eliminate large chunks of the software from analysis when something goes wrong. I believe it can also be used for approximating the solution to a square root.
@themeralderp9615
@themeralderp9615 4 года назад
You might be talking about a different root approximation algorithm, but the long root algorithm isn’t based on binary search. It only uses binary search when operating in any base other than binary, since there a more than two possible options that could potentially be the closest root in a step of the algorithm. Wikipedia link: en.m.wikipedia.org/wiki/Methods_of_computing_square_roots . Check under “digit by digit calculation”
@cerebraldreams4738
@cerebraldreams4738 4 года назад
@@themeralderp9615 - There may be other approaches, but I know for a fact that you can use the binary search algorithm to "search" for an answer to a square root problem.
@ObjectsInMotion
@ObjectsInMotion 4 года назад
CerebralDreams The first algorithm for one drink is binary search, the main algorithm of the video is *not* binary search.
@garethgareth9783
@garethgareth9783 4 года назад
Binary search can be used in general on monotone functions, like sqrt, to find the value of the function in a given point.
@aanshuk
@aanshuk 4 года назад
I keep on clicking on cool videos and within the first minute, I realize it's just a video on the binary search algorithm.
@ianirizarry30
@ianirizarry30 4 года назад
All of them are poisoned. Just bite the giant in his eye for being a liar.
@firedemon7231
@firedemon7231 4 года назад
Ian Irizarry I get that reference
@thrasher698
@thrasher698 4 года назад
Ah, Ender's Game. Great book.
@jonathankrider6170
@jonathankrider6170 4 года назад
bro you gonna go sicko mode on ender's future bank account manager's creation?
@RoderickEtheria
@RoderickEtheria 4 года назад
They could be. Each has 10% chance to be poison, not there are 100 poisonous drinks.
@bensonfamily6302
@bensonfamily6302 4 года назад
I see youre a man of culture aswell
@graham1034
@graham1034 4 года назад
I was honestly expecting a recursive algorithm where you then split the poisoned groups into a certain group size and test again. I'm guessing that the poisoned concentration remaining would always be too high to be more efficient than running in n time. Would have been good to have that explained in the video.
@tau_628
@tau_628 3 года назад
Here from 2021, I wish my school knew this when it was doing pooled Covid tests. An application of this problem that I would be pretty confident that you didn’t foresee.
@fgvcosmic6752
@fgvcosmic6752 Год назад
Based on how covid tests work, theres no real way to do this safely. "Mixing" the solutions in this case is dangerous as it risks infecting the one mixing them
@Arboldenrocks
@Arboldenrocks 4 года назад
whew, we have a test machine. i was afraid we had to taste them.
@skyscraperfan
@skyscraperfan 4 года назад
Wouldn't even less tests be needed, if you apply the same principle more than once? Instead of testing each of those remaining drinks, you could group them again in another way and then test those other groups. Of course the percentage will be much higher now, as each group of the first step had at least one poisoned drink.
@philipszeremeta2621
@philipszeremeta2621 4 года назад
I was wondering that too
@duckymomo7935
@duckymomo7935 4 года назад
No because the worst case is at least one is poisoned in each split thus granting you no further information ABCD AB CD if A and C are poisoned You’d still have to test A B C D individually anyways
@skyscraperfan
@skyscraperfan 4 года назад
@@duckymomo7935 I do not want to split ABCD. Instead I want to form new groups from the groups which contain at least one poisoned drink. If ABCD, EFGH and IJKL contain at least one poisoned drink, you could test AEI, BFJ, CGK and DHL next.
@pouzivateljutube2995
@pouzivateljutube2995 4 года назад
@@skyscraperfan You could try calculate that. But because total number of drinks goes down and number of poisoned drinks remains same the probability of drink begin poisoned would be higher. So there is possibility that the it would exceed probability when this method is reasonable.
@skyscraperfan
@skyscraperfan 4 года назад
@@pouzivateljutube2995 Yes, I think it would only work, if the probability of a poisoned drink is small and the groups in the first stage are large. If the groups in the first stage only have a size of four, the probability is the second stage will already be over 25%, because you only look at groups where at least one of four drinks is poisoned.
@fakjbf3129
@fakjbf3129 Год назад
When doing the split in half search method, your initial steps are all basically guaranteed to come back as poisoned, therefore doing them is redundant. This method effectively skips ahead to the point where there is a greater than 50% chance that a result will come back clean, meaning you’ll start eliminating groups right away.
@professorpoke
@professorpoke Год назад
Nice, I didn't think that way. So it's kind of a binary search but skipping some initial half splits.
@Kevidiffel
@Kevidiffel Год назад
Good catch, but then you could start with groups of 6 (53% of being clean), with some left over ones. I haven't done the math for the rest of the application, though.
@Pope_Balenciaga
@Pope_Balenciaga 4 года назад
Thanks for the explanation. I'm a med student and when they explained it to me in lab I didn't quite understand it.
@LD-dt1sk
@LD-dt1sk Год назад
I agree that poisoned drinks indeed are a problem.
@tacoexpressSEEDEEholeeveryones
@tacoexpressSEEDEEholeeveryones 10 месяцев назад
Would you consider leaving on a red cloth regular table lamp in the bedroom and a tubular vintage oval bulb desk lamp in the office, and seeing which type of bulb burns out first after a while, "doing an experiment" ?
@sasimitra5871
@sasimitra5871 4 года назад
3:56 You don't have to multiply with 4. 3 tests per group should be enough at max. If atleast one is poisoned, and out of 4, 3 are safe, the 4th has to be poisoned. Right?
@zachstar
@zachstar 4 года назад
yes that is correct, but note that will only work when the first 3 drinks are safe which won't happen most of the time. This is still more efficient but you will mostly do 4 tests. If for example you find the first drink is poisoned then you still have to keep going because you have no idea if the other one's are as well.
@Kroppeb
@Kroppeb 4 года назад
@@zachstar if my calculations are correct, there is a 21% chance the first three are all safe.
@wolffang21burgers
@wolffang21burgers 4 года назад
@@zachstar There is a 21.2% chance of only needing 3 using this method, leading to an average of 3.788 for each group of 4. 326 tests in total. But a better method with 4 glasses is to do a binary search, as this also gains advantage of glasses arranged OXOO, and leads to an average 3.681. 316 tests into total.
@danielyuan9862
@danielyuan9862 2 года назад
@@wolffang21burgers You still don't know how many poisoned drinks there are, but I'm confident that this is still better than testing each drink individually.
@LevityLeviathan
@LevityLeviathan 2 года назад
@@zachstar what about testing 2 of those four at a time after it's been noted as being a poisonous set. Rather than four tests for each, you'd be doing two minimum, four maximum.
@Chondriam
@Chondriam 4 года назад
My Intuition says 469 Test is the best. I calculate (-log2(10%)*10%-log2(90%)*90%)*1000=469 bits of entropy
@Kroppeb
@Kroppeb 4 года назад
Yep, the suggested algorithm is indeed suboptimal.
@deept3215
@deept3215 4 года назад
I'd say entropy reasoning proves no algorithm can use less than 469 tests on average, but it's still possible the best algorithm uses more
@livedandletdie
@livedandletdie 4 года назад
DeepT I say the best algorithm doesn't exist because if you already know that 10% of the cups are poisoned, you've probably done it yourself and you better know which ones you poisoned. Which makes the test moot.
@Leekodot15
@Leekodot15 4 года назад
In the case that the drinks were shuffled completely randomly, you have an issue.
@pontus_qwerty
@pontus_qwerty 4 года назад
My best algo uses 526 tests on average.=]
@tombackhouse9121
@tombackhouse9121 4 года назад
EDIT: not only did I slightly misunderstand the problem, Robbe Pincket already came up with a similar, better solution below. Paused at 0:55, I think I'm gonna approach this from an information theoretic perspective. Your goal is to gather the most information possible from each test, which on average will be P*log(P)+(1-P)*log(1-P) which is maximized when P=0.5, so since in the first instance P=0.9^n the closest integer is 7. So take the 1000 cups and divide into 7s, put a mixed sample from each group into the machine (142 groups of 7, one remainder group of 6 means 143 trials) and you expect to be able to declare about half of your drinks safe. Then you're left with the danger half, and the probability of any one drink being bad has doubled. So now you divide randomly into groups of 3. Now you have to do 167 tests, and again you expect to declare half safe. Now your probability is gonna be 0.4 of any drink being bad, grouping them doesn't improve your information so you run tests individually until you find all 100 poisoned drinks, at which point you can stop. Assuming everything worked out as expected so far, you have 250 suspect drinks and I think you can expect to find the poisoned one after on average 195 tests. So that's 505 tests in all to find all the poisoned drinks. That's not a rigorous estimate for the expected number of tests just a principled guess really. So my guess is in general divide the log of 0.5 by the log of the fraction of the remaining suspect drinks which are safe, pick the nearest integer and divide into groups of that size for testing. Fuck that took longer than I thought. How did I do?
@calamaricalamity6757
@calamaricalamity6757 Год назад
you are "batshit crazy" as the kids say
@aum1040
@aum1040 Год назад
This is almost right. But after the first round (groups of 7) there are optimizations that can be made mid-round for drinks that come from a group from which a poisoned drink has already been identified. I don't like the way the video answers this question with such a suboptimal solution.
@Kroppeb
@Kroppeb 4 года назад
I’m pretty sure I have a better solution than the one presented; however, I can’t verify how many tests it would take. I’m also sure that if this indeed takes fewer tests than the solution offered, than this is still suboptimal, finding an optimal solution might be NP. Note: lower down there is an even better algorithm. First, we divide into groups of 7. This was about a chance of 50% to have at least one poised drink. This is how we want every test to be. Try to make the test fail or succeed with about a 50/50 chance, this way we reduce the expected entropy the most. If this group of 7 is poisoned, we then want to check a subgroup of 3 of those, which again has about a 50/50 chance of being poisoned. If this subgroup is poisoned, we will check all 3 individually but note, if the first 2 doesn’t contain a poisoned drink, the third one is guaranteed to be poisoned and doesn’t need checking. Then we check the remaining 4 together to determine if those still need checking. The other 4 we just do a 2/2 I think. The lower-bound on the amount of the average amount of tests is 1000 × (-log2(p)*p + -log(1-p)*(1-p)), as that’s the number of bits of entropy we have. EDIT: I think I have found a more optimal but still “easy” solution We start with the initial 1000 drinks, and take 7 of those and test them together. If they come back safe, we can grab another 7 and start again. If they come back as poisoned we test 3 of them again. When these come back poisoned, we no longer any reason to believe any of the remaining 4 drinks are poisoned and can put them back with the untested drinks. For the 3 drinks, we test 2 of them individually and when the one comes back as poisoned we place the untested ones also back with the original drinks. If both come back negative, we know the 3rd one is poisoned. If the 3 don’t come back poisoned, we know they are in the remaining four. We first test 2 of those, if they aren’t poisoned we know the poisoned one is in the last 2, else it’s in the 2 we just tested, and we place the last 2 with the untested ones. Finally, we test 1 of those drinks, and if it’s poisoned we place the last remaining drink back with the others, otherwise we know the last drink is poisoned. EDIT 2: This new algorithm will have for each test of 7: be harmless with 47.83% be harmfull with 52.17% and will on average: do 2.81 tests and place 3.34 drinks back on the untested pile. Which means that in on average 2.46 tests and 1.76 returned or 5.24 successfully tested. The expected number of tests is then 1000/5.24*2.46 = 469.6, which is very close to the optimal 468.9956. I didn’t check for when the remaining drinks is less than 7, but that’s not going to change the number of tests that much I assume.
@ObjectsInMotion
@ObjectsInMotion 4 года назад
Nice, someone should make a video with this new more efficient system!
@tombackhouse9121
@tombackhouse9121 4 года назад
Nice.
@MarsCorporations
@MarsCorporations 4 года назад
Another Idea here: Round 1: Incoming: 1000 (10% poisoned) Groupsize: 7 (to get close to 50% sorted out) Groups: 142.9 (equals testcount for this round) Chance to be save: 47.8% Remaining: 521.7 (shuffle these before entering round 2) Round 2: Incoming: 521.7 (now 19.2% of them are poisoned) Groupsize: 3 (close to 50% sorted out) Groups: 173.9 (equals testcount for this round) Chance to be save: 52.8% Remaining: 246.2 (in groups of 3) Round 3: Incoming: 246.2 (in groups of 3, 40.6% individuals are poisoned, every group of 3 contains one or more poison) With a chance of 18.1% (hope i calculated this right), the first 2 of a group are OK -> only needs 2 tests to evaluate 3 drinks With a (1-18.1%) chance the first 2 contain >= 1 poison -> 3 tests needed Sum: about 548 tests for 1000 drinks with 100 poisoned ones. Not a great improvement (over 594) , but many small steps can walk a mile. The problem here is that the additional information gathered in round 1 is not used at all. only the "one of these 3 is poisoned" information of round 2 is really used. Your method (if it is right) uses this info and is therefore a better solution.
@gabemerritt3139
@gabemerritt3139 4 года назад
There is a 0.3% chance you will poison someone each time you assume that the 4 drinks are safe after just testing 3 of a group of 7
@tombackhouse9121
@tombackhouse9121 4 года назад
@@gabemerritt3139 he isn't assuming they're safe, he's assuming they're no more likely to be poisoned than the remaining untested drinks and throwing them back in the pile, to be tested in subsequent groups of 7
@Nossairito
@Nossairito 4 года назад
Just wanna say thanks for all these videos, they're consistently brilliant, keep it up my man it's greatly appreciated :'D
@JoostMehrtens
@JoostMehrtens 4 года назад
There is a quicker way: So based on conditional probability each one of the 4 drinks has a 29% chance of being poisoned. Now testing in grouos of 2 would mean there is a 50% chance both are clear. And you safe 1 test. If not you test one of the two and if clear the last one must be poisoned which would mean you did 2 tests for 2 glasses. If it is poisoned you must test the last one too and you did 3 tests for 2 glasses. Your expected number of tests however would be 1.85 tests for 2 glasses. An small improvement of 25 tests.
@swordwaker7749
@swordwaker7749 4 года назад
I would go with this method: test all, if the mixture is safe, done, if the mixture is not safe, divide into 2 equal groups and test that group the same way. In the worst case with p poisoned drinks and n total drinks, I'm checking only on the order of p*log(n/p). [Edit] I tested this on python and this method tends to do better than zach's method on low percentage of poison, but quickly gets worse and is actually worse than testing all drinks one by one for the 30% case. [Edit2] I optimized my method by only testing the mixture if there is at least 50% chance if it being safe, otherwise, I skip this and split that group into two. This method is better on average and doesn't fail too much when the percentage of poisoned drink gets high.
@DutchDread
@DutchDread 4 года назад
I feel like there should be a better way to do this. I expected that after the first elimination we'd do something similar with the leftover drinks. rearrange them into new group using the new prediction toxicity percentage, continuing this process until the predicted amount of required tests would be higher than the leftover "just test them individually" amount.
@habouzhaboux9488
@habouzhaboux9488 4 года назад
Wouldn't it be better if we arranged all the cups to a square and check each row, then check each column of a row with poison present in it? I checked the math. I'm not sure tho.
@chervilious
@chervilious 4 года назад
I think there is a problem if a row and and a column has 2 poison
@l0il0i34
@l0il0i34 4 года назад
I believe it would take on average less Tests because you can "think Sudoku Style" and therefore guess "smartly"
@Linvael
@Linvael 4 года назад
Interesting way, and could be faster in optimistic cases, but would definitly fail in pessimistic ones. In a square you could end with poison on a diagonal, making every poison test you did positive, lending you not much useful information.
@murphyc15
@murphyc15 Год назад
That first place came in clutch and gave me my bingo! Keep up the good work Marley!
@zach11241
@zach11241 Год назад
Get 1,000 volunteers. Offer them each $1 to take a drink from a cup. If 10% of the cups are poisoned, you’ll have only spent $900 to safely determine which ones are poisoned.
@WowOafus
@WowOafus Год назад
It didn’t say 10% are poisoned. It said each one has a 10% chance of being poisoned. That means that it’s possible all are poisoned as well as none are poisoned.
@Indian0Lore
@Indian0Lore Год назад
@@WowOafus yeah, there is a 30% chance this comment is sane.
@tacoexpressSEEDEEholeeveryones
@tacoexpressSEEDEEholeeveryones 10 месяцев назад
@@WowOafusWould you consider leaving on a red cloth regular table lamp in the bedroom and a tubular vintage oval bulb desk lamp in the office, and seeing which type of bulb burns out first after a while, "doing an experiment" ?
@WowOafus
@WowOafus 10 месяцев назад
@@tacoexpressSEEDEEholeeveryones what are you talking about?
@WheelDragon
@WheelDragon 4 года назад
My initial intuition is to say that after grouping them into groups of 4 and eliminating any that aren't poisoned, you're left with some amount left over. Wouldn't this just be the same problem again, but with fewer drinks? So I guess with so few drinks, the optimal group size is just 1, right? And in theory with a larger enough initial group size or large enough probability to be poisoned, testing all of the remaining drinks individually wouldn't be optimal anymore.
@Terminarch
@Terminarch 4 года назад
It's a percentage savings, so yes. Having very large initial drinks vastly increases the time saved by this method and at say 4 drinks you would save nothing by splitting. Interestingly, with extremely large numbers it may be optimal to split at multiple different size groups for small poison chance. For many millions you might check x at a time and then split the remainder into 4s but only for VERY small p values. With high poison chance you're always better off checking individually because the not-poisoned chance of group size n is (1-p)^n. As an extreme example, 50% poison chance in group size 2 means a 75% chance to need to recheck them individually which is more work total.
@livedandletdie
@livedandletdie 4 года назад
The optimal amount of tests for 10% poisoned drinks is for any k, 0.469*k.
@krasudreal3948
@krasudreal3948 4 года назад
Make a 32 by 32 grid with all the drinks. Some spots will remain open and that's okay, but try to keep as many lines and collums with a close to average number of drinks Test every collum and every line. 64 tests You'll see that poisoned results will create collums and lines that cross over each other over specific drinks. Test those drinks individually It will add an unknown ammount of tests in this step, but I expect AT MOST 100 tests, but at least 10 tests. So, you can find the poisoned drinks with beteween 74 tests and 164 tests.
@pontus_qwerty
@pontus_qwerty 4 года назад
"but I expect AT MOST 100 tests, but at least 10 tests." How can there be a lower and upper bound here? What if all drinks or poisoned, or none?
@spartanwar1185
@spartanwar1185 4 года назад
@@pontus_qwerty Then 10% is not 10%, if all were poisoned that would be a 100% chance that a cup is poisoned
@11cookeaw14
@11cookeaw14 Год назад
Except you’d expect almost all the columns and rows to give a positive test. .9^32=0.0343, so your typically going to get 2 or 3 empty rows and columns, that’s barely going to narrow it down at all. Anyway a simple sanity test gives a lower bound of adleast log2(1000!/900!/100!)>464 even in the case where it’s required there by exactly 100 poison drinks.
@user-yg4br8ut5t
@user-yg4br8ut5t 4 года назад
hey, this is exactly what we’re learning in my current math class! math 341, probability and statistical inference! it felt nice to be able to predict things correctly in one of these kinds of videos for once
@iancopple5649
@iancopple5649 Год назад
Another great video! Love watching your content.
@josephpierce8926
@josephpierce8926 Год назад
You can do better. Zach split them into batches of size 4, and then tested the remaining glasses individually (batches of size 1). He needed 594 tests total. If you instead split them into batches of size 7, then 3, then 1, you only need 563 tests total.
@lachlanbaker2002
@lachlanbaker2002 Год назад
It’s better to test it in groups of 8, requiring a max of 345 tests
@josephpierce8926
@josephpierce8926 Год назад
@@lachlanbaker2002 How do you get that number (345)? And what do you do after you test in groups of 8 (test remaining glasses individually or something else)?
@Omega0202
@Omega0202 Год назад
If you split into batches of size 4, then 2, then 1, you need only 250+172+33 = 455 tests.
@arvinzi1623
@arvinzi1623 Год назад
Yes actually his soloition is far from optimum. This was quite an interesting optimization problem. By recursively doing the splitting recursively with the probablity of p the optimum splitting is ln(1/p) whic is about 0.28 for p=0.1 and initial batch size of 9.5 on average for 1000 samples
@RC32Smiths01
@RC32Smiths01 4 года назад
Now I can never be blamed for poisoning someone to death anymore.... haha Cheers for the good work as always. I did have a dumb idea however. Could you make a video proving why Sin(x) doesn't equal x
@pneumaniac14
@pneumaniac14 4 года назад
sin pi =/= pi Theres your proof
@ziquaftynny9285
@ziquaftynny9285 4 года назад
lmao
@RC32Smiths01
@RC32Smiths01 4 года назад
@@hashtagnoname3931 Ye. It stems from the fact that you will get the same number for really really small numbers of X
@sasimitra5871
@sasimitra5871 4 года назад
Check his video on the Taylor series stuff. He explains there
@RC32Smiths01
@RC32Smiths01 4 года назад
@@sasimitra5871 Ahh gotcha. Thank ye very much
@AByteofCode
@AByteofCode Год назад
We had a question similar to this, with the blood samples, in an exam. We had to calculate estimated tests for different methods, ending with the group one where we had to find the optimal group count
@shanejohns7901
@shanejohns7901 Год назад
Back when I was in high school, I was in the top math class for the school -- essentially a group that was above the 'AP' college prep classes. In taking the Honors Advanced Algebra class, I was lucky to have a quirky color-blind guy as a teacher who was one of the first to work on heat-seeking missiles back before he became a teacher. He always encouraged out of the box thinking. And he loved giving us mental problems that were quite fun. I remember a problem where we were supposed to be working at a gumball factory and wanted to reduce the amount (volume) of gum used in our solid gumballs by 50%, yet keep the balls at the same diameter. So we had to determine what the thickness of the gum needed to be to achieve that 50% reduction in gum volume. Another fun one that I can recall right now fairly vividly was the locker painter job where the locker painter got paid for how long it took him to paint 100 numbered yet otherwise identical lockers situated on a line. Obviously this painter wanted to maximize his pay, so he wanted to find the LEAST EFFICIENT PATH to paint all 100 lockers (without painting any locker more than once). So we had to come up with the work that proved which path was longest. We also had to determine on which day of the week Columbus discovered America. That was a bit different/difficult because there's a Gregorian calendar change that you have to deal with.
@tylerduncan5908
@tylerduncan5908 Год назад
2^⅓ Alternating/oscillating sequence 1+50-49+50 (mazimizing the average distance between consecutive values withing a finite bound is essentially a wave) No idea for Columbus but Wednesday before converting i think
@shanejohns7901
@shanejohns7901 Год назад
​@@tylerduncan5908 Oddly enough, I do remember 'Wednesday' being some part of the answer. There's basically a division by 7, back to the date of the calendar change. And then you have to make an adjustment, and then do another division by 7, paying attention to the remainder. With the lockers, I no longer remember the best solution. I know you can go from locker 1 to 100, back to 2, then back to 99, and sort of work your way to the middle, with each 'segment' getting shorter as you get to the middle. Or you can do locker 1, followed by 51, 2, 52, 3, 53,..., 50, 100 -- which are all segments of the same 'average' length. I am not sure which of those two solutions would maximize the distance traveled. The teacher also played around with the idea of the lockers being arranged in a circle (rather than in a line) as well, but we never worked that one out. As for the gumball problem, as I recall, the 'trick' was determining the gumball void volume first, then working backward to find its diameter/radius.
@nthouve7359
@nthouve7359 4 года назад
In fact, i think you could save some tests with this method because if you test the three first drinks of a group of four you know for sure that the fourth one is poisoned, and then you dont need to test it. Am I right?
@zachstar
@zachstar 4 года назад
yep! good catch. What I outlined is by no means the most efficient method, what you said would reduce the tests by a little more and there could definitely be other methods out there.
@pontus_qwerty
@pontus_qwerty 4 года назад
This yields 576 tests an average.
@RoderickEtheria
@RoderickEtheria 4 года назад
@@zachstar What you did did not reduce the amount of liquid wasted. The only thing it could have done was reduce the amount of tests done. You cannot reuse liquid that is mixed with a poisoned drink. Therefore, the most efficient method is to test each glass individually, at least if you want to preserve as much liquid as possible.
@user-wv1in4pz2w
@user-wv1in4pz2w 4 года назад
this solution (no pun intended) assumes that the optimal way is just to split it into equal groups and then test what remains with no further splitting into smaller groups.
@danielyuan9862
@danielyuan9862 2 года назад
If you are wondering, there is a much more optimal solution that uses an average of 472.636 tests, and I can't really explain the strategy because I got this from a computer program :/. Also, there is another comment saying that the theoretical minimum is about 469 tests on average, so that is a pretty tight bound for you.
@MidnightBlade22
@MidnightBlade22 Год назад
This method was used during the pandemic. When tests were in short supply, certain groups of people were tested using this method. Like nursing homes, army bases, and schools. Edit: labs where people submitted samples for testing often had large amounts of samples to test and would also use this method.
@m9l0m6nmelkior7
@m9l0m6nmelkior7 Год назад
1:00 into it and I'd say dichotomy like, split the amount and do a test with the glasses from the first half, then if poisonous split this part in half again, and keep doing it until either you have one glass that is poisonous (to be put aside), or a group of glass that are safe (to be kept). Then proceed with the next amount of glasses you haven't tested yet, and proceed like this until all is certain. Imma make a program of that ngl
@TheDougWay
@TheDougWay 4 года назад
First I'd split them into groups of 4, testing each group. However, I have different plans than presented in the video in testing each group of 4. Say there are the following probabilities of each amount of poisoned drinks in a group of 4: 0.6561 chance of 0 0.2916 chance of 1 0.0486 chance of 2 0.0036 chance of 3 0.0001 chance of 4 Now, given that there's at least 1, we can divide these by (1-.6561), and we get that there is now about an 86.1% of there only being 1. In other words, if we test the first one and it is poisoned, we can test the remaining group all at once and have an 86.1% chance to save 2 tests if it isn't poisoned and only the other 13.9% chance of adding 1 test, which is well worth it. Similarly, if we've tested 2 and then found the poisoned one, we could then test the last 2 at once as there would be an even lower chance of either of them being poisoned so you'd be very likely to save 1 test, and very unlikely to waste 1 test. The last optimization I'd suggest is that we should not have to test the 4th one at all if all the first 3 come up as safe. If we use all of these, I think we'd get a good bit better average case, and be very, very unlikely to do worse than how it's recommended in the video.
@superslimanoniem4712
@superslimanoniem4712 4 года назад
The machine would display poisoned all the time, because the way you’re taking the samples will contaminate all drinks
@jackburgess9389
@jackburgess9389 Год назад
If anyone is interested and wants to learn more about similar problems to this, this is a central problem in the maths branch called group testing. I did my final year project on it and there's some really cool problems, another being a graph with a defective edge or node
@hebrewwolf6540
@hebrewwolf6540 4 года назад
This was very nice. Thank you.
@neoshenlong
@neoshenlong 4 года назад
At a time when covid tests are scarce in some countries, couldn't this be a solution?
@jrgiha297
@jrgiha297 4 года назад
This was indeed used in many labs, especially because the positive rate was low enough. I specifically remember Seattle labs doing this at the beginning of the pandemic when resources where even more scarce.
@sewd1289
@sewd1289 Год назад
As a vampire, I do hate constantly having to test my drinks for HIV
@Alchemyst326
@Alchemyst326 11 месяцев назад
Well you wouldn't have that problem if you got some steady, trusted feeders like most of us do instead of going home with a new one each night.
@tacoexpressSEEDEEholeeveryones
@tacoexpressSEEDEEholeeveryones 10 месяцев назад
@@Alchemyst326Would you consider leaving on a red cloth regular table lamp in the bedroom and a tubular vintage oval bulb desk lamp in the office, and seeing which type of bulb burns out first after a while, "doing an experiment" ?
@dominiquefortin5345
@dominiquefortin5345 4 года назад
After analysis, a binary search where we test at each level is not efficient but if we start the binary search at the level ceiling(ln(1000*p)/ln(2)) then we get the same average number of test as in the video for high percentage (> 5%) and better than the average at lower percentage (
@davidwelch5520
@davidwelch5520 4 года назад
You can actually explicitly solve for the exact probability where your suggested method fails to improve on the brute-force solution (p < 1-exp(-1/e)). This makes the minimum occur at exactly n = e, which is quite a beautiful result. This isn’t too hard to prove either, so it’s a fun exercise to run through. Even more interesting is that above a certain probability, your curve has no local minimum and simply approaches 1000 from above as n -> inf (p > exp(4/e^2)). This one is a bit tougher to arrive at but I can follow up with the explanation in a comment if anyone is interested.
@scaratb8810
@scaratb8810 4 года назад
Can't we use this model to test for covid-19…
@huguesjouffrai9618
@huguesjouffrai9618 4 года назад
Yes it's being discussed
@Arboldenrocks
@Arboldenrocks 4 года назад
sure but you have to mix 500 people in a giant blender....
@spartanwar1185
@spartanwar1185 4 года назад
@@Arboldenrocks woah okay we don't need to do that much for a tiny drop of blood bruh
@johnnydeep7089
@johnnydeep7089 4 года назад
Couldnt the number of tests needed be further reduced by splitting them into groups after the first test
@TheAgamemnon911
@TheAgamemnon911 4 года назад
No, because you only know that at least one - if any - drink is poisoned, not how many exactly.
@HsinTsungChu
@HsinTsungChu 4 года назад
Same question here
@gobdovan
@gobdovan 4 года назад
the number you need is a little less than 344 individual tests since there will be a situation in which 3 glasses are safe so the last one is poisoned and doesn't need testing. This situation will occur in around 7% of the total groups (.9**3*.1)
@philipszeremeta2621
@philipszeremeta2621 4 года назад
Panacea but you don’t know which glasses fulfill that situation the first could be poisoned but so could the other three and it’s not 100 poison glasses but 10% with statistical randomness so you can’t just do it at the end
@TheAgamemnon911
@TheAgamemnon911 4 года назад
You need to consider the permutations as well. Only in the one case you actually test three safe glasses first, you can then skip the last. That propability is .9^3*.1*1/(4 over 1) (the last bit being the binomial coefficient) or around 1.8%
@gobdovan
@gobdovan 4 года назад
@@TheAgamemnon911 import random as r def R(): return r.choice(range(10))
@XxPlayMakerxX131
@XxPlayMakerxX131 4 года назад
Absolutely amazing!!!
@michelcazayoux2334
@michelcazayoux2334 11 месяцев назад
My best scenario found was to put the glasses in groups of 6 (53% chance safe, 88 of 167 groups safe, 472 glasses remain), then put the remaining 472 glasses in groups of 3 (49% chance safe, 77 of 158 groups safe, 241 glasses remain), test each of the remaining 241 individually. 167 tests in phase A + 158 tests in phase B + 241 tests in phase C = 566 total tests.
@tcflorea
@tcflorea 3 года назад
General problem: Having N Samples with probability p1, ..., pN of being positive and ability to combine the Samples when testing, run the minimum number of Tests to evaluate whether each sample is positive or not. 1 Sort the samples such that p1>p2>...pN.(optional, see note*) Add S1 to "current sampling list" 2 If p11/2 ( e.g. we may have added the S1 S2 and S4 to the list as (1-p1)(1-p2)(1-p3)=0.49, (1-p1)(1-p2)(1-p3)=0.51 and pN>0.01 hence nothing else fits in the sample) Repeat 2 until not possible. 3 Test the sampling list 4. If Negative: For each Sk in current sampling list: - Assign pk=0 (clear the Sk sample) - Compute the pk for each sample in each of "previous positive sampling lists" that contains also Sk. (in particular if a previous list contains only one more sample, it must me positive hence we can also clear the list from "previous positive sampling lists") 5. If positive: If a single sample assign p1=1 ( mark the S1 positive) and stop if nothing else to test If more samples in the current list: -compute the new probabilities in the "current list". -add current sampling list in the list of "previous positive sampling lists" -repeat with step 1 *NOTE: this does not guarantee the minimum number of tests but something very close to it. The goal is to have something closest possible to 50%; or actually the smallest distance from 1/2*N at the end of for the all the N tests performed. One other approach is to create the sampling list starting with lowest probability and moving back to highest. A third approach is to evaluate all 2^N combinations and pick the one closest to 1/2 A forth pproach is to simply pick random samples until either the entire list (or the sample alone) is more the 50% positive and skip the initial sorting. E.g. We might find that S1,...,Sk is 40% negative and nothing else fits to be less than 50% neg. Similarly Sn-k, .. ,Sn is 45% negative and nothing else fits to be less than 50% neg. However there might be a Sa, Sb, .... list that is exactly 50% negative. Even the costly computing approach of finding such a list does not guarantee the minimum as it might adversely affect the next iteration. P.S. Grouping by 4 ( when 10% positive) is NOT something optimal at all we run tests with 65.6% chances of being negative and 34.4% of being positive. We have to group by 6 or 7. It is like wasting one in three tests. Then testing individually at the end is yet another waste of tests as tests performed are still more likely to be negative. The same rate of wasted tests.
@macdjord
@macdjord Год назад
My first thought was to select a group size such that the test had a 50% chance of coming back 'poisoned', on the basis that that maximized the amount of information the test would return.
@SharkyShocker
@SharkyShocker 4 года назад
This is the kind of math I want to see in school. I want to say 95% of my experience with math (probably more) all throughout high school was our teacher giving us numbers and formulas to use, and problems to solve with no real world applications. Because of that, whenever I see problems like this...... I can understand the math behind it, but I have no idea how I would get from step 1 to figuring out how to get there on my own. I was just taught in that 3 week period of algebra 2 to use this certain formula and input some numbers into said formula to get the answer I should want...... which really sucks since now I feel like I can't actually do anything with what I've learned. I'm currently in Calculus 1 atm and I feel like if I were to try and use my knowledge of math in the real world I would be completely useless.
@RobloxKid123
@RobloxKid123 Год назад
I was surprisingly on the right track when solving this. I thought of splitting them into groups of 8 or 10. I thought that 8-10 would be more efficient than 4-5, but I guess I was wrong!
@super_7710
@super_7710 4 года назад
I rarely like these types of videos as I only like that which I might want to watch again some day. This video was great though so I had to like it!
@thedoublehelix5661
@thedoublehelix5661 4 года назад
Probability is so confusing but really fun as well!
@ronbowley2778
@ronbowley2778 Год назад
Two things 1. I would love a video finding the optimal solution 2. Here is my suggestion to futher optimizing the method shown Once you have all sets of 4 glasses with at least 1 in each being poisoned then test each group of 4 individually UNTIL you test postive. Then remove the negative glasses and set aside the untested glasses and continue that on all sets. Continue to set aside untested glasses. At the end you have removed 1 poisoned glass for each set. Now you can tell how many poisoned glasses are remaining. From that you will have a new % ratio of poisoned to non poisoned glasses so refer to the chart in the video to regroup the glasses in the optimal size and repeat the process again. Also if someone understands what I'm saying and can say it more clearly please help lol
@abcdefgh5808
@abcdefgh5808 Год назад
I think the optimal strategy might be very complicated. for example, depending on the outcomes of the first group, you might choose a different group size next ect.
@gameplaysh6135
@gameplaysh6135 Год назад
Holy shit this is exactly what I was looking for! You're a life saver, I'll be back when I'm done!
@grim1427
@grim1427 Год назад
I love that the CC said "... there is a pee chance" of the cup being poisoned.
@lucasf.v.n.4197
@lucasf.v.n.4197 9 месяцев назад
that was a very beaultiful non linear function with a real life application!
@cem_kaya
@cem_kaya Год назад
For the 1 poison version there is a faster way. divide to 3 test first 2 groups if in the first or second group recurse on that if not recurse on the thud one. This has lower complexity. instead of Log_2(N) it is Log_3(N)
@RobertBlair
@RobertBlair Год назад
My vague memory of Computer Science / Pstat was an algorithm like: pick 1/e (36.8%) items as the group size, and recurse on group 1 / 2 depending on the result. the average is better, but worst case is not
@cem_kaya
@cem_kaya Год назад
​@@RobertBlair i think we are talking about different algorithms. The one i describe is a special case of the search in the video.
@RobertBlair
@RobertBlair Год назад
@@cem_kaya I think we are both talking about the One Poisoned drink out of 1000 special case. I think your algorithm can be improved by making it fully recursive. Imagine you started out with 1500 drinks, and the first 500 came back clean. This case is identical to the original 1 out of 1000 problem. But using your algorithm, instead of splitting the remaining 1000 into 333,333,334, you would split into 500 / 500, which we assumed was not optimal at the start. My suggestion is there is an optimal ratio to use, and use it recursively on set 1 or set 2 depending on results of test of set 1.
@cem_kaya
@cem_kaya Год назад
@@RobertBlair i meanit fully recursive
@danielrhouck
@danielrhouck 3 года назад
Wow… nice timing on when you released this video. Should I be looking at your more recent ones for predictions of world events?
@Adityarm.08
@Adityarm.08 Год назад
This is similar to how you can quickly aggregate numbers using a GPU. A sequential CPU reduce 2 entries to 1 at a time, needing N time steps. A highly parallel algorithm cuts data set to half at every iteration, needing lg(N) time steps.
@extremefabi
@extremefabi Год назад
Covid PCR tests were also performed in patches. It resulted in positives as well as the negatives batched with them took a lot longer to confirm,
@Fictionarious
@Fictionarious Год назад
I solved the "unknown p-value" version of this problem a few years ago. Instead of imagining a fixed number of drinks and a theoretically unbounded number of tests we might run, imagine that we have an unbounded number of drinks, but a large upper limit on how many tests we are allowed to run. Our goal is to verify the status of as many drinks as possible within this arbitrary (but presumably large) number of allowed tests. The optimal strategy for rapid verification in this second scenario will be the same as the optimal strategy for verification in the first. Define the trivial strategy to be simply testing each drink, one at a time. For any possible strategy, we define a marginal reward function for any now-verified group of some size, as simply the difference between the number of tests that were conducted to fully verify that group, and the number of tests that the trivial strategy would have required (equivalently, the number of drinks in that group). For example, if we test a new group of four drinks, and verify that all are 'clean' in just one test, our marginal reward is 3. If, on the other hand, we take four tests to verify the status of just one drink (which can happen if we start by testing a group of size four, but continuously fail to find an 'all-clean' subgroup of size >=1 as we test successively smaller and smaller subgroups of that group) then our marginal reward is -3. Our total reward at any point, then, will be the sum of these marginal rewards at that point. Maximizing our expected total reward over time is a process of maximizing our expected marginal reward for each new group of drinks that we examine, updating our estimate for p (and ideal new group size) as we go. The expected reward based on some estimate for *cleanliness* p (so, our estimate for probability of being poisoned is now represented by q) is given by an interesting sequence of polynomial functions that assign reward-weight coefficients to terms in a geometric distribution (I'm dropping the zero coefficients where they arise here, but you can try to spot the pattern): E[R]_1 = 0 E[R]_2 = (1)*p^2 + (-1)*q E[R]_3 = (2)*p^3 + (1)*qp^2 + (-1)*qp + (-2)*q E[R]_4 = (3)*p^4 + (2)*qp^3 + (-2)qp + (-3)q E[R]_5 = (4)*p^5 + (3)*qp^4 + (1)*qp^3 + (-1)*qp^2 + (-3)*qp + (-4)*q E[R]_6 = (5)*p^6 + (4)*qp^5 + (2)*qp^4 + (-2)qp^2 + (-4)qp + (-5)q (. . .) Our agent chooses the optimal group size for the next group to be tested by iterating forward through this sequence, comparing the value of E[R]_n to E[R]_n+1. Once it sees that E[R]_n+1 < E[R]_n, for any group-size n, it will stop there and choose the next group to be of size n. My solution assumes that the best way to proceed from there is to "peel off" wells one at a time so that the next test is on n-1 of those n drinks. Would there be an improvement if it instead subdivided the contaminated group of n into two equally-sized subgroups and tested each of those subgroups? I'm not so sure myself . . .
@cauhxmilloy7670
@cauhxmilloy7670 4 года назад
Sorry, I don't know if there's some constraint that might be missing. But this can be done (using the same method) with far fewer tests. Just apply it recursively. After the first 250 tests, don't do individual tests. Instead regroup all individual samples into new groups (such that no 2 were paired in the previous grouping). Then redo the mixed tests on those 86 groups, again eliminating 34.4%.** This leaves us with ~30 groups. After more mixing and recursion, you get 10 groups. Then 3. Then 1. 250 + 86 + 30 + 10 + 3 + 1 = 380, better than 594. **Recursive grouping will not lead to exactly 34.4% since any given drink has more than 10% likelihood of being poisoned. This chance increases after each round of testing. But still, some drinks are likely eliminated (due to being safe). As stated in the video, grouping only works at lower chances. So, there could be a breaking point which the apparent chance grows high enough (due to failing tests in group) that individual tests (or some other method) becomes more efficient. In that line of thinking, it might be better to do larger groups in order to minimize the apparent chance growth after recursive testing. Not so sure about that off the top of my head.
@m.keller3226
@m.keller3226 Год назад
If You eliminate about 2/3 in the first round, the probability of having a poisoned drink in a test group of the same size will triple. This means a second round will eliminate only about 24% of the remaining drinks. In the third round of testing the probability of a poisoned drink will go up to nearly 40%.
@sivonparansun
@sivonparansun 3 года назад
Great interview question
@taktoa1
@taktoa1 Год назад
Might be worth mentioning that this is called "adaptive group testing" in statistics. There is a related field called "adaptive compressed sensing", where the goal is to find out the amount of poison in each vial, given a machine that tells you the total amount of poison in an arbitrary weighted mixture of vials (linear combination). This paper describes a binary search based algorithm for adaptive compressed sensing: arxiv:1306.6239; the way it works is as follows: If there's some structure to the probability of the vial concentrations (I'll just say values to be generic), like if for example the values are a time series that changes slowly with time, then you start by coming up with a linear transformation that is likely to make the vector of values _sparse_, i.e.: most values close to zero. Call that transformation T. Now, create a vector v where the first half of elements are 1s and the remainder are 0s. Now measure the vials weighted by the vector T^-1 v, resulting in m = (T^-1 v) · x where x is the unknown vector we are trying to find, and if m is greater than some chosen threshold t, then "recurse" into the first half of the vector (i.e.: make v have 25% 1s 75% 0s). Then, do the same thing but where the second half of elements are 1s and the first half are 0s.
@CramcrumBrewbringer
@CramcrumBrewbringer Год назад
I’d use the quick-sort method of splitting sections in half. Grab drops from 1-500. Then 501-1000. Use the set of 500 non-poisoned glasses. Repeat for 250. 125. Etc. If both sections have poison, split again. And again. And again. Dividing by two is the best option.
@HuyTran-ny7mg
@HuyTran-ny7mg 4 года назад
We may further reduce the number of tests using the same method by applying it recursively. (ie dividing drinks in the poisoned group into groups of 2)
@REALITYBEHOLDER
@REALITYBEHOLDER Год назад
HEY!!!! I've been doing that for YEARS to find out which mod is corrupted when I have game crashes in my super long modlists... I had no idea it had a name!
@nonnnth
@nonnnth 4 года назад
It sounds like it would take more time to organize drinks into groups and then collect sample of each drink in group to test, and then test the drink in positive group individually, rather than test each of them individually in the first place, if the machine can output the results right away.
@tetsero
@tetsero 4 года назад
With that test n amount, test n-1 and then gather all of the remainders and do another 4 batch test with them (or maybe another number might be more efficient?).
@Kotfluegel
@Kotfluegel Год назад
This problem seems to be related to finding an irreducible inconsistent subsystem within a set of constraints of a linear program. So what do you do, if the fraction of poisoned samples is unknown? I guess you'd have to use some scheme, which uses a variable group size.
@deuceditton2574
@deuceditton2574 11 месяцев назад
You could make a small optimization to the solution by not testing the final cup in a poisoned group with 3 safe drinks found. The odds of having a group with a specific one poisoned and 3 not is 7.29%, so we get about 18.2, or just 18, such groups. This allows for only 176 tests. Idk if it changes the optimal levels at all because I don’t want to do more math
@balen7555
@balen7555 Год назад
Beside what others have said in that it isn’t the most efficient solution, it’s also mathematically unsound as it doesn’t take into account Bayesian rule and apply posterior probability when we know a test for an entire group combined is positive (new information)
@unvergebeneid
@unvergebeneid 3 года назад
Funny how you did this video right before it became really relevant as pool testing for COVID.
@foogod4237
@foogod4237 Год назад
A better (and very easy) solution would be to do a binary search over each of the remaining groups of 4 drinks. This would allow you to test some groups with 3 or possibly even 2 tests, instead of 4. (Considering this whole thing started out describing a simple binary search, it seems silly that they just kinda forgot that whole technique for everything that follows...)
@MrJronson
@MrJronson 11 месяцев назад
I got down to ~322 average tests needed to solve the first example. Split it up into 10 groups of 9 and 91 groups of 10. Then any positive groups of 9 into groups of 4 and 5, and groups of 10 into 5s. Then into groups of 2 and 3. Then individually.
@geoff-huang
@geoff-huang Год назад
You’ve convinced me that this approach gets a good solution. But you have not proved that this approach gets you the best solution.
@alex_zetsu
@alex_zetsu 11 месяцев назад
I wonder if there were more than 1000 drinks if a multiple tiered group would be optimal like groups of 1000, then split that into 4 then split into groups of 1 (individual groups).
@ghqebvful
@ghqebvful Год назад
When you are at the part where you have groups that contain a poison and not, would it be beneficial to combine those groups back to a larger group and reuse the algorithm?
@lilbuggers3
@lilbuggers3 Год назад
All I could think of was The Princess Bride and all the drinks were poisoned.
@RudolfMaster.
@RudolfMaster. Год назад
bro just divided everything and still managed to test every single glass
@GIGATHEBOT
@GIGATHEBOT 4 года назад
Mix all the drinks together, now we know all of them are poisoned. This uses the machine 0 times
@TwilitbeingReboot
@TwilitbeingReboot 11 месяцев назад
I want to turn the "only one drink is poisoned" variant into a D&D puzzle. The party wants to steal an alchemist's entire supply of a specific ingredient, potion, whatever. They happen across a room where all the potions are stored in big reservoirs connected up to an automatic mixing/dispensing machine... essentially one of those fancy soda fountains. They _could_ just steal all the reservoirs, or remove them and test each one, but getting them out of the machinery takes a long time. Running the mixer/dispenser and testing what comes out takes less, but still some, time for each operation. Add in combat, a timed hazard, or some other pressing danger, and D&D's action economy will make sure players look for ways to save time and make fewer tests.
@andreaamico7368
@andreaamico7368 3 года назад
What about regrouping and test in more rounds? For instance in the group of four example, if I first test 12, 3 groups. if it is good, we save 2 tests, if not and we first 2 groups of 4 are good, we know that last four is poisoned, so it is the same running 12 first or not. If 12 poisoned, first 2 groups have at least a poisoned we have to test last as well, so we do one more. For low percentages is better no?
@ersetzbar.
@ersetzbar. Год назад
do you think its a good idea to use the same pipette in 1000 possibly poisened drinks? you would get 100% positive results due to cross contamination that way (except for the first few until you reach the first poisened one)
@nitrogenFox
@nitrogenFox Год назад
What maniac gives you 1000 glasses of water and says "some of them are poisoned. Figure it out" and just expects efficiency
@alexeytsybyshev9459
@alexeytsybyshev9459 Год назад
This can be intuited by looking at how you can exclude the most cases with a sinle test. If you expect a test to be positive with probability p, then on average it will exclude 2p(1-p) cases. To maximize this, p needs to be as close to 0.5 as possible. This is not the same thing as minimizing total tests though, because this test can make further tests worse, as we see in case of p>0.33 in this problem. But trying to bring the probability of a test being positive to 50% is a good idea generally.
@iamcoolkinda
@iamcoolkinda 11 месяцев назад
I’m surprised you didn’t mention taking the derivative of the function you derived and setting it equal to zero to find the group size. This gives you a non-integer number that you can round up for any given p-value you are interested in. tested in wolfram and it works
@petermeter4304
@petermeter4304 Год назад
But how do we know that splitting them up into groups once and then testing individually is the best approach? What about grouping and then dividing into subgroups?
@useruser-ti1og
@useruser-ti1og Год назад
Finally feeling like my applied math major taught me something when instantly responding with binary search but scaling division sizes with optimized likelihood :D
@trimuloinsano
@trimuloinsano Год назад
I swear these videos teach me more about statistics and probability than 2 weeks of lessons at my university
@giobaldu
@giobaldu 4 года назад
If p is low, can't you iterate the procedure instead of testing each remaining sample individually? You group them in groups of n1, compute the new p2>p1 probability, and then make groups of n2 < n1. This should hopefully converge to bisection when 1 = 1/1000
@alihejazi4276
@alihejazi4276 11 месяцев назад
This channel is awesome ❤
Далее
Does math belong in the courtroom?
22:41
Просмотров 572 тыс.
The Mathematics Used to Solve Crime
15:58
Просмотров 361 тыс.
МОЩЩЩНОСТЬ ZEEKR 001 FR
00:46
Просмотров 829 тыс.
2D water magic
10:21
Просмотров 527 тыс.
The "Just One More" Paradox
9:13
Просмотров 2,9 млн
What math and science cannot (yet?) explain
18:15
Просмотров 1,9 млн
How We’re Fooled By Statistics
7:38
Просмотров 3,6 млн
Can Humans Sense Magnetic Fields?
13:53
Просмотров 3,9 млн
Synchronising Metronomes in a Spreadsheet
21:55
Просмотров 320 тыс.
What happens at infinity? - The Cantor set
16:25
Просмотров 262 тыс.
Is The Metric System Actually Better?
12:53
Просмотров 2,5 млн
The Infinite Money Paradox
10:32
Просмотров 3,1 млн