görünümler 6,935,663

The 100 Prisoners Riddle feels completely impossible even once you know the answer. This video is sponsored by Brilliant. The first 200 people to sign up via brilliant.org/veritasium get 20% off a yearly subscription.

Special thanks to Destin of Smarter Every Day ( ve42.co/SED ) , Toby of Tibees ( ve42.co/Tibees ) , and Jabril of Jabrils ( ve42.co/Jabrils ) for taking the time to think about this mind bending riddle.

Huge thanks to Luke West for building plots and for his help with the math.

Huge thanks to Dr. Eugene Curtin and Dr. Max Warshauer for their great article on the problem and taking the time to help us understand it: ve42.co/CurtinWarshauer

Thanks to Dr. John Baez for his help with finding alternate ways to do the calculations.

Thanks to Simon Pampena for his input and analysis.

Other 100 Prisoners Riddle videos:

minutephysics: www.youtube.com/watch?v=C5-I0...

Vsauce2: www.youtube.com/watch?v=kOnEE...

Stand-up Maths: www.youtube.com/watch?v=a1DUU...

TED-Ed: www.youtube.com/watch?v=vIdSt...

▀▀▀

References:

Original paper: Gál, A., & Miltersen, P.B. (2003). The Cell Probe Complexity of Succinct Data Structures. BRICS, Department of Computer Science, University of Aarhus. All rights reserved. - ve42.co/GalMiltersen

Winkler, P. (2006). Seven Puzzles You Think You Must Not Have Heard Correctly. - ve42.co/Winkler2006

The 100 Prisoners Problem - ve42.co/100PWiki

Golomb, S. & Gaal, P. (1998). On the Number of Permutations on n Objects with Greatest Cycle Length k. Advances in Applied Mathematics, 20(1), 98-107. - ve42.co/Golomb1998

Lamb, E. (2012). Puzzling Prisoners Presented to Promote North America's Only Museum of Math. Observations, Scientific American. - ve42.co/Lamb2012

Permutations - ve42.co/PermutationsWiki

Probability that a random permutation of n elements has a cycle of length k greater than n/2, Math SE. - ve42.co/BaezProbSE

Counting Cycle Structures in Sn, Math SE. - ve42.co/CountCyclesSE

What is the distribution of cycle lengths in derangements? In particular, expected longest cycle, Math SE. - ve42.co/JorikiSE

The Manim Community Developers. (2021). Manim - Mathematical Animation Framework (Version v0.13.1). - www.manim.community/

▀▀▀

Special thanks to Patreon supporters: RayJ Johnson, Brian Busbee, Jerome Barakos M.D., Amadeo Bee, Julian Lee, Inconcision, TTST, Balkrishna Heroor, Chris LaClair, Avi Yashchin, John H. Austin, Jr., OnlineBookClub.org, Matthew Gonzalez, Eric Sexton, john kiehl, Diffbot, Gnare, Dave Kircher, Burt Humburg, Blake Byers, Dumky, Evgeny Skvortsov, Meekay, Bill Linder, Paul Peijzel, Josh Hibschman, Timothy O’Brien, Mac Malkawi, Michael Schneider, jim buckmaster, Juan Benet, Ruslan Khroma, Robert Blum, Richard Sundvall, Lee Redden, Vincent, Stephen Wilcox, Marinus Kuivenhoven, Michael Krugman, Cy 'kkm' K'Nelson, Sam Lutfi, Ron Neal

▀▀▀

Written by Derek Muller and Emily Zhang

Filmed by Derek Muller and Petr Lebedev

Animation by Ivy Tello and Jesús Rascón

Edited by Trenton Oliver

Additional video/photos supplied by Getty Images

Music from Epidemic Sound and Jonny Hyman

Produced by Derek Muller, Petr Lebedev, and Emily Zhang

To find the probability that a loop of length p for a fixed p with p > n/2 you proceed like this: Select p values out of n, n chose p = n!(p!(n-p)!) ways to do so, then create a cycle of length p, (p-1)! ways to do so, then arrange the n-p values remaining, (n-p)! ways. So in total: n!/(p!(n-p)!)(p-1)!(p-p)! (call this A) to create a configuration with a cycle of length p. Divide A by n! to find probability to get 1/p. This work because we did not overcount configurations in calculating A If p is less than n/2, formula A would count several times any configuration that has more than one cycle of length p, of which there would be more and more as p decreases. So to get the actual probability of a cycle of length p (where p < n/2) you would have to use a more involved calculation using the principle of inclusion-exclusion. Note also that 1/(n+1)+1/(n+2)+....+1/(2n) converges to ln(2) = 0.69314718056. So whatever the value of n there is a probability of at least 30.6% that the convicts will be freed.

@John Smith you will always find your own number if you start with your number box since there are no duplicate number boxes and no duplicate numbers

@Arturas Liutkus since there are no duplicate numbers 1 number can only point to 1 box so if you start with your number box you will always be on the right loop

9:00 is sus

I think you’re confusing probability with possibly

6:35 I like that Derek's "random" numbers were all odd numbers. We have a bias towards perceiving odd numbers as more random than even numbers. Even more so, of the 9 digits in these numbers, only a single one was even.

this is a random thing but i notice usually when asked for a random number, if they do use an even number people usually say something in its sixties

My guy didn’t even say the boxes were labeled in the text screen.

Wow..! mind blown again.

@Chance yeah thats what I also thought about

@Jynx 2.8% for total randomness, but for people its not like this. Derek could not even see that, but his mind for some reason picked them all odd. Also I think thats just because odd numbers seem more random to our brains.

If you think the riddle is hard, imagine trying to convince 99 fellow prisoners to follow the plan to the letter.

@senni bgon you've clearly never been in prison. Or met someone with ADHD.

No letters, just numbers, ha ha.

each box points to the next

