1 00:00:00,500 --> 00:00:03,860 PROFESSOR: So, now we come to the place where arithmetic, 2 00:00:03,860 --> 00:00:06,530 modulo n or remainder arithmetic, 3 00:00:06,530 --> 00:00:09,580 starts to be a little bit different and that involves 4 00:00:09,580 --> 00:00:12,309 taking inverses and cancelling. 5 00:00:12,309 --> 00:00:13,100 Let's look at that. 6 00:00:13,100 --> 00:00:15,000 So first of all, we've already observed 7 00:00:15,000 --> 00:00:16,970 that we have these basic congruence rules 8 00:00:16,970 --> 00:00:20,430 that if a and b are congruent then c and d are congregant, 9 00:00:20,430 --> 00:00:22,570 then a plus c and b plus d are congruent, 10 00:00:22,570 --> 00:00:25,430 a times c and b times d are congruent. 11 00:00:25,430 --> 00:00:29,030 So, that's the sense in which arithmetic mod n is 12 00:00:29,030 --> 00:00:31,080 a lot like ordinary arithmetic. 13 00:00:31,080 --> 00:00:33,402 But here's the main difference. 14 00:00:33,402 --> 00:00:34,360 Let's look at this one. 15 00:00:34,360 --> 00:00:37,560 8 times 2 is 16, which means it's 16 00:00:37,560 --> 00:00:41,810 congruent to 6 mod 10, which is the same as 3 times 2. 17 00:00:41,810 --> 00:00:44,160 So, 8 times 2 is congruent to 3 times 2. 18 00:00:44,160 --> 00:00:48,550 And you'd be tempted, maybe, to cancel the twos. 19 00:00:48,550 --> 00:00:51,560 And what happens then, well then you could discover that you 20 00:00:51,560 --> 00:00:55,920 think that 8 is congruent to 3 mod 10, which it ain't. 21 00:00:55,920 --> 00:00:59,940 So in short, you can't cancel arbitrarily. 22 00:00:59,940 --> 00:01:02,614 You can't cancel two, in this case in particular. 23 00:01:02,614 --> 00:01:05,030 So, that leads, naturally, to the question of when can you 24 00:01:05,030 --> 00:01:06,970 cancel a number? 25 00:01:06,970 --> 00:01:09,990 When can you cancel a number k when both sides of inequality 26 00:01:09,990 --> 00:01:12,530 are multiplied by k and I'd like to cancel k? 27 00:01:12,530 --> 00:01:16,570 And the answer is simple, when k has no common factors 28 00:01:16,570 --> 00:01:18,840 with a modulus n. 29 00:01:18,840 --> 00:01:22,860 So, the proof of that is based on the following idea. 30 00:01:22,860 --> 00:01:28,740 Let's say that a number k prime is an inverse of k mod n. 31 00:01:28,740 --> 00:01:32,330 If k prime times k is congruent to 1 mod n. 32 00:01:32,330 --> 00:01:36,190 So, k prime is like 1 over k with respect to mod n. 33 00:01:36,190 --> 00:01:42,180 But of course, 1 over k is going to be a fraction unless k is 1. 34 00:01:42,180 --> 00:01:45,080 And so, k prime is going to be an integer that 35 00:01:45,080 --> 00:01:48,980 simply acts like 1 over k. 36 00:01:48,980 --> 00:01:50,640 So, how are we going to prove this? 37 00:01:50,640 --> 00:01:54,860 And it's going to turn out to be an easy consequence of the fact 38 00:01:54,860 --> 00:01:58,370 that the gcd is a linear combination. 39 00:01:58,370 --> 00:02:00,170 So, how am I going to prove-- find this k 40 00:02:00,170 --> 00:02:02,400 prime that's an inverse of k? 41 00:02:02,400 --> 00:02:05,300 Well remember, given the gcd of k and n is 1, 42 00:02:05,300 --> 00:02:08,300 I have a linear combination of k and n is 1. 43 00:02:08,300 --> 00:02:12,380 So, s times k plus t times n is 1. 44 00:02:12,380 --> 00:02:15,590 But if you stare at that for a moment, what that means 45 00:02:15,590 --> 00:02:21,080 is that k prime is simply the coefficient s of k. 46 00:02:21,080 --> 00:02:25,380 So, all you have to do is apply the pulverizer to k and n 47 00:02:25,380 --> 00:02:30,300 to get the coefficient s of k in the linear combination of k 48 00:02:30,300 --> 00:02:31,470 and n is equal to 1. 49 00:02:31,470 --> 00:02:33,990 Let's look at that slightly more carefully 50 00:02:33,990 --> 00:02:36,010 and see what's going on. 51 00:02:36,010 --> 00:02:39,107 I have that sk plus tn is 1. 52 00:02:39,107 --> 00:02:41,190 So, that means in particular, since they're equal, 53 00:02:41,190 --> 00:02:44,500 they're certainly congruent to each other, modulo n. 54 00:02:44,500 --> 00:02:47,090 sk plus tn is congruent to 1 mod n. 55 00:02:47,090 --> 00:02:49,400 But, n is congruent to 0 mod n. 56 00:02:49,400 --> 00:02:54,750 So, this becomes t times 0, and we're left with sk congruent 57 00:02:54,750 --> 00:02:59,040 1 mod n, which is exactly the definition of s 58 00:02:59,040 --> 00:03:01,180 being an inverse of k. 59 00:03:04,780 --> 00:03:10,550 Now, I can also cancel k if it's relatively prime to n. 60 00:03:10,550 --> 00:03:16,460 And the reason is that if I have ak equivalent to bk mod n 61 00:03:16,460 --> 00:03:19,350 and the gcd of k and n is 1, then 62 00:03:19,350 --> 00:03:21,640 I have this k prime that's an inverse of k. 63 00:03:21,640 --> 00:03:23,920 So, I just multiply both sides by the inverse 64 00:03:23,920 --> 00:03:26,350 of k, namely k prime. 65 00:03:26,350 --> 00:03:32,220 And I get that the left hand side is a times k, k inverse. 66 00:03:32,220 --> 00:03:34,810 And the right hand side is b times k, k inverse. 67 00:03:34,810 --> 00:03:39,010 And of course, that's a times 1 is equivalent to b times 1. 68 00:03:39,010 --> 00:03:41,430 And so, a is congruent to b mod n. 69 00:03:41,430 --> 00:03:46,420 So I can cancel, in that case, trivially. 70 00:03:46,420 --> 00:03:49,970 And in fact, you can work out the converse implications. 71 00:03:49,970 --> 00:03:52,000 The punch line of this-- well first of all, this 72 00:03:52,000 --> 00:03:53,240 is the cancellation rule. 73 00:03:53,240 --> 00:03:56,950 You can cancel providing that the gcd of k and n 74 00:03:56,950 --> 00:03:59,360 is 1 if k is relatively prime to n. 75 00:03:59,360 --> 00:04:00,710 So, this is the summary. 76 00:04:00,710 --> 00:04:02,990 [? k is ?] cancelable mod n if and only 77 00:04:02,990 --> 00:04:08,130 if k has an inverse mod n, if and only if the gcd of k and n 78 00:04:08,130 --> 00:04:13,930 is 1, which I can restate as k is relatively prime to n. 79 00:04:13,930 --> 00:04:15,964 And that's the story.