Modular Arithmetic and Divisibility
Transcript
in this video we're going to discuss divisibility so the definition of modular arithmetic tells us that if a and B are integers and M is a positive integer then a is congruent to B mod M if and only if M divides a minus B so before we actually look at this definition and actually do some practice with it I want to make sure we're very clear on the concept of modular arithmetic or mod M so let's look at just mod 4 since that's what our first example will deal with and mod 4
remember we're talking about mods we're talking about remainders we're very interested in what the remainder is so if I take something and I divide it by 4 I could possibly get a remainder of 0 or I could get a remainder of 1 I could get a remainder of 2 or I could get a remainder of 3 now if I got a remainder of 4 that would really be the same thing as a remainder of 0 because 4 would be divisible by 4 exactly 1 means a remainder of 0 so these are really my only options because we always like to look at the the smallest values so now if I'm looking at mod 4 and looking at my number line I've drawn this would be 0 1 2 3 just as we normally would think so on a number line but with mod 4 the value of 4 4 divided by 4 is a nice even number that has a remainder of 0 and 5 divided by
4 has a remainder of 1 and 6 divided by 4 has a remainder of 2 and similarly we could go in the opposite direction where negative 1 would actually be negative 4 divided by 4 with a remainder of 3 and then 2 and then 1 and then 0 etc so we can see what the pattern is is basically just 0 1 2 3 0 1 2 3 0 1 2 3 etc so what we're looking for in our first example us is too congruent to six
in the world of mod 4 so looking at mod 4 2 & 6 if you'll notice both are 2 which means if I take 2 divided by 4 or 6 divided by 4 my remainder is 2 exactly the same so that's good so that means yes they are equivalent now what I want to do instead is look at my definition and my definition says I can determine that without making a number line and Counting everything out by saying is the
difference between these two values divisible by 4 and that is what we're asking here so we're saying does 4 divide 2 minus 6 or 6 minus 2 would give us the same result so does 4 divide negative 4 & 4 does divide negative 4 and therefore we know that yes 2 is congruent to 6 so we're not saying that 2 is divisible by 4 or that 6 is divisible by 4 but that these two are equivalent because they're the
differences in their remainders is divisible by 4 so let's look at our next one 24 is 24 congruent to 14 mod 6 so again we're asking does 6 divide 24 minus 14 does 6 divide 10 and in this case 6 does not divide 10 evenly and therefore no these are not equivalent again we could draw out a number line and we could see that visually but hopefully you get the basic idea of modular arithmetic we've just looked at the definition of modular arithmetic and I want to look at a theorem
that really follows from that and I feel like this theorem is pretty straightforward essentially it's saying all the same things we had before ami and integers m is a positive integer they a is congruent to B mod M if and only if and then a mod M is equal to B mod M so really all we're saying is if the remainders are equal to one another then they are congruent and that's what we talked about when we looked at our last slide but let's kind of look at it in terms of the mathematics
so I put the same two examples that we had on the last slide and I just want to look at it in terms of when we looked at the division algorithm so if I'm looking at two I'm saying does 4 divide 2 and again we know the way that we can write this we're saying 4 times some number plus some number equals 2 that's what we want to look for so in this case 4 times 0 plus 2 does equal 2 and then if I were
going to write that in terms of R which is the remainder the remainder is equal to 2 mod 4 so 2 mud 4 so notice what I'm building up to here a mod M I'm saying 2 is equal to 2 mod 4 let's look at 6 so does to divide 6 sorry let me try that again does 4 divide 6 I got confused for a minute and so again the way that we would write that is 4 times some number plus some number using the definition
of division and in this case we would say 4 times 1 is 4 plus 2 is 6 and again the remainder of 2 would be equal to 6 mod 4 and so notice what I've just shown you is that yes in fact we already knew these were equivalent but now I'm just showing you in another way that too is equal to 2 months for 2 is equal to 6 mod 4 and therefore 2 mod 4 is equal to 6 mod 4 and therefore we can say yes this
is true let's look at our other example and again we previously showed that this was not congruent so let's take a look at how we might show that mathematically so we're saying does 6 divide 24 and if we take 6 divided by 24 we're saying 6 times some number plus some number is equal to 24 in this case 6 times 4 is 24 plus 0 so how would I write that I would say that what my remainder of 0 is equal to 24 mod 6 and now let's look at the other one we have 14 so does 6 divide 14 and
again we're saying 6 times some number plus some other number this one would be 6 times 2 is 12 plus 2 is 14 and notice here my remainder is 2 so 2 equals 14 mod 6 and obviously these values don't are not equal therefore 24 mod 6 does not equal 14 mod 6 and therefore we can say again that 24 is not congruent to 14 mod 6 now that we have a basic framework for modular arithmetic I want to look at
a few theorems and their proofs before we do any actual computation so the first theorem says the integers a and B are congruent modulo M which is just a is congruent to B mod M and then we have this if and only if word and keep in mind whenever we have if and only if that means you have to in both directions so assume this prove this and then vice versa and what am I trying to prove there is an integer K such that a is equal to B plus K s so notice here I'm going from congruence to an equation so let's start by assuming a is congruent to B mod M so I'm assuming we'll call this P proving Q so let a be congruent to B mod M what do I know when about when things are congruent well based on what we've learned in this video then we can say that M divides a minus B why can I say that by the definitions of congruence now if M divides a minus B then I can say that a minus
B is equal to K M for some integer K and again how do I know that by definition of divisibility now think about where I'm trying to get to a is equal to B plus kms I'm really close here by additions or you can even be specific by addition of B because I'm going to add B to each side then a is equal to B plus K X so I've shown that if P is Q then Q must be true now I have to show if Q then P so assume a is equal to B plus KS then a minus B is equal to km by subtraction and as you can see I'm just kind of going in the reverse order but what I have to show then is that
this is true so if a minus B is equal to km by subtraction what does that tell me that tells me that M divides a minus B so a is congruent to B mod M and again I didn't give the reasons for each step there just because I was going I'm using the same reasons as I did in the proof above so I've proved this one in both directions let's take a look at another theorem now and we're actually going to use the last theorem that we proved to help us prove this so this theorem says let M be
some positive integer if a is congruent to B mod M and C is congruent to D mod M then a plus C is congruent to B plus D mod M and a times C is congruent to B times D ma m so again this is not an if and only if statement that's just an if-then so it's just a one direction proof but there's two parts I have to prove that this is true and I have to prove that this is true so before we prove either of those things let's give us give ourselves some assumptions we're going to
assume and again if I wrote this as a proposition it would be if bla bla bla bla bla then and so I'm assuming the if part so assume a is congruent to B mod M then what does it mean to be congruent then I can say that a is equal to B plus K M for some integer K assume also C is congruent to D mod M then C is equal to D plus L M for some L that is an integer so I'm just going to use those as
assumptions for each of the two parts of the proof that I'm going to go about proving or showing so I'm going to start with a plus C by substitution instead of a I'm going to plug in B plus K m and instead of C I'm going to plug in D plus Ln from here I'm going to just do some rearranging I am going to use both the associative and commutative properties and I'm not going to write down each
step I'm just telling you the steps as I go I'm going to use both the commutative and associative properties to rewrite this as B plus D plus K m plus L m and then by the distributive property I'm going to call that B plus D equals M I'm sorry that equals B plus D plus m times k plus L
now what am I trying to prove I'm trying to prove that these things are congruent modulo M which means right now I have a plus C is equal to B plus D plus M K plus L so a plus C minus B plus D is equal to M times k plus L and what does this mean if we have M times K plus L so M divides a plus C minus B plus D so a plus C is congruent to B plus D mod M so a lot like that last proof that we did I need to show that M divides it and therefore that they are congruent so I'm
just using a lot of definitions I apologize I didn't write down the reasoning for each of those steps but I feel confident that you could look at our last example and write down those yourself I'm just dealing with limited space here so now let's do the exact same thing I have a C a times C is congruent to B times D mod M so I have to take a times C and a times C would be by substitution B plus K M times D plus L M and again I can do some math some distributive
properties so I have BD plus b AO m 19 BLM plus KD m Plus K L M that's horrible handwriting k L M squared and really I'm just trying to write this kind of in the same way that I did the last one so can I do that is the question well I can say that this is B D plus M times the L plus KD plus K L M so what does that tell me so a times C minus B times D is equal to M times all of that BL plus KD plus K L M and again if I can do that subtraction and that subtraction results in
M times something then M divides all of that so M divides AC minus BD so AC is congruent to be D mod M let's take a look now at those same theorems again and actually use them in an example well before we actually use those theorems though I want to look at just some regular modular arithmetic with you so this one says let's find 7 plus 11 mod 5 if I were to find 7 plus 11 mod 5 then really what I'm going to do is take 7 plus 11 to get 18 and then say 18 is congruent
to so it's not equal to but it's congruent to and then I'm going to think about if I took 5 into 18 what's my remainder and the remainder would be 3 because it goes into 15 evenly with 3 left over so 3 maude five so again notice I switched from equals to congruent to now let's take a look at the theorem the theorem says if a is congruent to B mod M so that essentially they're saying let's take a look at seven what is seven congruent to mod five well if I took five into seven that
would be a remainder of 2 so 2 mod 5 and 11 would be congruent to 1 mod 5 so if I wanted to do this question again 7 plus 11 would be congruent to 2 plus 1 mod 5 which would be equal to 3 mod 5 now let's take a look at our other practice we have 7 times 11 so again without our theorem 7 times 11 would be 77 which would be congruent to 2 mod 5 again using what we learned here we can also say that 7 times 11 is congruent to 2 times 1 which is equal to 2 mod 5 so again
not a proof we've already done the proof this is just showing how those theorems might be used in an actual example I also want to point out to you some different notation that you might see so we already sort of did an example 7 plus 11 and 7 times 11 and I didn't use this notation just because I didn't want to throw something else new in there but notice here if I have the plus with the subscript M that's saying addition mod M same thing here multiplication mod M so just
one more example using that proper notation if I were to take 4 plus 5 mod 3 then again I could turn them both in to mod three first or I could just say and that's what this property says just take four plus five to get nine and then make that congruent to whatever that is mod three so mod three that would be zero mod 3 and again it would be zero because 3 goes into 9 evenly if I were taking 4 times 5 that would give me 20 again notice I'm using an equal sign because it's just
regular math but now if I'm turning it into mod I'm saying that's congruent to and then 3 goes into 20 with a remainder of 2 so it's 2 mod 3 so again just another notation you might see with the mod 3 addition and multiplication coming up next we're going to start to explore some integer representations we're going to start with decimal expansions from binary octal and hexadecimal

Ask anything
We've read this whole study set, so questions about it get the best answers.