My Chemistry teacher was OBSESSED with this channel in his high school years (he's pretty young, yeah), and I just had to check it out for myself. I've always had a bad relationship with Math because most of my teachers were douchebags, but these videos are helping me see it through a new perspective. It's still frustrating and confusing at times, but it's oddly cool nowadays. It gets less tiresome to calculate stuff now. Thanks awfully, dude! 😄

I paused at 3:44 to try this method out using Python code. I ran the code 100 times, of which 32 runs were successful (every prisoner was able to complete the task under the given conditions). In other words, it achieved a probability of 0.32. Very close!

@Servo There are likely more ways to get it to run quicker but they would require testing. Perhaps a quicker shuffle algorithm for example. I will play around with it sometime soon.

@Servo Did you try my code in a c compiler? If so, what speed did you get?

@David James Can you paste your code here? I wrote mine in python and its pretty slow. I'd like to see it written properly, in a low level language.

@Shimanshu Yadav Does it work? How long does it take to run?

@zwitter689 here is my js code for this problem. // prision problem from the array lets see whats the outcome function shuffled_array(length) { let box = []; for (let i = 1; i

I've seen this riddle so many times, but this is one of the most efficient way to explain "Why" rather than just an optimal solution. This is why I love this channel

strategy is a way to synchronize the wins and fails

When you factor in the odds of one nerd convincing 99 other convicts to go with this strategy, your chances quickly fall back to zero.

Lol

Not really.

True. I keep thinking if I was a prisoner there's no way I can convince them all. Average humans are too stupid.

ROFL

Even if you could convince them, someone will mess up somewhere or forget what to do.

This is why I have such a deep appreciation for those who are great at math. I have no idea how this was figured out and I don't need to because we have people like this! Thank God!

can someone explain to me at 8:35 I dont understand that much, the unique loops of 100, and total permutations relate to the possibility of getting 100 numbered loops

randomly, what is the expected time until one population makes it through? Is there a meta-scheme of renumbering which raises your probability of success even more?

I think the tricky part of finding the answer to this is realizing that even with this strategy it is more than likely they will not win. It's hard to consider different strategies because any one you think of will not be a "good" strategy and will not stand out to you.

a fair puzzle would be to allow prisoners to open as many as such that the probability converges to 50%. The answer is 60.65. So, prisoners should be allowed to open 60 boxes.

@Zara Bisho Explain how they're nonsense

all these strategies are complete nonsense, everything shows time

That’s why I would just cheat 🤷♂️ And if that fails then RIP me

To me, the neatest thing about this is that by definition, getting on the loop with your own number will ensure that unless you are on a loop of 100 numbers, there are going to be boxes that you never have to open because they aren’t on your loop. It doesn’t tell you by how much your odds increase, but you necessarily make you own pool of options smaller unless all are on one loop.

As soon as I was presented with this puzzle, my first thought was to find a way to make the individual prisoners' chances of success correlate with each other (didn't actually find the trick by myself, though). Once you break independence between the guesses, you start making gains in overall success. It'd be interesting to see how the limit changes as you alter the proportion of the boxes each prisoner is allowed to open.

@Bradbury If we solve the equation 0.5 = 1 - log(1/x) for x we get x = 1/sqrt(e) which would be about x = 60.65%, so it checks out.

This was something I was curious about myself. I can't do the math, but I ran some simulations. After 40k iterations, I found that the longest loop was

yep, the solution is similar to the "lets make a deal" door solution. you're playing non-intuitive games with chance, to maximize your chance of winning.

If the proportion is some x between 0.5 and 1 the logic still works basically the same and you should get 1 - log(1/x) success probability in the limit. If the proportion is some x < 0.5 it seems to get more complicated. I don't know whether there is a nice expression for it in that case.

As somebody that's tried tracking down a CD left in the wrong CD case, I can attest that the loop strategy does indeed work 31% of the time. (The other 69% of the time it turns up weeks later on the kitchen table.)

@Mcroostr I have no idea what comment you’re replying to, but there’s no way I said that lol re-read whatever you thought I said

@alveolate hermeneutist also works for game cartridges and boxes.

@Tyler Grant so all humans can only use what their generation uses for music? I’m too old for Spotify?

Lol😂😂

You assume its left in a case.

My dad actually asked me this question about a month ago when I was with a couple of friends that particularly like riddles. I somehow got the answer right after a lot of guessing and yet I still only kind of understand it. Funny how complicated simple things can get if you dive deep enough!

An interesting thing to note, that makes things less counter intuitive is that on average as many people find their numbers with both strategies. It's easy to see with the naive strategy 50% find their number. With the loop strategy. The only ones that don't find their numbers are the ones in the biggest loop if it's bigger longer than 51. So in 1 case in 100, 100 dont find it, 1 case in 99, 99 don't find it. So on average 100*1/100+99*1/99+...+51*1/51 = 50 persons don't find it. So on average 50% don't find their number. This strategy is a way to synchronize the wins and fails

I love this video, it eliminates the “chance” grouping it in a loop, you’re predetermined to fail or succeed.

For anyone confused thinking the loop could fizzle by going back on itself somewhere other than the starting number (I was)... remember that no box mid loop will reveal another box already opened, other than the starting number, because that box was previously revealed and so cannot be in a future box. 10 to 11 to 12, 12 cannot have 11 because 10 already did.

@Leo Jacksom That would be a 1 box loop. Which is an option. If you mean what if you got to box n and it had n inside, it would not since the box leading you to box n had n inside it.

But what if box n has slip n in it

Thank you! That was exactly my question

@FenixxTheGhost i am stupid 😅

@Le sommet I may assume that after 32-10 you wanted to type 10-88, in this case: You can't have two 88's. 88 cannot point to 88 since 88 is already defined in 10. If you meant to type 10 back 1 - then you have two independent loops, that consists of 5(1,5,7,32,10) and 1(88) iterations.

I think the chance of convincing 99 other prisoners that this strategy is their best chance of survival is much lower than 31%.

At least it cannot be worse.

