Going Null
Going Null
  • 2
  • 115 908
The Coolest Hat Puzzle You've Probably Never Heard (SoME2)
#SoME2 #SummerOfMathExposition
Of all the various hat puzzles/riddles out there, this one seems to be one of the least well known, despite being, in my opinion, one of the best. Let's change that!
zhlédnutí: 103 580

Video

The Most Amazing Fact About Light Switching Puzzles (SoME1)
zhlédnutí 12KPřed 2 lety
#SoME1 #SummerOfMathExposition In the classic Lights Out game, you get some starting light pattern and you have to turn all the lights off, but it turns out that the game creators had to be careful to make sure that they wouldn't present you with an unsolvable starting pattern. I'd like to show you a variation of Lights Out called Lamp Lighter, where all lights start off and you have to turn th...

Komentáře

  • @AZALI00013
    @AZALI00013 Před 4 měsíci

    i think this may have been my favorite video in soME2 !!!! thank you so much for showcasing this problem, it was an amazing watch :)

  • @ccoodduu
    @ccoodduu Před 4 měsíci

    Great video, saw a reel about this and really wanted an answer to how it worked. And you explained it really well! :)

  • @cmilkau
    @cmilkau Před 5 měsíci

    So you have 10 guesses, as we can see the other hats we can assume everyone guesses the whole setup rather than just their own hat. Among those 10 guesses must be the correct setup. So ideally, we split all 10¹⁰ possibilities into 10 categories, and assign each prisoner one of those categories to cover, in order to maximize chances. We should also ensure that whatever the prisoner sees, there should be one and preferably only one matching example in their category. This reminded me of error correcting codes, so how about we make every prisoner ensure that the sum of all types in their guess matches the prisoner's own number by the last digit (ie mod 10). Clearly that's always possible in exactly one way for each prisoner. Now the sum of types in the correct answer must have a last digit, and there is a prisoner assigned to that digit, so that prisoner will be correct.

  • @cmilkau
    @cmilkau Před 5 měsíci

    If they announce one after another, they can just agree that the first says the type of the second and the second repeats, so I guess they have to announce all at the same time.

  • @cmilkau
    @cmilkau Před 5 měsíci

    Just random guessing already gives them a 65% chance to win

  • @cmilkau
    @cmilkau Před 5 měsíci

    It's important to state whether they need to announce their type at the same time or one after another, and in the latter case whether they can hear the other announcements.

    • @goingnull6028
      @goingnull6028 Před 4 měsíci

      It's stated twice that they need to announce at the same time.

  • @echodolphonian5729
    @echodolphonian5729 Před 7 měsíci

    I feel like this guy took the problem and tried to make it simpler, but just made it harder

  • @homareyoshi4194
    @homareyoshi4194 Před 7 měsíci

    I think the first prisoner can look at the 2nd one and then say the cap then 2nd will copy??? Or did I miss a detail Anyways, congrats on SoME2!!

    • @goingnull6028
      @goingnull6028 Před 7 měsíci

      You missed that all the prisoners have to answer simultaneously.

  • @kaizenyasou6963
    @kaizenyasou6963 Před 8 měsíci

    Wow dude 👏👏👏

  • @LetsGetIntoItMedia
    @LetsGetIntoItMedia Před 9 měsíci

    Amazing video! You gove hints so well, guiding the viewer towards and answer without ever giving it away. I personally did not get the answer before you revealed it, but one you revealed it, it immediately clicked. You laid the foundations very well The parallela you drew to probably, and making the sets disjoint was so cool! I haven't seen anyone else draw that connection before 👏

  • @phuntshogayenden3577
    @phuntshogayenden3577 Před 9 měsíci

    I can't help but think, how can you find the sum, when you don't know what your hat (and thus its value) is?

    • @goingnull6028
      @goingnull6028 Před 9 měsíci

      You can't. But you can sum all the other prisoners and figure out what number you would need to be for the total sum to have a particular final digit.

  • @genarator
    @genarator Před 9 měsíci

    the most entertaining type of life is to be a prisoner in a math puzzle

  • @willchen3185
    @willchen3185 Před 9 měsíci

    this is reminiscent of check digits in error correcting codes.

  • @Zicrus
    @Zicrus Před 9 měsíci

    13:55 That is literally the sum of the parts tho xD

    • @goingnull6028
      @goingnull6028 Před 9 měsíci

      Never looked at it that way :) Sum of probabilities is not sum of people. I guess if the prisoners were acting individually, then the problem is that the probability would not be the sum of its parts. The irony.

  • @epikoof
    @epikoof Před 9 měsíci

    damn i feel stupid

  • @rosiefay7283
    @rosiefay7283 Před 10 měsíci

    1:28 If this becomes an issue, you could avoid it by having the hats all the same shape but marked with different numbers, say.

    • @goingnull6028
      @goingnull6028 Před 10 měsíci

      I know. Just trying to keep things fun.

  • @hadesisbetter
    @hadesisbetter Před 10 měsíci

    I finally solved it!!! I watched the beginning of this video a while back and stopped watching after hint #1. I was determined to solve it without watching further. I looked at things a different way then you did, but ultimately ended with the same result and concept. Probably my favorite riddle now, great vid!

  • @ladeanadockery6220
    @ladeanadockery6220 Před 10 měsíci

    Wouldn't an easier method be to just have each prisoner guess ANY hat they can see? The second to last prisoner guesses the only hat he sees and the last prisoner guesses that again which would be a guaranteed win. (Of course, someone could accidentally get it right earlier.)

    • @goingnull6028
      @goingnull6028 Před 10 měsíci

      Please review the conditions of the puzzle carefully. They all see all the other hats. The catch is that each prisoner must state the guess for his own hat simultaneously with all the others, so prisoners can't rely on other guesses for anything.

  • @gdlifesteal5824
    @gdlifesteal5824 Před 11 měsíci

    Its amazing what a common goal and set deadline can do when you witness it like this. SoME2 has let so many creators grow and so many amazing videos to be created, and this is no doubt one of them!

  • @vamer423
    @vamer423 Před rokem

    "you won't know which one you have" Me: B-but what about the guy wearing headphones YOU WONT KNOW WHICH ONE YOU HAVE !!!

  • @TheRealMRTS
    @TheRealMRTS Před rokem

    Man I was so close. Immidiately converted to numbers, figured out solution for two and when trying to figure out for 3, realized each prisoner needed to cover 1/3 of the possible space. Had a feeling modulo would be involved in the solution but could not figure out the specifics. My problem was starting the video late at night so I was to tired to finish but would not be able to fall asleep if I didn't the solution 😢

  • @leopoldbloom4296
    @leopoldbloom4296 Před rokem

    this is of course you can memorise and numerise non-similar entities under life-threatening conditions

  • @wilhelmschmidt7240
    @wilhelmschmidt7240 Před rokem

    I'd like to see an actual test of this solution... Providing there doesn't have to actually be people imprisoned for it.

  • @sachinkumarmishra100

    What if their strategy is that first prisoner will speak out the hat type he sees at least one other person wearing, then everyone will also say the same hat type. So at least one of them will definitely get it right

    • @goingnull6028
      @goingnull6028 Před rokem

      They must all answer at once. See the conditions at the beginning of the video.

  • @AlexE5250
    @AlexE5250 Před rokem

    Please make more videos! These are really well made and throughly explained. And this is a very interesting puzzle too! After watching this I though for sure you had tons of subscribers and had been making videos for years. At first I was disappointed to learn this is only the second video on your channel. But I’m kind of excited to have discovered you so early!

  • @pXnTilde
    @pXnTilde Před rokem

    > Be the only prisoner > See a hat sum of 0 > Need a remainder of 1 > Guess hat 1 > Go free > Get labeled a witch > Get Robloxed > MFW

  • @tmjcbs
    @tmjcbs Před rokem

    Nice puzzle! IMHO the rules of the puzzle would have been easier to explain (and the puzzle would be essentially the same) if it was about identical tall hats having a random integer from 0 to 9 on them. Perhaps it's a bit easier as you don't need the mapping back and forth, but the math needed is the same...

    • @goingnull6028
      @goingnull6028 Před rokem

      Possibly. It was an artistic choice, and I'm no artist :)

  • @lpsp442
    @lpsp442 Před rokem

    Pausing the video at 2:41 to post my answer to the simplified riddle: Player A declares the opposite of B's hat, and B declares the same as A's hat. This guarantees at least one correct hat matchup no matter what combination of hats they are given.

    • @lpsp442
      @lpsp442 Před rokem

      Feels good to see it's the right answer 😁 But I have no idea how to generalise it to even three people, let alone ten! Is it as simple as forming a ring? Or maybe one person acts as a single "reference" hat and everyone either agrees or disagrees? Maybe it's based on the majority of observed hat types?

    • @goingnull6028
      @goingnull6028 Před rokem

      Hint: The necessary mathematical structure is even simpler than a ring.

  • @afraidcone
    @afraidcone Před rokem

    I love a good complicated math solution, but as soon as you said the solution for 2 people I had a different solution that asks one person to "guess" theirs by telling the person to their right. Even if the king decides to go in a random order, I like to hope that person can remember long enough to guarantee everyone's release. But, as a failsafe, for every 2 more prisoners in the group, everyone is free once more.

    • @goingnull6028
      @goingnull6028 Před rokem

      See the requirements again. The prisoners have to say their answers all at once so there is no way they can communicate.

  • @fits4390
    @fits4390 Před rokem

    In trying to solve this riddle, I actually found that the solution given in this video is a special case of the general winning strategy. Of course, there are N! possible ways one can assign numbers to hats (and prisoners), but even accounting for all of these strategies (if you even consider them different strategies), they are still a small subset of all possible winning strategies. The general winning strategy is actually pretty simple, if tedious. Here’s all the prisoners need to do: create a list of all possible configurations of hats, then to each configuration assign a prisoner who will be guaranteed to guess correctly. The only requirements when making this list are, one, every configuration has an assigned correct prisoner (duh), and two, that there exists no prisoner p who ought to be guaranteed to guess correctly for more than one configuration in which the configuration of hats visible to p is identical. For example, if N = 2 and prisoner Bob sees that prisoner Alice is wearing a black hat, we cannot require that Bob guess correctly for both configurations in which Alice is wearing a black hat (i.e. the configuration Bob: black hat, Alice: black hat, and the other configuration Bob: white hat, Alice: black hat). Once an acceptable list is made, copied, and distributed to all the prisoners, when it’s time for the prisoners to write down their guesses, they just consult the list, find the N configurations that match the configuration visible to them, then find the configuration in which they are guaranteed to guess correctly, see what hat they’re wearing in that configuration, and guess that hat. It’s true that there’s only a 1/N chance that any specific prisoner will guess correctly, but in the (N-1)/N chance that the actual hat configuration doesn’t match the one that the prisoner used, then it is a configuration for which a different prisoner is guaranteed to guess correctly. For N > 3, trying to make a list by hand that meets our two requirements is exceedingly difficult. Even when N = 3, blindly generating a winning assignment of configurations can be time consuming. For N = 5, there are 5^5 = 3,125 configurations to assign, and assigning them manually like this is too impractical, and for N = 10 there are ten billion configurations, so it’s practically impossible. That’s when using the modulo comes in to save the day.

  • @Rudxain
    @Rudxain Před rokem

    As a software dev interested in ethical hacking, this "solution" looks like an exploit in a weak cryptographic system. I imagine this may be related to the weakness of Caesar/Vigenère ciphers, like RC4

  • @hantuchblau
    @hantuchblau Před rokem

    Oh, the sum of all hats(mod n) is a random number. The sum minus their own number x is a linear function `f(x) = x+c` for a random constant c. Now either `c=0` and everyone is right, or no one is right. So we give up on guessing our own number. If we try to guess `c` instead, which is the same for everyone, we can brute force it!

  • @romnicklor9167
    @romnicklor9167 Před rokem

    The diagram shown at 6:40 is, strictly speaking, incorrect. The correct one is complicated pretty much by itself. Interestingly, the highest number of sets ever made, while still being 'simple', is 6 and consists of only triangles. Nonetheless, congratulations on winning SoME2. Well deserved!

    • @goingnull6028
      @goingnull6028 Před rokem

      Correct! I was wondering how long it would take someone to notice. About half a year I guess. That illustration is "not to scale"... or some more correct term. Maybe more like "not to reality."

  • @johnbrown-jd7od
    @johnbrown-jd7od Před rokem

    what about a variant in which each person can't see the hat type of the person to their right? how many people would you now need to guarantee a win for n hat types? edit: they also can't see their own hat type, like all puzzles of this type

    • @goingnull6028
      @goingnull6028 Před rokem

      Interesting question. At first glance, I can tell that 2n prisoners is sufficient, since the prisoners can break into two subgroups selected by alternation. Then each subgroup of n prisoners can guarantee a win. I'm not sure if there's a solution for less than 2n prisoners.

    • @johnbrown-jd7od
      @johnbrown-jd7od Před rokem

      @@goingnull6028Yes, that's what I initially thought of as well. However, 3 prisoners works for n=2 so there is probably a way to be more efficient. Maybe it has to do with minimizing the overlap created. For example, for n=10 and 19 prisoners, you have a total of 190% chance, so if you can get the overlap to be less than 90%, you have a working strategy.

    • @goingnull6028
      @goingnull6028 Před rokem

      How does 3 prisoners work for n=2? What's the strategy? Each prisoner can only see the hat to his left but not the hat to his right so there is no group of two prisoners who can see each other. How do you guarantee a win? I'm also not sure what you're saying about 19 prisoners. I assure you that they don't have a 190% chance of winning... or anything else for that matter :)

    • @johnbrown-jd7od
      @johnbrown-jd7od Před rokem

      @@goingnull6028 Sorry for the super late reply, but can't each prisoner just guess the same color hat as the prisoner to his left? The only way they fail is if no two adjacent hats have the same color but that's impossible with 2 colors and 3 prisoners.

    • @johnbrown-jd7od
      @johnbrown-jd7od Před rokem

      And yeah idk what I said either; I was just throwing ideas around. I guess you could try to use brute force to check for a solution for 3 colors and <6 prisoners but I think it's way too many combinations to test every strategy unless you can find some optimization.

  • @zylmanu
    @zylmanu Před rokem

    Great puzzle and great explanation and "solving tips" ! :) There is just two points I would have presented differently, maybe making it even clearer: - Instead of asking "what if the prisoners play randomly?", which is obviously a very bad strategy, I would have asked "what if the king plays randomly?", which is a very natural strategy for him, and also allows to start reasoning with probabilities (although you could as well count hat configurations leading to a win or a loose). - Instead of the argument with the inclusion/exclusion principle and the "overlap within the overlaps etc, which is a huge mess at 7.18" (which is indeed not the clearest part of the video), I would argue that with each prisoner having 10% chance of being right, the average number of prisoners being right is exactly 1. And if you have a random number which is 1 in average and want it to always be at least 1, the only possibility is that it is always exactly 1. What do you think ?

    • @goingnull6028
      @goingnull6028 Před rokem

      - If the king plays randomly, it doesn't lead me to think that the prisoners should play randomly. In fact, they shouldn't. I would still want to get the best strategy out of the prisoners. On the other hand, if the prisoners play randomly, there is nothing the king can do to thwart their plans other than play randomly himself and hope for the best. That forces us to analyze the full randomness strategy. - It's true that we can describe everything in terms of expected value. However, in my opinion, the probability description makes it much clearer that the prisoners only have to guarantee that not more than one is right. They don't even have to think about how to get one of themselves to be right. This was a wow factor I was trying to really hammer in the video.

  • @tdark987
    @tdark987 Před rokem

    3:42 immediately had me thinking of Zelda BotW. XD

  • @ImpossibleEvan
    @ImpossibleEvan Před rokem

    If everyone guess they would have a 65%

  • @gman21xx
    @gman21xx Před rokem

    Are there other ways to partition the space into ten equal segments and thus obtain alternative solutions? (Not just permuting the 10 people around though)

    • @goingnull6028
      @goingnull6028 Před rokem

      There are! For 10 specifically, we could also map each hat to one of the ten symmetries of a regular pentagon under rotation and reflection. This is also known as a dihedral group. This solution is non-abelian so the prisoners must designate an order, but that is doable under the conditions given. A nice outcome for when the number of prisoners is a power of 2 is that they can use xor instead of summation mod N. This is very simple because each prisoner only needs to compute the total xor with himself assigned to his desired result, due to the fact that the inverse of each element is itself. In general, for N prisoners, any group of size N can be used. However, this means that for prime N, only the cyclic group (isomorphic to what was presented in this video) will work. I've spent some time investigating if there can be solutions that are not connected to a group. I have some intuition as to why I believe all solutions must be groups, but I have yet to come up with a concrete proof.

  • @PowerhouseCell
    @PowerhouseCell Před rokem

    This was a brilliant video - super engaging! As an educational video creator myself, I understand how much effort must have been put into this. Liked and subscribed, always enjoy supporting fellow small creators :)

  • @grande1900
    @grande1900 Před rokem

    Nice video; but I do have one more question: What if the amount of hats is lesser/greater than the number of prisoners (and vice versa)

    • @goingnull6028
      @goingnull6028 Před rokem

      Let's say there are N prisoners and H hats. The video shows what happens when H = N. If H < N, then the prisoners can pick a subgroup of size H and that subgroup performs the strategy in the video. The remaining N - H prisoners can just pick randomly, since one of the prisoners in the subgroup of H is guaranteed to be correct. If N < H, then the prisoners should still follow the strategy here to get an N/H probability of escape. This can be seen from the probabilistic explanation of the problem.

  • @nathanderhake839
    @nathanderhake839 Před rokem

    I saw the intro to this video when it came out and decided to solve this problem myself, no matter how long it took. I finally figured it out today, and here is my solution. (I have yet to see the video.) I played around with 3 prisoners and 3 hats and noticed ways that the prisoner could deduce the information about what hat to guess from the other hats. I found many ways of doing this, but the most elegant was as follows: give each hat a number from 0 to 2 and each prisoner a number from 0 to 2. Each prisoner sums the values of the 2 hats (not their own) that they see and modulo 3s it, and you will get a table like this where the results in the middle are the prisoner's guess: sum of hats seen mod 3 > 0 1 2 prisoner number v 0 0 2 1 1 2 1 0 2 1 0 2 I brute-forced all the 27 hat distributions and figured out this strategy worked. Eventually, I figured out a generalization where the guess is (10-((the sum of the other hats + prisoner index) mod 10))mod 10 (all modular calculations are using floored modular calculation. See www.omnicalculator.com/math/modulo-of-negative-numbers for details) Let i be the prisoner number, let n be the number of prisoners (in this example, n is 10, but there is nothing special about that number), let a be the prisoner's actual hat number, and let d be the sum of all n of the hats. While no prisoner has access to d or a, they know d-a. They also realize i and n. Therefore, they can evaluate and then guess that their hat is (n-(d-a+i)%n)%n, and if this result equals a for some prisoner, they win. (% is a notation for modulus). Since d is constant for all prisoners, and i increments by 1 for all n prisoners, there exists precisely one i such that (d+i)%n = 0. in that case, the guess will be (n-(n-a)%n)%n = a, so therefore if each prisoner guesses (n-(d-a+i)%n)%n, we guarantee at least (and also exactly) one prisoner guesses their hat correctly. Thank you for sharing this question, and congratulations on winning SOME2.

  • @GianLupoYT
    @GianLupoYT Před rokem

    Really nice take, and congrats on your prize!!!

  • @raph2550
    @raph2550 Před rokem

    I don't know what to say but I still want to add a comment to express how good this was

  • @cobble3231
    @cobble3231 Před rokem

    Why do so many people want to help prisonners espace in these riddles? They're probably in prison for a reason! Great video though haha

  • @arekkrolak6320
    @arekkrolak6320 Před rokem

    why would it seem impossible, if you consider just two prisoners and just two hats then the problem has simple solution so why extending to 10 would be different :) ok, once you solve for 3 people and 3 hats it becomes quite obvious how the pattern works

    • @goingnull6028
      @goingnull6028 Před rokem

      People will typically say that it seems impossible before they know of the solution for two. I also brought the original impossibility quote in the video before mentioning the case with two prisoners. Furthermore, a solution for N=2 does not imply a solution for N greater than 2. Many people still get stuck and believe there is no solution past two. I agree though that if you find a solution for three, you've cracked the whole thing.

  • @dhruvarai1895
    @dhruvarai1895 Před rokem

    sooo, in the end the protagonist always wins thanks to the power of friendship?

  • @TheApprenticeRanger

    After hearing the riddle and noting the restrictions imposed, I couldn't help attempting a fairly math-free solution. So I tried coming up with a strategy where the individuals would decide to close their eyes or keep them open based on the number of duplicate hats they see, with predetermined answers given by those who kept their eyes open for various scenarios of observed closed/open eye ratios. But I couldn't find a way to guarantee that someone would be correct in the event of multiple sets of duplicate hats without involving something more complicated like having the individuals open their eyes a second time, or instead having them only close one eye upon first inspection. Unfortunately, while they might get away with keeping their eyes closed, I couldn't get around the fact that taking blink/wink actions based on the blink/wink actions of others would definitely be considered nonverbal communication by the king. Having finished watching the video, I realize that my attempted solution was not in the spirit of the riddle. Still I recognize that there are never too many ways to view a problem, so I figured I'd at least share my musings. That aside, I thoroughly enjoyed the genuine solution presented. I found the problem-solving methodology, along with the generalizations that followed, to be laid out in an intuitive manner. Thank you for making and sharing such elegant yet thought-provoking content!

  • @ImolaS3
    @ImolaS3 Před rokem

    Fantastic!!

  • @CyrilBergeron
    @CyrilBergeron Před rokem

    I think the answer is not maximum 10 times . I think it is maximum 2 times where the first time they have still 1/10 to find themselves the right answer, and then 9/10, since by observing the choice of one neighbour they can correct their choice by deduction.

    • @goingnull6028
      @goingnull6028 Před rokem

      They don't get to hear their neighbors' answers. All answers are given simultaneously. See 0:40 to 0:50.

  • @KirkWaiblinger
    @KirkWaiblinger Před rokem

    i suppose the requirement that the prisoners be shown the hat types beforehand is what provides the ability to order the hats, which seems to be required for this solution approach. Makes me wonder about what issues you would run into with non unique hats, non total-ordered hats, or flavors of infinity

    • @goingnull6028
      @goingnull6028 Před rokem

      I'm not sure what you mean. It's true that the prisoners must all know the hat types before they strategize, but there is no ordering or uniqueness required. In fact, the king could keep them all in their cells and just tell each prisoner the hat types that the other prisoners have (in any order), and that would be enough for them to apply this strategy and guarantee one right.