1 00:00:00,012 --> 00:00:01,168 Okay. Welcome back. 2 00:00:01,168 --> 00:00:03,040 Week six. I just rolled the dice. 3 00:00:03,040 --> 00:00:05,511 They all came up that way. You believe that? 4 00:00:05,511 --> 00:00:09,226 It's pretty dark in here. I wish they'd turn off, turn up the lights 5 00:00:09,226 --> 00:00:11,600 or something. I don't know what's wrong. 6 00:00:11,601 --> 00:00:14,714 In the studio here. Let's see. 7 00:00:14,714 --> 00:00:19,999 Oh, it's not so bad. Okay, so this week is a big, big theorem 8 00:00:19,999 --> 00:00:25,306 due to Grundy. I believe in the early twentieth century 9 00:00:25,306 --> 00:00:32,658 1930 later 30s is my guess. You all can look it up on, on, on the 10 00:00:32,658 --> 00:00:40,081 interwebs or whatever it's called and, and here's the paper. 11 00:00:40,081 --> 00:00:46,646 But let's first go back and answer the question from last week. 12 00:00:46,646 --> 00:00:53,088 Okay, so we're at six, we can subtract one, two or five. 13 00:00:53,089 --> 00:00:57,627 That's my subtraction game. 1, 2 or 5. 14 00:00:57,627 --> 00:01:04,702 So 1, 2 there it goes. So that's the mex of 1, 1 and 2 is 0. 15 00:01:04,702 --> 00:01:07,786 So it's 0. And I bet you the next ones a 1. 16 00:01:07,786 --> 00:01:12,816 And the next, and I bet you it goes 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, forever. 17 00:01:12,816 --> 00:01:16,502 It's periodic. A lot of these, a lot of these impartial 18 00:01:16,502 --> 00:01:20,611 games are, are, if not periodic, at least ultimately periodic. 19 00:01:20,611 --> 00:01:25,390 After awhile, they, they're periodic. And what this means is something very 20 00:01:25,390 --> 00:01:29,989 Important in terms of computational complexity, it says we can solve all of 21 00:01:29,989 --> 00:01:34,762 the games in a finite, amount of time. They all reduce to a Nim heap of size 22 00:01:34,762 --> 00:01:37,603 zero, one or two regardless of how big they are. 23 00:01:37,603 --> 00:01:42,649 And we can tell which one that it is simply by calculating[UNKNOWN] through 24 00:01:42,649 --> 00:01:47,511 It's important. That, theorem like that for the game 25 00:01:47,511 --> 00:01:55,374 Chomp, won of, one student once a hundred thousand dollars in a science fair. 26 00:01:55,374 --> 00:02:00,660 You can look it up. Alright, now do the Grundy and if g is 27 00:02:00,660 --> 00:02:08,909 impartial then g is star n for some, n for every, Every impartial gain is equivalent 28 00:02:08,909 --> 00:02:15,926 to a nin haive And an example, here's our starting example as before, there we go. 29 00:02:15,926 --> 00:02:21,310 Here look at the minimal excluded. So here, here, here's the proof. 30 00:02:21,310 --> 00:02:27,551 And so don't panic, it's a proof. You know mathematicians do these kinds of 31 00:02:27,551 --> 00:02:29,104 things. Then, oh. 32 00:02:29,104 --> 00:02:33,499 There's induction. And the, the proof is so short, I can just 33 00:02:33,499 --> 00:02:35,835 sit here and make noises. Okay. 34 00:02:35,835 --> 00:02:41,235 The proof is so short that, that we kind of wonder afterwards, did I really do 35 00:02:41,235 --> 00:02:44,104 anything? The answer is, yes you did. 36 00:02:44,105 --> 00:02:47,476 You've proved a theorem. That's a big deal. 37 00:02:47,476 --> 00:02:50,081 All right. So I will do induction. 38 00:02:50,081 --> 00:02:55,266 If G is zero gain, then G is already equivalent to nim heap size zero. 39 00:02:55,266 --> 00:02:59,356 Piece of cake. All right, so I suppose G is impartial. 40 00:02:59,356 --> 00:03:04,503 Then by induction, the options of G, the moves of G are themselves. 41 00:03:04,504 --> 00:03:11,302 Equivalent Nim makes this is by induction These are simpiler games than G, so 42 00:03:11,302 --> 00:03:18,967 assuming that the theorem is true for all simpler games, all of these are equivalent 43 00:03:18,967 --> 00:03:25,730 to Nim games and we're basically back this same ol' example, where is it? 44 00:03:25,731 --> 00:03:31,768 Basically, example. If you have something like this, this is a 45 00:03:31,768 --> 00:03:38,584 nim heap with, with possible adding coins, but adding coins doesn't do you any good 46 00:03:38,584 --> 00:03:42,890 because you gotta play, you can just take them away. 47 00:03:42,891 --> 00:03:51,628 Okay let me do an example here which relates back to what we started with this 48 00:03:51,628 --> 00:03:55,031 week and that's nim sums. Okay. 49 00:03:55,031 --> 00:03:59,592 Nim sums. So let's take a look at star 2 plus star 50 00:03:59,592 --> 00:04:03,176 3. This theorem ought to tell us about how, 51 00:04:03,176 --> 00:04:08,690 how, how, how we compute this. So suppose we don't know about nim's 52 00:04:08,690 --> 00:04:15,026 signs, and we just want to compute this so, so star 2 is this game here and star 3 53 00:04:15,026 --> 00:04:19,162 is this game. And so, if you add them together, what do 54 00:04:19,162 --> 00:04:22,766 you get? You take one of these plus this, that's 0 55 00:04:22,766 --> 00:04:27,292 plus 3 or this plus this. That's 1 plus 3 or you take the whole 56 00:04:27,292 --> 00:04:32,803 thing here, plus 0. That's star 2 plus 0 or you take 1, star 1 57 00:04:32,803 --> 00:04:37,073 plus star 2. That's this, this option plus the whole 58 00:04:37,073 --> 00:04:42,640 game over here or you take star 2 plus this whole game, which is star 2. 59 00:04:42,640 --> 00:04:48,542 So, so just by the definition of addition Star 2 plus star 3 which is this plus this 60 00:04:48,542 --> 00:04:51,845 is this. Now 0 plus anything is anything. 61 00:04:51,845 --> 00:04:55,586 So that's a star 3. A star 1 plus star 3, well that's a 62 00:04:55,586 --> 00:04:59,305 simpler game. And we'll suppose we've already computed 63 00:04:59,305 --> 00:05:01,869 that. We actually know how to do that. 64 00:05:01,869 --> 00:05:08,770 That's 0,1 plus 1, 1 and then sum in binary which is 2. 65 00:05:08,770 --> 00:05:14,203 0 plus 2 is 2 because 0 plus anything is 0. 66 00:05:14,204 --> 00:05:19,656 1 plus 2 is 3. Both in ordinary arithmetic and nim sum 67 00:05:19,656 --> 00:05:25,714 and two plus two in nim sum is 0. So, so, star 2 plus star 3 is this, and if 68 00:05:25,714 --> 00:05:31,303 you look, 0 is here but one isn't so the minimal excluded is one. 69 00:05:31,303 --> 00:05:35,651 So the whole thing is equivalent to nim heap size one. 70 00:05:35,651 --> 00:05:42,142 And we knew this already. If, if you take nim a nim heap of size two 71 00:05:42,142 --> 00:05:48,608 plus a nim heap of size three it's equivalent to a nim heap size one because 72 00:05:48,608 --> 00:05:53,949 the nim sum of 2 and 3 is 1. Let me give you another game, slightly 73 00:05:53,949 --> 00:06:00,224 more complicated. That you all can talk about in the forums. 74 00:06:00,224 --> 00:06:08,490 We're not going to solve that explicitly here although I may comment in the forums. 75 00:06:08,490 --> 00:06:20,341 And it's, we have a stack of coins, remove one coin and split into 2 nonempty piles. 76 00:06:20,341 --> 00:06:25,956 So if you start off with 0 coins, then there's no moves. 77 00:06:25,956 --> 00:06:31,078 And if you start off with 1 coin, there's no moves. 78 00:06:31,078 --> 00:06:39,020 And if you start off with 2 coins, there's no way to remove 2 coins, and split it 79 00:06:39,020 --> 00:06:42,330 into 2 pieces. There's not, I'm sorry. 80 00:06:42,330 --> 00:06:45,853 There's no way to take 2 coins, remove 1 of them. 81 00:06:45,853 --> 00:06:50,681 And take the remaining 1 coin, and split it into 2 non empty piles. 82 00:06:50,681 --> 00:06:54,550 So that's 0, 2. 3 is the first, non trivial case. 83 00:06:54,550 --> 00:06:59,044 And, you can work it out. And work out some higher ones. 84 00:06:59,045 --> 00:07:02,826 This is an interesting game, called point 4. 85 00:07:02,827 --> 00:07:10,117 And if you want to look this up on the internet or someplace else, it's called 86 00:07:10,117 --> 00:07:15,424 octal game. Alright let's look at the quiz for this 87 00:07:15,424 --> 00:07:20,500 week it's find the nim sum of one, five and 11. 88 00:07:20,500 --> 00:07:27,217 Find the Mex of That's it. For, for subtraction game 1, 2, 5, find G 89 00:07:27,217 --> 00:07:31,669 of 7 and find G of 4 for the subtraction game 1, 2, 3. 90 00:07:31,669 --> 00:07:36,296 'Kay? So and this'll, this'll, this'll show up 91 00:07:36,296 --> 00:07:43,272 actually on, on a quiz and you'll have a little bit of time to do it I think. 92 00:07:43,272 --> 00:07:56,054 Those straight forward if you not let me know, and, that's we cast 6. 93 00:07:56,054 --> 00:08:01,498 All come back now you're hear?