@SmellMyKKPP The chance of the other 99 would still be the same 31%, but since all have to succeed to win you have to multiply it with the 1/2 chance of the rogue prisoner. So with one going rogue, it's around 15.5%, with two it's 7.75% and so on.

I find it discriminatory towards prisoners that they always get used for these kind of math problems. They have rights too.

@Urukosh ! unfortunately though, the alternative to escaping was being executed..

@tsv I think he meant that 50% is the overall chance of the strategy being successful and the whole group being released from prison. The outcome of the strategy depends completely on the first person finding their number which is a 50/50 chance. Of course, if the first person finds their number then all the other inmates are 100% guaranteed to find their numbers, but the overall chance of success with this strategy is still just 50% because if the 1st person doesn't find their number (50% chance), the whole group is doomed.

to come up with this solution you'd really have to think outside the box. on behalf of all the other prisoners' lives - be sure not to slip up edit: all jokes aside, this is a really fascinating problem. i actually found it extremely logical. it really made sense - admittedly it's very surprising how big that probability is at first.

So all it is is a 31% chance that all the loops are 50 or less as long as every one follows the same process. Seems pretty straight forward to me. You could use the exact same strategy if they only got to open 30 boxes(or whatever the number could be) , its just that you would hope that the loops are all 30 or less. It made cense once he explained the loop right at the beginning.

🐕 is 31% chance.

You would be a good teacher, your explanations are very straight forward and easy to learn.

Loved this. Brain candy. And brilliantly explained.

Interesting corollary: If prisoner #1 (or any other prisoner) finds that his own loop has a length of exactly 50, he immediately knows there's a 100% chance of success.

True!!!

Here's an interesting experiment - set the room so it contains exactly 2 loops of 50 cards, then see if you can convince the prisoners to use this method with a 100% success rate...

@Ath Athanasius o wow thats cool!

And at least 50% of them would be FREAKING OUT opening their last chance of survival on box 50!

And if it's more than 50 he knows everyone is dead anyway.

I was really hoping you were going to have 100 people try this out in real life at some point in the video

I actually think that this is quite intuitive once you hear it. I didn't know it before, but as soon as I heard the following the loop part of it everything made sense.

I think where people get confused is not understanding the slip of paper 72 and the box numbered 72 as being a single unit of the loop, so they get confused thinking "well what if I pick the wrong loop". Until that bit fully clicks, it makes no sense. For some of us that part is intuitive once it's told to us but for others it just doesn't. I think him giving the visual helped but still. Math concepts are one of those things where you don't get it until suddenly you do, even if it was explained to you exactly the same every time

I've played and watched pokémon evolution rando, (every level, random evolution, the evolution chains are set when the game starts) so the idea of any large group of variables creating loops even without the restriction of only 1 leading to 1, isn't really that big a stretch for me considering how often it happens in evo rando.

It is a similar concept to the Monty Hall problem in that everyone views each person as unconnected choices. However, as you have now linked two boxes together by going to the next one with that number you have now shared information between chances and changed the probability. Just like in the Monthy Hall problem, revealing a door provides new information, it is just down to how you use it and in this case it is a cleaver way of using it in these loops.

each box points to the next

As someone that went to prison, I can tell you with 100% confidence, that they got more chances to win by randomly picking boxes (one in 8*1^32), than 100 of them to agree to ANY strategy.

That is one in 8 which is 12.5%.

@Aaron I only found this video because I'm trying to understand how Michael knew how to save us all that day. I'm so glad he wasn't shanked with a sharpened toothbrush that one time he took two servings on cous cous Friday, leaving none for one-eyed Emine.

@Aaron Kerrigan Yeah, I acknowledged the somewhere in the comments. But I'm necer editing my comments - an old prison habit. 😛 Trust me, even if the leader orders them to do something, many of them would do the opposite if the leader has no way to know that they disobeyed. And he wouldn't have a way to know.

@WCW 31% ??

I think you meant 1 in 8*10^32, not 1 in 8*1^32 because those odds wouldn't be so bad. Also, you know you just gotta convince each gang leader and the lackeys will follow. So maybe 1 in 5 chance. 😂

I love this explanation and now this makes total sense to me, but there is one thing that he said that doesn't click. He said a benevolent guard could "guarantee" they all survive by switching two slips, thus breaking any potential 51+ box loops. Although I agree it would increase their chances of survival, isn't there a small chance he could instead accidentally combine two loops to create a 51+ box loop? My question assumes the guard makes the switch at random without knowing the placement of the slips in the boxes, which may not have been Derek's intent.

The idea is that the guard is the person who put all of the slips in the boxes in the first place, so he knows where all of them are. Furthermore, it assumes that he originally placed the slips in boxes at random, as otherwise he could purposefully make whatever arrangement of loops he desires. In other words, if you are a benevelovent guard, you can initially assign all of the slips to boxes at random and then look at the slips in the boxes, change two of them, and guarentee success for the prisoners if they use the video mentioned strategy.

Yeah, walking into the room and "seeing" the loops, and knowing how to break the long chain, seems impossible. I think it's one of the points you'd have to suspend disbelieve on, just like all the freaked-out prisoners would actually follow the algorithm without goofing.

I do think he’s implying that the guard is aware of a loop containing 51+ boxes and strategically swaps two of those slips so that it breaks the loop into two loops that have less than 51 boxes. Otherwise you’d be correct that swapping two random slips without knowing anything about the loops could make the situation worse.

To me it sounds like the video up until giving the solution "follow the loop that you are on" is about the original problem - but after that it's stuff that's expanding on that. The "benevolent guard" part strikes me more as just a nice visualization of an interesting fact about the structure of the data there. So it's an all-knowing guard, which isn't mentioned, but the whole thing is meant as "look at this neat feature of how the boxes/numbers are set up: 1 change can ensure success!" Interestingly enough, the "malevolent guard" scenario is just "the opposite", but turns out more complex. Either way, as I understand it, those are all "interesting facts", not the original problems.

I believe the guard only has to switch two boxes but has to check more than that.

