 Welcome back to another screencast. This one on the very important notion of integer congruence. So let's go back to an example that we saw earlier about divisibility. Integer congruence is very closely tied to divisibility. We were asking in a concept check earlier whether 12 divides 782. And the way we answered that seemed kind of inefficient at the time, but here it's going to pay off for us. How do I know if 12 divides 782? We'll turn that around and ask, is 782 a multiple of 12? And the way we thought about this was just listing out the multiples of 12, starting with, say, 0, then 12, then 24, and so forth. And just seeing if 782 is in the list, and it isn't, it would go right in here, obviously, if it were in the list, and it's off. It's off by 2. If I go to 782, it would be a multiple of 12 if I move back two places, 781 to 780. So it's not a multiple of 12, but it's two units off, if you will, from being a multiple of 12. Another way of saying that is that 782 minus 2 is a multiple of 12. If you took the 782 and jacked it back a couple of places, you would have yourself a multiple of 12. And another way of saying that is that 12 divides the difference between 782 and 2. Why are we phrasing things this way? Sometimes we don't necessarily want to know if something's a multiple of another number, but how far off is it from being a multiple of another number? And that difference or error, or however you want to phrase it, becomes pretty important for us. So we want to question, okay, if 12 does not divide 782, is there another number that 12 divides the difference between 782 and that number? That difference is important, and that's what gives us the notion of integer congruence. So let's set up the definition and we'll instantiate it in a moment. Let's let n be a natural number, and that, of course, is the set of positive integers for us. Let a and b be any two integers, zero or negative, are not excluded from this. Then we're going to say that a is congruent to b, modulo n, provided that n divides a minus b. And we're going to write a and a little triple equal sign, which we last used in a different context for logical equivalence. Here we're using it for a slightly different idea. A is congruent to b, mod n. Now, before we instantiate the definition, just to note about the terminology here, the word congruent here is stolen from geometry. You know, you can say two triangles are congruent. I'm going to draw two or attempt to draw two congruent triangles. They're not the same, right? They're not equal to each other because they're different. I mean, you can see they're not sitting on top of each other. They're different. But they are congruent in the sense that there's no real difference between the two of them. They have the same angle measures, the same side measures, and so on and so forth. So they're not equal, but they are congruent up to a certain level of quality. So we're going to talk about integers being not equal but congruent. And the criterion we have for congruence is modulo n. That word modulo kind of implies a difference and a division operation happening at the same time. So a is congruent to b mod n if n divides the difference between a and b. So let's instantiate this definition with some examples here. First of all, using the one we saw earlier, because we know that 12 divides 782 minus 2, we knew that from looking at the list of multiples of 12, we can turn that statement back around and say that 782 is congruent to 2 mod 12. One way to think about the term congruent, speaking of geometries, if I lined up those multiples again of 12, 0, 12, etc. All the way up to 780, the next one was 792. 12, I'm sorry, 782 and 2 occupies sort of the same relative position in that list. 2 would go right here and it's 2 units off from being a multiple of 12 and so is 782. That's also 2 units off from being a multiple of 12. So in this list, they are the same distance from their nearest multiple of 12. That's a way to think about congruence mod 12. Also, you can flip this around too and say that 2 is congruent to 782 mod 12, because 12 not only divides this difference, it also divides the flip difference as well. The only thing that happens here is it introduces a negative sign. So integer congruence is going to be what we call a symmetric relationship. If one integer is congruent to another, then we can speak of the congruence in either order we like. Let's look at another example here. 16 is congruent to 1 mod 3 because 3 divides their difference, 16 minus 1. 16 minus 1 of course is just 15 and we all know that 3 divides that, so 16 is congruent to 1 mod 3. Now on the other hand, negative 16 is congruent to 2 mod 3. Now why is that? Well it would have to be because 3 divides the difference between negative 16 and 2. Now what is this number in the middle here in the parentheses? Well negative 16 minus 2 is negative 18 and 3 does divide negative 18 with a quotient of negative 6. So here's a little theorem here that helps relate this notion of integer congruence back to something you already know, namely the notion of even and odd. The theorem says that if a is even, then a is congruent to 0 mod 2. If a is odd, then a is congruent to 1 mod 2. I'm going to sketch a really quick proof of this, not with a no-show table, but just with some scribblings and some schematics here. If a is even, then what that means is that it's a multiple of 2. There exists in a germ, let's say k, such that a is equal to 2k. That's fine. And so what that means is that a is a multiple of 2. That is 2 divides a. Well to say 2 divides a is also to say that 2 divides a minus 0. Okay? Subtracting 0, of course, is absolutely nothing. But it does set us up to use the definition of congruence. If 2 divides a minus 0, then that means that a is congruent to 0 mod 2. Now likewise, if a is odd, then what we all know is that there exists an integer, let's call it k again, such that a is equal to 2k plus 1. Now let's take that equation and subtract 1 from both sides, and I have a minus 1 equals 2k. What this is telling you is that a minus 1 is a multiple of 2. That is that 2 divides a minus 1. And using the definition of congruence, I then can conclude that a is congruent to 1 mod 2. So this is a handy way of checking whether a number is even or odd in terms of integer congruence, and it will become very handy for us in a number of contexts later on. So let's end off with a concept check to see how well you're understanding this notion of congruence modulo n. Which of the following numbers here are congruent to 2 modulo 9? Definitely there could be more than one right answer here, so pause the video, think about it, and select all that apply. Okay, and we're back, and let's see which ones are congruent to 2 modulo 9. The key question here is 2 modulo 9, if a is congruent to 2 mod 9, what that would mean is that 9 divides the difference between a and 2. So I'm just going to look through here and go through my numbers here and subtract 2, and see if 9 divides that difference. Definitely a is correct here, because 7 negative 7 minus 2 is negative 9, and 9 divides that, so this is congruent to 2 modulo 9. Negative 2 is not congruent to 2 modulo 9, because negative 2 minus 2 is negative 4, and 9 does not divide negative 4, so that's out. 0 is also out, because 0 minus 2 is negative 2, 9 doesn't divide that, so that's gone. 2 is congruent to 2 mod 9, because 2 minus 2 is 0, and 9 definitely divides 0. 7 is not, because 7 minus 2 is 5, and 9 does not go into 5 evenly. Now the remaining three are all going to work, and they illustrate an important idea here. 11 is, let's check that, 11 minus 2 is equal to 9, and certainly 9 divides that. 20 is, let's check that out, 20 minus 2 is 18, and 9 divides that as well. You obviously are probably noticing that this is just adding another 9 onto this number here, so if I jump ahead by 9, if I start with something that's already congruent to 2 mod 9, and add 9 onto it, I get another number that is also congruent to 2 mod 9. Same reasoning will tell you that 29 is also going to be congruent to 2 mod 9. So if I could just pull this list up here and write it out, negative 7, 2, 11, 20, 29, these are all sort of consecutive integers that are congruent to 2 mod 9. They're all separated by a jump of 9 units. So what you see here is that there are actually infinitely many integers that are congruent to 2 mod 9. Anything in that list would work. So that's it for now for integer congruence with much more to come later.