 Welcome back to another screencast about the division algorithm. In this video we're going to pick up on an idea that you might have noticed in the last video about using the remainder in the division algorithm to set up cases in a proof. Now when we divide any integer a by a positive integer b, the division algorithm says that although b may not divide into a evenly, you will definitely divide in and get a quotient and a remainder, q and r, such that a is equal to bq plus r, and r satisfies the inequality 0 less than or equal to r strictly less than b. For example, and this is our first example we saw of this, if a is equal to 345 and b is 8, then we can write 345 equal to 8 times 43 plus 1, and that indicates that 8 goes into 345 43 times with a remainder of 1. Let's do something different with this equation here. Let's subtract 1 from both sides and get 345 minus 1 equals 8 times 43. This is certainly true, but it's saying something interesting. It's saying that 345 minus 1 is divisible by 8, it's a multiple of 8. So we've seen this language before where 8 divides a difference, and what this is really saying here again is that 345 is congruent to 1 modulo 8 because 8 divides their difference. So what the division algorithm is actually telling us is something about integer congruence, not just about divisibility. Let's go back to another example we saw in that first video, with a equal to negative 87 and b equal to 6. In that case, the division algorithm gave us negative 87 is equal to 6 times negative 15 plus 3. If we subtract the remainder from both sides, we get negative 87 minus 3 equals 6 times negative 16, and so negative 87 minus 3 is divisible by 6, and that means that negative 87 is congruent to 3 modulo 6. So in general, if we have any two integers a and b with b bigger than zero, the division algorithm gives us values q and r such that a is equal to bq plus r, and subtracting the remainder gives us a minus r equals bq. So what that means is that a minus r is a multiple of b, which means a minus r is divisible by b, which means that a is congruent to r mod b. So in other words, and I'll state this as a theorem, if a and b are integers with b positive and a equal to bq plus r, then a is congruent to r modulo b. And what that means in English is that a is always congruent to the remainder we get when we divide a by b. So this is a pretty nice way to think about an integer congruence. It's just something that's naturally associated with regular division that we've known since the third grade. But there's more. The division algorithm doesn't just give the existence of q and r. It says that if we require r to satisfy the inequality, 0 less than or equal to r or less than b, then those integers are unique. So the division algorithm, in the division algorithm, the r is not just any old integer, it's the unique number within that range such that a equals bq plus r. For example, we know that 345 is congruent to 1 mod 6, but it's also congruent to a number of other things mod 6. For example, 7 and 13 and negative 5, all these are different by multiples of 6. But 1 is the only integer in that list that's non-negative and less than 6. So what we actually get from the division algorithm is the following. If a and b are integers with b positive and a equal to bq plus r given by the division algorithm, that is that r is bigger than or equal to 0 but less than b, then r is the smallest non-negative integer such that a is congruent to r modulo b. In an earlier video, we gave this value a name. We called it the least non-negative residue mod b. That least non-negative residue is the remainder that we get from the division algorithm. Now the reason we care about the least non-negative residue of an integer modulo something else is that oftentimes you want to reduce an integer down to its quote unquote lowest form and this number is what we are after. Here's a quick example and in the next video we'll give a bigger example that hasn't applied flavor to it. So what's the least non-negative residue of 2012 mod 17? That is of all the numbers that are congruent to 2012 modulo 17, which one is the smallest one that stays out of the negative number territory? So the result that we quoted above says that we can just look to the division algorithm for this. We can implement the division algorithm through just regular long division and I'm going to do that here on the screen. Why we see here that 17 goes into 2012 118 times and the remainder is 6. So that means that 2012 is congruent to 6 mod 17 and moreover that 6 is the least non-negative number to which 2012 is congruent mod 17. It's the least non-negative residue. To check we can just rewrite the division algorithm result as 2012 equals 17 times 118 plus 6. Now subtract the remainder to get 2012 minus 6 equals 17 times 118 and you can see here that 2012 is indeed congruent to 6 mod 17. One quick concept check before we're done. What's the least non-negative residue of negative 16 mod 5? Well you can automatically rule out A because we're looking for the least non-negative residue, so anything that's negative is out automatically. If we use the division algorithm here, although maybe not long division because there are negative numbers involved, we can get negative 16 equals 5 times negative 3 minus 1. Now this is correct but the remainder is negative and so it doesn't fit in the division algorithm. So instead let's bump up the quotient by 1 and make that a negative 4 and change the remainder to a 4 instead. So this equation is also true but this time the remainder is the right size. It's between 0 and 4 as the division algorithm demands that it be. So the remainder is 4 and that means that negative 16 is congruent to 4 mod 5 and that 4 is the least non-negative number to which negative 16 is congruent mod 5. That's the least non-negative residue. So that's a nice connection and an important one between division and congruence. Thank you for watching.