Okay I was really confused about the part that says your number is guaranteed to be in the loop but now I get it. If your number is say, 43, then the loop will be open until you open the box that takes you back to 43, the first you opened. There's no such thing as closing the loop, without opening the box that leads you to the first box you opened. Hope that makes sense.

"your number is guaranteed to be in the loop" by definition. A loop is formed only when the number slip pointing to the starting position/box is found.

Where people are getting confused is in language. You ARE guaranteed to be in your number's loop. You are NOT guaranteed to find your number in the loop within 50 searches,. That's where the probability factor comes in is in the limited times you are aloud to search. The more boxes you are aloud to search, the longer the completable loops can be. If your number is in a loop 67 boxes long and you can only search 66 boxes you won't find it in time but if you were aloud to search 67 boxes you'd find it! The only way to win is if NO loops are longer than the number of aloud searches. Which is apparently 31% of random permutations of number placements.

An easier way to get the point across is that you can't short circuit the loop by closing it early because the same number can't be in 2 boxes... 1, 7, 55, 18, 7 is not allowed because then 7 would be in 2 boxes...

Yes it does make sense, sometimes you have to open all of the available boxes to come back at your starting point, but the loop always closes. Also: A loop cannot end in the wilderness nor can it short circuit itself somewhere halfway.

Your explanation is definitely clearer and easier to understand. Thank you so much, now I can have a peaceful sleep.

What people don't seem to get is, that you choose the box with your number, so you can only come back to it by finding your number on a letter. If you start the loop on your number, it can only end on your number.

I actually find this concept very intuitive. We've played what we call "The murder game" in church camps many times and it goes like this: You write the names of all participants on pieces of paper and hand them out randomly. For the next days your goal is to kill the person you got by handing something to them. If they take it, they're out and your next goal is to eliminate the person that they were onto. Eventually you're gonna kill the person who was after you and end up with your own name so you win. And it happened very rarely that there was only one winner meaning only one loop in the whole group. Cause how probable is it that all the names line up perfectly? So I was already familiar with the thought of those loops and instantly knew what you were up to once you told to open the box with your own number.

@Fabri Very cool too! In Europe we have the game Werwolf that works similar, just that there is more Wulfs/Killers. And to fight them the other people get a bunch of cool powers like healing or being able to see the the identity of one person per night. Big hit.

@Christina Busse I’ve also been to church camp and we had a similar game called “Mafia”. every participant is seated in a biiiiig round table. they all have to close their eyes, and then someone (usually a guide, not a player) will randomly pick 2 people: 1 cop and 1 killer. the killer can execute if he does a wink at his victims. BUT, if he accidentally winks at the cop, he’s caught and everyone else win. the tricky part is that, once the game start, everyone has the right to accuse someone of being the killer (without revealing your own identity, of course). then, there’s voting to determine, at certain points, whom is eliminated. if the killer is eliminated, everyone wins. if the killer take out everyone (by either voting or wink), he wins. so even though is not with probabilities or stuff, it’s still a really good game because everyone start blaming everyone and you really don’t know whom is who so it’s really fun

@Fabri Depending on the group from 8 up to 40 people. You play it over the course of a few days while you're going along your usual programm. In the beginning everyone is super aware of not taking anything someone is handing them. Friends are daring eachother to take stuff from them cause only the person with your name can kill you and "what are the odds". As hours and days pass people start to forget about the game making it easier to strike, but don't try to obvious or they'll know it's you. It's so much fun!

how many people played that game?

This is magic of maths and probability. Great video and analysis of this problem.

I think I understand it in a way that makes it simple to explain: Going from slip to box label eliminates any chance of randomly picking a box with a slip the same as the box number. With those out of the way, your chances are higher. Going from slip to slip keeps making your chances better because you know you won't pick two boxes with their slips switched around, and so on and so forth.

No, it doesn't quite mean that - nearly, but not completely; because you could find your own slip in the first box you open, the one with your own number on the outside. But that's OK, not a problem at all. What you can't do, you're right, is find the same slip and box number together for any of the other prisoners' numbers - which is one of the consequences of the strategy. it makes sure that every box is opened by at least one prisoner and that does, as you say, improve their chance of survival compared with random picking - although that improvement is not additional to the increased survival chance provided by the strategy.

This channel is amazing. It reinvigorates my interest and curiosity about rational thinking and mathematics that my father instilled in me decades ago. I didn't really ended up practicing those muscles in my life but they are still there.

It makes me miss high school/uni math and I regret I didnt go to math school

I actually think that this is quite intuitive once you hear it. I didn't know it before, but as soon as I heard the following the loop part of it everything made sense.

I feel that "Metersen's colleague" should definitely get at _least_ a name check here! So, hat tip to Sven Skyum, reader emeritus at Department of Computer Science, University of Aarhus.

@Jesus Saves! so when's the last time you LITERALLY went to scientists to prove to them how effective your prayers have been?

That's a pretty cool name. Sven Skyum.

Your worries (yes, anxiety), depression, suicidal thoughts, EVERYTHING will melt away and be NO MORE when you lean on God and put your trust in him! When I have physical pain, I literally pray and the Lord quells it, that I am healed!! Know that there is power in the name Jesus Christ! His name casts out demons and heals! People are bothered by his name. The world hates the truth and wants to continue living sinfully! God's children are set apart (holy) and righteous.

Hey! Did you know God is three in one!? The Father, The Son, and The Holy Spirit! Bless him! Jesus died for our sins, rose from the dead, and gives salvation to everyone who has faith in him! True faith in Jesus will have you bear good fruit and *drastically* change for the better! Have a blessed day, everyone!! ❤

I'd love to know the process by which Skyum arrived at this answer. Years of work in a field where this kind of "loop" structure has been studied already? Flash of inspiration after a night of pizza and cola? Or was it an immediate "well, duh..., isn't it obvious?" savant-level intuitive grasp? That's as fascinating as the original riddle.

What is the probability that all 100 prisoners understand and follow the instructions? The calculation assumes 100%, but if we ran trials with random participants, it would not be nearly that high no matter what the incentive or how well it is explained to them because people are bad at following instructions. If I were in this group and we had unlimited time to strategize, I'd be drilling every person to make certain they knew the strategy and how to properly execute it.

I'd love to see this in an actual experiment lol

This is a really cool strategy to boost the probability up from random chance that much, and I didn't expect the probability to change so little as the number of prisoners in the puzzle increased. My followup question is, is there a way to prove that this is the optimal strategy, or is it possible there's a better one? (Of course, as people pointed out here, if this was a real situation there would also be the issue of convincing everyone to follow the strategy - IIUC even one person deciding to choose at random immediately halves everyone's chances, even though their individual probability doesn't change. So I think this strategy is also pretty good for that because what an individual has to do is pretty simple to explain, even if the reason it works isn't so simple.)

@Flame of the Phoenix you are correct this would work without communication. But it is not possible to combine this with the strategy in the video. It enhances the odds of of picking the right box by 20. Which makes it good compared to random guessing but extremely bad compared to a ~30 percent chance using the loop strategy

@David James They don't need to communicate.

@Flame of the Phoenix Communication in ANY way is not allowed according to the rules.

@Kieley Evatt If you spent long enough I'm sure you could find a way to implement this into a strategy.

@David James They don't technically know that he found his slip, but if he didn't there's no point in trying anyway, and so assuming he did not, would be assuming you lost. In other words, yes you do know that he got his slip.

I was intrigued when Derek talked to three different people about the problem, but then it was quite sad when I saw only one of them appearing for the rest of the video.

you've got to admire these mathematicians for thinking out of the box

POV: YKW

@Pluto : With all do respect for your opinion, my opinion is that gender studies don't solve any problems but rather create new ones. But I won't be posting this on a video about gender studies because it would be rather disrespectful. If you don't enjoy maths, no problem, just don't watch video's on the subject matter.

@Gamina Wulfsdottir Slipping could save your life in some situations though.

The danger of thinking outside of the box is that you might slip.

ba dum tss

Lmao, imagine a 50 length loop giving 50 people a heart attack.

@Bruce Ricard Imagine every prisoner getting to box 49 and having a heart attack from anxiety.

You could have 2 loops of length 50.

This is quite interesting I'm curious as to how it may apply in a daily-life scenario.. perhaps one 'Game of Chance' 😅

Alright I'm putting a wild guess as to the strategy right now before I watch the rest, if the first guy looks in the first half, and finds his number there's a slightly higher chance that the second guys number is in the second half, this is because that means only 49 cards in the first half could be the second guys number where as 50 cards could be his in the second half, and since you know that if his card wasn't in the first half you'd be executed anyway you can go ahead and assume they're in the first half. While I still think I made a good guess, after all you have to assume the previous prisoner got it correct whether he did or not, but I'll admit you made a better method. Having enslaved a computer to calculate the odds it seems like my method though not the most effective is around 20 times better than just guessing.

Thanks so much legend !! Literally the only tutorial that actually WORKED!

To be honest, I didn’t struggle with understanding the strategy, or how the loops work. I was confused about the 31%, but after you explained that this all made a lot of sense, and it’s really fun maths.

It's really just about the fact everyone has the same 100 boxes.

Cool, I was confused by all of it. Still am, but I was, to.

@Nimrod - all geeky things oops, totally missed that fact…thanks. So you are saying that if the ratio of total boxes to box choices is above two, it is no longer able to be approximated by the area under the curve 1/x?

@Avana Vana it fails for ln(3) because the integrating function is wrong. The formula of 1/x only applies for half or more, so you would expect any ratio from 1 to 2 works. For anything more than 2, piecewise integration has to be performed and the ratio should not pop out this easily.

@Nimrod - all geeky things right, that is obvious, but what I am saying is that doesn’t apply for ratios beyond 2, for example, if 50 prisoners choose 50 out of 150 boxes. 1-ln(3) does not yield a probability that makes sense in the real world. It does hold for the simple case of 50 prisoners and 50 boxes, since 1-ln(1) = 1, ie 100%.

Best ever! I feel like this is more "fascinating" than it should be regarding the fact that the probability of success converges with an increasing number of prisoners. I'm challenging myself to come up with an intuition-based analogy where this will seem more obvious.

You would be a good teacher, your explanations are very straight forward and easy to learn.

This makes sense. It reminds me of two things. Family Christmas gift giving, and an encouragement thing my grade 4 teacher did a few times during the year. I would have never guessed the answer, but it does make sense to me.

strategy 50% find their number. With the loop strategy. The only ones that don't find their numbers are the ones in the biggest loop if it's bigger longer than 51. So in 1 case in

Is there a time limit on the room? For what I can gather, it you have time to complete the longest loop in there, you also have time to just strategically open every box until you find yours?? Am I going crazy?

What happens if prisoners decide to swap 2 boxes (in example 1=100 and 100=1) and then use this string strategy? That would mean 70% time they have a good change to cut the too long string and 30% of time they has small change to cause too long string. For me it seems like they would double their changes to survive.

Assuming you mean before prisoner one begins it all? because the rules don't allow moving the boxes once the exercise has started. Swapping two of the boxes would make no difference whatsoever; you could swap as many boxes as you like, redistribute the numbers inside, none of it would make any difference at all.

The way I like to think about the solution: you're no longer betting that each individual prisoner will find their number with a pattern that they choose (arbitrary or intentional), but you're betting on the probability that a pattern (a loop exceeding a length of 50) does not exist in the set of boxes. And that's a static property of the set you're betting on, in contrast to rolling the dice every time on 50 different prisoners. So, in a way, you've already succeeded or failed by choosing the loop strategy, whether you know it or not. Random chance no longer has anything to do with the prisoners' choices (unless they mess up the execution of the loop strategy), but entirely on how the box set is arranged and the loop strategy that the prisoners decide to employ at the start. Fascinating mathematics! Thanks for sharing this!

False. Random chance has everything to do with whether or not all loops are

@Kevin thanks for the details, there are too many complications with this model that would give it any kind advantage. While there is a pattern from following the key/value pair, it's not a useful pattern, in fact it's still just random. A loops (an array of key/values) maybe be small or large, in the end it makes no difference to the overall issue - esp since there is no feedback loop to the next iterator (prisoner)

@blue dark the idea is that the boxes and the numbers that they contain is a closed set. All you're doing is shifting (or shuffling) the numbers around. So when you start with a box and follow the number inside to find you next box, you will EVENTUALLY find another box containing a number that points to the box that you started with. Basically, you've done a loop Now that loop might be greater than 50 boxes, in which case, the prisoners lose. That loop might even be 100 boxes! But the point is that you're taking advantage of the probability that your set does or doesn't have a loop too large. You are strategizing based on what you know about the set, even if you don't know exactly how the set was arranged. This is why your chances of success are far better than each prisoner randomly choosing.

I LOVE THIS KIND OF VIDEO SO MUCCH. I wanna tell my fellow Veritasium-Fans to check out other Science-Channel, like Nile Red, Sci Man Dan, Planarwalk, and so many more, but this brings its own Riddle/Problem: The more often i comment, the more likely i get mistaken for a Bot. The higher the chance someone takes my earnest, honest Try to spread Science as what it is, the lower the Chance! And thats not even mentioning TRshowrs like "Some More News" who i would argue is No Science but totally made for those with the 'Profile' of Science-Fans/Good-Thinkers. Not just Crops, Hate, Food-Shortages and especially-intensely-in-need-of-being-checked-out: The GOP-Videos and Human-Right-Awareness-Spreading. But recommending Science-Fans a kinda political Channel brings its own... ya know... I would argue that Channel is made for all who wanna be updated, its a Source of Infos, truly. But one can always argue against that. What do you think of my Comment?

@Craig thats why i like veritasium cus he says how difficult it is can still be proven with strategy.

Now imagine you being the one mathematical genius among all those 100 prisoners and you have to explain your strategy to Every single one of them and nobody believes you.

In simple terms, the reason this may be the best strategy is that it absolutely eliminates the risk of encountering the kryptonite of another prisoner’s 1/1 loop windfall, hence every box opened is guaranteed to be a potential strike.

(The discovery of the first box’s number closing the loop, where the possibility of discovering the second (or third…) box’s numbers is entirely eliminated)

I didn’t expound correctly on what I observed, but what I had noticed to be significant is that it does that in step one, and then eliminates the arising potential of opening a second (or third…) box that has within it a number that matches any previously opened box - of which there is a higher probability and would equally comprise a lost opportunity that could have been avoided 100/100 if this strategy were followed by all. This pathway ensures positive elimination upon every opening; as each paper number found guarantees that it’s corresponding box would certainly be a potential container of the sought after paper number, upon the certainty of that box not having within it the possible 1/1 of another prisoner, or the number corresponding to the / all prior boxes checked.

It is the best strategy, yes. The reason for that is not as simple as eliminating the chance of picking another prisoner's 1/1 loop, although it is true that the strategy does that.

2:43 in, trying to solve on my own. so my first thought is that the first prisoner's odds of success are 50% no matter the strategy which means the 2nd prisoner's odds of success must be much greater if this is the case then I'd argue some strategy like arranging the slips in the boxes in sequential order and having the successive prisoners estimate the location of their slip based on that before using the rest of their box checks to rearrange most of the other half, or in the event that their slip is not in the first half, to search most of the other half to find it. This way if a random 50% are in the first half then prisoner 2 should be able to check the 1st and 2nd boxes and know based on that whether his number is in the first 50 or last 50, and then still has 48 or 49 checks left. or if prisoner 1 checks box 1 and finds a slip with a different number then he checks the box corresponding to that number and continues for 50 boxes then moves each slip to its proper box, starting over with some other box if he completes a loop Then prisoner 2 comes in, checks box 2, and if he finds his number proceeds to check successive boxes until he finds a box with the wrong slip and follows the procedure prisoner 1 did or if he doesn't find his slip then follows the procedure prisoner 1 did until he does.

dang, I was wrong. I guess my solution counts as breaking the rules of not leaving the room the way it was when you entered but at least I was on the right track that the loops had to be part of the solution. I just didn't think about it until he mentioned the loop sizes that no rearrangement was necessary to get odds so close to 1/3rd and my assumption that the 2nd prisoner's odds of success are higher was wrong since it's not that they're higher but rather that they're very likely shared

What i love about mathematitians is, they'v got the brain to turn numbers in every ways possible , finding astonishing strats, yet , they'v got the hardest time explaining why it works... In this cas , the trick is not explained by math , it's explained by how you think about this problem. If they choose the loop strat , prisoners do a bet, they bet there is no loop longer than half their number, in our case 50 for 100 prisoners. Thus if they win their bet , they will all find theyr number. but if it happen to exist even one loop longer, they'r all fucked. the question is no more, "are they able to find their own numbers" but: "is the random assorment of number in the box including an over 50 loop". if your mind continue to think about the first problem it can't seize how the loop strat shifted the problem. first statment, how can they all find the good box second statment , please make it that no 50+ loop has been created in the first place. it's a good exemple on how the riddles work, they focus your ming on one point of view wile the answer is clear if your shift how you lokk over the riddle :)

Imagine coming up with this massively smart idea and still only having 31% chance not to get executed.

@Roskal Raskal they are gonna die either way. It's not possible. Their best strategy is to find a way to not even get in this deal. I have had 50% chances and still lose consecutive times. Just do head and tails, do it until you fail. You won't get far even with 50%.

@Ducky Momo Exactly. If every prisoner gets to open 99 boxes, then the purely random strategy succeeds with 37%, while the loop strategy succeeds with 99%.

the limit of 50 is arbitrary. if you increase that it goes closer to 1 and if you decrease that, it goes closer to 0

@IHateUniqueUsernames Framing effect. lol

@L.F. M. For each person who opens 50 random boxes vs uses the strategy, the chance of succeeding goes down by a half. If one person decides to open randomly, you'll all have a half of 30% chance of success, or 15%. If there are two, then half of that, so about 7%. If 10 I would think 31% * (1/256), or a fraction of one percent. Having a few people be idiots doesn't totally ruin your chances, but much more than 10 and you're better off trying to win the lottery.

i think i know the answer really : the prisoners will be able to all find their numbers if the ones that made the riddle want them to be free, seeing as this is the highest percentage for finding their number using this particular strategy then this is the strategy the ppl that made the riddle devised, and they planted the numbers accordingly, but if they dont want them to win then they'll prob randomly place the numbers

I feel like the biggest problem would be trying to convince every other prisoner to follow the strategy.

of next prisoner, he leaves the room after a long time. 5a. Next prisoner searches the same set of boxes as his successor. 5b. Next prisoner searches the other set of boxes.

I’ll remember this on my next sentence in prison. I have a feeling, though, that explaining it to the inmates will get me beat up (or worse).

Oh hey, it's pretty much thinning out a 100 card singleton deck. Experienced TCG players will be quite familiar with this. It's an exclusive pool that decreases via elimination as you draw cards (or in this case numbers), so your pool goes 1/100, 1/99, 1/98 so on and so forth. Or in our world "Where the hell is that one combo piece in my edh/100 card highlander deck".

strategy is a way to synchronize the wins and fails

This is actually, in my opinion, the least controversial thing he has posted in a while. Good work. This makes alot of sense to me, I would never have thought of it but it works

@ILYES The Monty Hall problem is just maths and is pretty controversial too. I remember everyone going crazy in the comments after that Numberphile video

@ILYES spoken like someone who knows nothing about math

Correct! The beauty of math is that there cannot be controversial things. Math and logic are the final judges, deciding which is right and which is wrong. If you read carefully the comments, no one is questioning the strategy, they simply complain they cannot understand it.

@magica that’s a pessimistic view.

A lot. Two separate words.

What would happened if all prisoners make a deal to go to just one box starting by box 1 and change the content of the box with the right box number. Eventually by the end of the experiment all of them will know that their number inside the box is the same as on the box. Who would know that they changed anything? Beauty of quantum physics ;)

If the prisoners were smart enough to figure out this strategy by themselves, and given that they’re prisoners, as in, committed a crime, maybe they shouldn’t be set free lol.

The best solution is arguing cruel and unusual riddle-based punishment and having their sentences reduced

One thing really interesting about this problem to me is that there are 100! = about 10^158 unique arrangements of the 100 slips in the 100 boxes. No single computer can check all of those in any reasonable amount of time, however we don't have to. The beauty of Monte Carlo simulation is for something with fairly high probability like this (over 30% in this case but even something small like 0.03% would work too), we only need to take a tiny random sample to get a good approximation of the correct (exact) mathematical answer. Even as few as 100,000 = 10^5 is enough to get an approximation of about 31% for this prisoner riddle as stated. My simulation program takes about 0.15 seconds runtime to simulate 100,000 outcomes/decisions and about 1.5 seconds to simulate 1 million outcomes/decisions. The problem with Monte Carlo simulation comes when the expected probability of what we are trying to simulate is super tiny. For example, if we simulated 100,000 outcomes and got 0 "winners", what conclusion can we draw? What if we re-ran the simulation and then got 1 "winner"? Our results would still be inconclusive. This is why math and computers are both useful to solve these types of counting problems because they help complement each others weaknesses / limitations. Not all people know how to solve counting problems mathematically.

Alternative explanation for why you're guaranteed to be on the same loop as your number: Keep in mind each slip only exists once. If you start at the box labeled with your number and follow the loop, the only way you could NOT eventually find your number is if you come across a slip pointing you to a box you've already opened, which of course leads you on the same path you've already been on, trapping you in an infinite sub-loop. But that is impossible, because that box you would be pointed back to was already pointed to by the slip you found just before that, and you can't find that same slip again. The only way you'll be pointed back to a box you already opened is that it's the box you started with, because you went to that one without having found the slip that points to it yet.

@serhan cinar How Prisoner54 ended up opening box 36 if there's only one box containing slip 36 (box 45)? It's impossible

@serhan cinar Well, he was supposed to open the box labeled with his own number, 54... That's part of the whole strategy. If he doesn't do that, then yeah, there's no guarantee for him to be on the correct loop.^^'

Let's say Prisoner54 opens box 36 contains slip 45, then opens container 45 which contains slip 36... Prisoner54 is out of the loop. How come he is guaranteed to be on the loop?

ah thank you this made me understand it

you made me understand it

This actually makes me think of running Secret Santa gift giving :)

I’m still a bit confused about when you explain that every number is on a loop with it’s own number. If the boxes are randomly assigned, wouldn’t that create independence between two? Your example seems to link them and negates that. I’d be curious to run a simulation in Python to see how this actually plays out.

@Abdullah Waris Because there aren't any duplicate slips. If prisoner 1 sees 2-3-4-5-6-..., to make a subloop would mean they'd need to see one of those numbers *again*. For example 2-3-4-5-6-3. But there are no duplicate "3" slips. When opening a new box, the only possibilities are either seeing a number they've never seen before, or seeing their number.

@Yassine B. Why can't there be a subloop that connects to a number the prisoner had encountered after his own number

@Chris Jones It's less complicated than even that: the smallest possible cycle of boxes is 1, where it has it's own number in it. The next smaller cycle is two boxes, where box A contains slip B and box B contains slip A, completing the set. It scales in this way all the way to a cycle of a hundred boxes, and every single set has its own number in it (any group of boxes that does NOT have a slip number for every box number is not fully counted and is incomplete, it does not cycle).

IMO he doesn't explain this part well. It's the combination of two facts. FACT ONE: every permutation can be decomposed essentially uniquely into disjoint cycles (why? the naive process of making them works). FACT TWO: the cycle with your box number also has the box GOING TO your box number (why? because THAT'S WHAT IT MEANS TO BE A CYCLE).

I mean, disproving your intuition should be easy in this case. Go ahead and specify a loop that contains the chosen number on the box, but not anywhere on the slips inside. You can't. The largest possible loop with your numbered box is all 100 boxes, which must contain your number slip. The smallest is 1 box, which contains your number slip. The loop can't terminate until you get back to that number, it's the only end condition (that's what a loop is). What number box are you going to put your numbered slip in? How are you going to terminate the loop, without leading back to your number?

Interesting problem, thanks for sharing!! I just don‘t get why the probability for one singular prisoner remains at 50% with the loop strategy. Isn‘t it entirely dependent on the random loops and should then also be around 30%? or what is the probability for their number being not in one of the larger loops IF a larger loop exists… plus the probability of there being no larger loops. my head hurts. can you tell me?

The probability of you getting heads or tail is 50%, right?. Now the probability of getting heads 5 times in a row is much smaller. Similar here. 50% is the probability of a single individual. 30% is the probability as a whole group (using the loop strategy of course) of everyone getting finding numbers in a row.

It should be clear that one prisoner still has exactly a 50% chance whatever strategy is chosen because they are opening 50% of the boxes without having any way to tell where their number may be. To understand it in the context of the loop strategy you get the following picture: With 31% probability there is no loop of size > 50 and the prisoner is guaranteed to succeed to find their number With 29% probability there is a loop of size > 50 but the prisoners number is not part of the big loop so they still succeeded nonetheless With 50% probability there is a loop of size > 50 and the prisoner is part of it, failing to find their number.

Try to find the probability of failure, i.e., there is a loop with N(N > 50) and you are in this loop.

Well, to be fair - I didn't knew about loops and stuff, but the only solution that I thought about - was to open your cell number and follow numbers, without knowing that this is the solution and how it works...

Incredible video, as always. 👏🏻👏🏻👏🏻

be solved. In the end we get back to where we started. If the cycle contains all pieces we are done memorizing. But most of the time there are more than one cycle...

What happens if we use the loop strategy but starting with random number(s) ? It feels like you possibly raise your chances of landing on a shorter loop to your number, is it compensated by the risk of "passing" your number or burning your chances on wrong loop(s) ?

If you use the loop strategy but starting with a random number then there are two big potential problems; (a) you make it less likely that you find your own number, because you are not guaranteed to be in a loop that includes it, (b) you might open a box that has its own number inside, meaning you will be forced to make another random choice (this might happen more than once); any additional random event always reduces the probabilty of you finding your own number compared to adhering to the strategy. The strategy is optimal, given the rules of the exercise; any deviaton from the strategy will only reduce the prisoners' chance of survival.

Your designated starting number has exactly the same chance as any other, randomly chosen number to land on a short loop so you would not see any effect in that regard. But you would reduce the coupling between the prisoners and thus the survival probability would drop as a result. The original paper actually proves that you can not do better than with the presented strategy, so most modifications to it will actually be detrimental or at best equivalent.

This is probably the only time I've found calculus to have been worth learning

Why it seems so unbelievable is that we assume success in the task while there is only 1/3 chance of winning. What would be probability if each prisoner opens the next 49 boxes after their number box, that would also be better than random selection

Why would the next 49 after your own box be better than random selection? You still only have a 50% chance of your number being in the boxes after yours.

Making a strategy and not communicating with one another is kind of complicated since you can communicate the end result from the strategy that you build. Prisoners can all check Their box (and the rest 49 consecutive boxes, although unnecessary*) and position themselves at the exit on the corresponding position of the number that they found in Their box. For example if in box 1 was the number 99 he would position his body on the exit at a place corresponding to 99. They could also have done this before they get in. After that they all would know in which box their number is in and this will always have a 100% chance of letting them go. *it’s only interesting to check the rest of the 49 boxes so you can position yourself at the right location in the end fix a better formation so it can be read easier at the end. Another idea was for each number to check the next 49 boxes for example prisoner 91 would check 91-41.

Writing a research paper and still telling the reader to figure it out for him or herself is peak professor energy.

@Rinnegone Happens sometimes. I'm guessing either they were removed individually, or the accounts have been poofed. 🤷♂️

Why are the replies gone?

1:46 Imagine it would have been a 1. Then it would have been practically impossible

Loved it. This would be a great example for students that rely on perfect theoretical situations and math to illustrate how it all goes wrong when you leave out the common sense. In theory, the math is beautiful and clever, but in the real world, they're doomed. Cooperation? Trust in a plan most don't understand when their life is on the line? Following the rules? Not high probability characteristics for prisoners... or even people in general. X number are doing to do their own thing and blow the plan, and that definitely goes up with more people. Wonder if there's a parallel world out there where they have no climate problems, war, or food insecurity because some sadistic mathematician has created a filtering squid game.

@Dark Ale Hooray!

It's very easy to replace the prisoner situation with a more "believable" situation that has the same underlying rules. For example instead of prisoners you could just have contestants in a game, and instead of making it a punishment upon failure, you could make it a reward upon success (like everyone wins $1000 dollars) to encourage everyone to work together. Worrying overly much about the setting is kind of missing the point.

I find this easy to accept. I feel like most people that are confused miss the part where each prisoner is allowed to open 50 boxes.

opens box 1, has #50 in it, opens box 50, has #1 in it... this theory is based on a guaranteed loop system and is flawed.

set. Now the change is 50% iso 30.x%, just like timing in Spectre/Meltdown. P.S. I see now I’m not the first one with this idea…

Math is great if you can understand it. Personally it's not my strong suit, so I would just tell the prisoners to ignore the numbers on the boxes, and check the 1st 50 boxes they get ahold of. Place the numbers in a 10x10 square with their true value so the rest can find them without guessing.

Senden Daha Güzel

görünümler 338 B

pyguyAylar önce