 All right so before we get started I want to do a lot today here. You have a kind of a long assignment. Those of you that have started working on it you may have the sense that you really don't know what you're doing or maybe this that you're not sure exactly how to proceed in a nice elegant way and you're you're getting these really crazy big numbers and all this stuff. I'm going to try to bridge the gap here a little bit today so I'm not going to do a lot of proofs. I'm going to do some examples. I'm going to focus more on techniques for solving these problems than I am writing a lot of proofs. I'm going to do maybe one proof but that's about it. Okay so I want you to keep in mind that you do have your next exam coming up next Thursday. Okay so I will tell you this I'm not going to do a new section so we're just going to stay on this section for this week. All right there's a lot of stuff there's a lot of stuff thrown into this and so this is actually one of the few sections where kind of the goal is to apply the theory in order to solve some of these problems in an elegant way and that's that's really what I'm trying to get across this week. So we're going to do some more today that'll enable you to do a few more of the homework problems than by Thursday then you should have enough of the tools to be able to finish the assignment and of course we can talk a little bit more next Tuesday but remember this assignment's not due until next Thursday so you still have plenty of time to finish that. Okay all right let's see so yes yes that's still the plan yeah okay so what I want to do to start with is go over actually one of your homework problems in fact it's the very first one really at this point you're really only equipped to really do the first two based on what I've done in lecture so far so and that you know again I wasn't intending you to be able to do all the problems if you're thinking oh he didn't tell me all this other stuff well that wasn't the intention that's why I've made the due date next Thursday so we can finish this stuff up. Okay so here's what we're going to do to begin I definitely want to make sure I allocate some time to this I think this is probably even more important than moving on it's just getting you kind of a good base for understanding the ideas behind these problems okay so I'm going to talk about just your very first problem number one part a which is to solve I'm not going to write all of this out but you're solving this congruence 25x congruent to 15 mod 29 okay and here I want to try to be somewhat clear about what kind of work I'm expecting for these first of all I want to tell you those of you that have already tried to work through this maybe you've noticed this every single homework problem every problem in 4.4 the solution is in the back and so not the worked out solution but the actual final answer is in the back yeah yes 25x 25x and 15 yes that's right so yeah I mean that there's there's several ways that you can look at this but so one way is just that yeah they both sides have the same remainder when you divide by 29 another way of looking at it which is the definition is that 29 divides 25x minus 15 right they're equivalent really but I think the remainder point of view is going to help you more when you go through the problem so here's what I'm trying to convey I don't first of all if you just give me the answer of course the answers in the back of the book by itself you're going to get almost no points you may not get any points at all because the answer is in the back of the book all you have to do is look at it and copy write it down that that's just not going to give you give you points I want to see some technique that's beyond that of you know beyond what you would have done say in 10th grade when you didn't know anything about congruences I expect you to show me that you can actually apply some of these results to solve the problem not that you're and I you know I don't want to see things like you know x is negative 50 billion and 929 thousand and six or something like that I mean I really don't want it to just be beating on it until you finally get lucky and get the answer I want you to use some techniques and I'm going to show you what I mean here okay you can solve this problem in about three lines okay actually showing the work you can you can do it all without a lot of work you just have to understand that the idea behind it so here's what you're going to do here's one thing that you can do okay now you might say after I'm done with this you might say well how would I know how to do that well that's the whole point though of what I'm going to do this week is to show you I'm going to give you some examples and eventually if you incorporate these ideas you you should start to get this down okay so here's one thing to notice first thing so what is the first thing we want to do the first thing is determine if there's a solution right okay so if there's no solution of course you're done don't you know you you should do that first right because otherwise you're just wasting your time so the first question I'm going to go through this in a little more detail than I will the other problem but is there a solution okay so we've talked about this before right so what's the answer to this is there a solution to this there's something we have to check here right yes what is it that we have to check we have to check to see if the GCD of A and C divides B that's exactly when it has a solution right so the GCD I'm not going to write the and C down here but it just it goes in order right and so or yeah so I guess maybe what sorry it wasn't C it was N if the GCD of A and N divides B right I use the N instead of C I think last time in the lecture okay well what's a A is 25 what's N it's 29 what's this equal to one it's definitely one right for sure 29 prime it's got to be one and of course anytime you get a GCD of one it's always going to have a solution because one divides everything so one's definitely going to divide B one's going to divide 15 I'll just write this out but of course this is true so how many solutions are there mod 29 there's one right the number of solutions is equal to the GCD assuming the GCD divides B right no no it's it's I mean it's fine I mean if you just give me the solution I'll know that you know that there's only one okay so now here's here's the the one of the one of the ways you can go about doing it this is a very short way I'm not saying that this is the only way you could solve it but this is maybe the best way that you can do it that's what I'm going to show you right now okay so what we have is okay here's the congruence that we're given 25 x congruent to 15 mod 29 and so what we're really looking for here we're looking for the solution and I would like you to do this I don't know that I'm going to take points off but I would like you to do this I would like you to give me the solution I would like you to give me the smallest solution in other words don't give me 50 billion and six give me a number between zero and 29 okay and so if you if you have something that's bigger than 29 you just take the remainder upon division by 29 and that reduces it modulo 29 right right 30 for example is one right mod 29 has a remainder of one okay well so and since this isn't approved I'm going to be content with just kind of being a little bit informal okay so this is five times five x right congruent to five times three mod 29 okay now for the sake of time I'm not going to go back and tell you exactly what the theorem numbers are but this is something that is in your nose and I'm going to state it and you can rewrite it again I'm not going to write it down but there is a theorem and this is going to help you to simplify things so what would I like to do okay well I have this congruence 25 x congruent to 15 mod 29 what I want to do and this is I can't overemphasize this what you really want to do is try to make these coefficients the 25 and the 15 you want to try to do some you know use some tricks to make those numbers as small as possible the smaller they get the easier life becomes very roughly okay so once I have this I can actually cancel the fives out on either side now there's okay I want to be very clear on this though it's not the case that you can always cancel that's not the case I want you all to listen to this you can cancel because the five is relatively prime to the modulus and that is in your notes that's a theorem in your notes are you guys with me on this if it's not relatively prime in general you can't do that but because it's prime of course 29th prime so these are automatically relatively prime that's why you can do it is everyone clear on that on that point okay okay and because I want to get through a lot I'm not going to write as many notes down as I normally do because I really want to give you a lot of examples okay now we've got this well in some sense it's a little bit nicer right the numbers are smaller okay now you what's that what did you write okay so what I had before was five times five x is congruent to five times three mod 29 and I cancel the five from both sides because five and 29 are relatively prime okay so now I have five x is congruent to three mod 29 now we want to solve this and you might say okay well I'm just gonna I'm just gonna plug in chug I'm just gonna try one two three four five and just see you know which one works well I'd rather you not do that okay here's what I'm gonna do and this and of course I've done this before but here's the idea okay if you can if you can multiply both sides of this congruence by something so that what you have as the coefficient in front of x is only one away from a multiple of 29 then you can solve it immediately and you'll see this if you're not sure what I mean you'll see it in a second what can I multiply five by well I'm gonna have to do it to both sides so that what I get is one away from 29 six okay right so I'm multiplying by six if you want to write that down so I get 30 x is congruent to 18 mod 29 okay that's also um I think it was theorem 4.2 in your book there are all these sub sort of sub theorems one of them is that when you have a congruence you can multiply both sides but anything you want to cancel anything you want to necessarily but you can multiply by anything you want to you can cancel remember if what you're multiplying what you have factored out is relatively prime to the modulus as I just said okay now well this is not something specifically I think that I highlighted the book kind of glossed over this and I did too because there's so much to do here but anytime you have some product you can always replace any number in that product by what is equal to modulo whatever the modulus is so what I mean here is 30 is 1 mod 29 right it's remainder of 1 when you divide by 29 so you can replace the 30 with 1 okay I don't know if I made that totally clear in the lecture you can do this this is a legal move okay so 1x or just x right is congruent to 18 mod 29 and I'll just write this sort of parenthetically here 30 is the same thing as 1 mod 29 that's that's where this is coming from okay is everybody everybody with me on this replace the 30 with 1 because they're the same mod 29 right okay well now okay remember what we're trying to do trying to find an x between 0 and 29 that satisfies this of course we don't really need the 1 on the outside it's just x right so now all you have to do is and this shouldn't be very hard if you just remember what this congruence relation means we're trying to find a value of x so what is what does this mean what does this mean this means 29 divides x minus 18 what's the simplest value of x you can pick between 0 and 29 so that 29 divides x minus 18 18 18 right it's 0 29 divide 0 so once you've got x isolated it's easy you just take x to be whatever the number on the right hand side you're done you guys are you guys picking this up here take x to literally just be equal to whatever that number is on the right because so just I want everyone to think about this for a second I just want to reinforce this idea of congruence plug in 18 for x what is this assertion 29 divides 18 minus 18 that's definitely true because it's 0 okay so there's your solution x equals 18 now you see and maybe some of you have started to do this this homework maybe you did a page and a half of work and you had negative 50 million or something coming out from testing all these things I don't want you to do it that way I want you to be slicker than that okay I'm looking for you to incorporate the techniques some of these techniques so that you can solve it in a I mean I can't make this overly precise but what I'm looking for is a solution that is not the same as a solution that a tenth grader would have given that's never taken this course that's what I'm looking for that's the best way I can say it okay like what I did here you see that this pretty elegant right okay that's that's the kind of stuff I'm looking for you guys to do that's the point of this of this section is to solve them in a more sophisticated way okay that's what that's really what I'm looking for any questions about this solution okay okay so the congruence was 25x is congruent to 15 mod 29 okay so I can I can factor out a five from the 25 and I can factor out a five from the 15 right okay so that's I was getting that so the point is there's because five is relatively in 29 or relatively prime 29 is the modulus I can cancel the five out if you know that you have a number on both sides multiplied on both sides that's relative that's relatively prime to the modulus you can cancel it out from the congruence and if there's more than one I can choose any one I want sure sure yeah yes here unless you do a little bit more right yes yes and if you do that if you uh if they're not relatively prime so you cancel them and divide by the gcd have you ruined anything about the kind of solutions you're gonna get I know you have to scale it back up oh okay I see I see what you're saying yeah yeah yeah so um yeah I mean you can uh let me see let me let me find it let me find the reference here I don't want to spend too much time on this but theorem 4.3 yeah yeah right right so the point is though that yeah I mean no you you can um so okay so the point is that you can divide through by anything as long as it divides a b and n you can divide through by everything but the point is that uh and it doesn't change the it doesn't change the change the solutions it's just that once if there's more than one solution to the congruence you have to remember that okay I'm gonna try not to get too far ahead of myself um if you have any number that divides all three you can divide all three of them by that number and you have the same you're gonna get the same solution but you have to remember that you're trying to solve the original congruence so when you add the n over d you have to add the n over d from the original congruence not the original n not the new n does that make sense okay so that's the thing you have to be careful about yes yeah yeah yeah okay okay so part b you're saying yeah okay well let's talk about it real quick then okay and then I'm gonna have to go on to something else here but um does anybody else have any questions about part a no okay so part b is um five and actually I think this is a little bit easier but uh but yeah it's a slightly different idea five x's congruent to two mod 26 okay and I'm not going to write everything out here you you guys will need to fill in some of the details um if it were up to me I would go through every little detail here but we'd be here for three hours and so I can't I can't do that but um so the same question is okay does it have a solution well what's the gcd of five and 26 one one divides two of course has a unique solution again has one solution right okay so unique solution okay well again so let's let's kind of try and in your right but let's try to incorporate the same kind of strategy here and what we're going to try to do if possible is well in this case of course we saw that we got a coefficient of one if we get a coefficient of minus one that's also just good really and you'll you'll see what I mean here in a second so what can we multiply both sides by so that the coefficient in front of x is close to 26 well five right okay okay so then we get I'll just write this out so this is 25 x congruent to 10 mod 26 therefore okay so now yeah so now the question is um you so this this is I mean I guess maybe the the stretch a little bit here maybe for some of you at first so you might say okay well 25 what's the remainder upon division by 26 25 so you might say well I can't do anything with it because it's just 25 well the trick here is that 25 is the same thing as minus one mod 26 and again think about what the congruence means what does it mean for 25 to be congruent to minus one mod 26 it means 26 divides 25 minus minus one which it does because 25 minus minus one is 26 so you can remember that you can go into the negatives to make your number small you want to make the number small in magnitude they don't necessarily have to be positive but we want to reduce these down as much as we can that's the rough strategy here okay so this becomes minus x is congruent to 10 mod 26 right okay well now okay I'm running out of room here but um let's see ah crap and do that again okay you think it would learn this at some point but um okay so well now what do we do okay can we choose x to be 10 does that solve this no it doesn't yes you could you could yes you could definitely do that or yeah I mean you can I'm going to do basically the equivalent of what you're saying um well we want everything to sort of zero out like we did before well we can't use 10 because then this is just asserting that 26 divides minus 20 which it doesn't but we can choose x to be minus 10 right because then it's just then this just becomes 10 congruent to 10 mod 26 and that's true because 26 divides 10 minus 10 it's zero okay so let's take x to be minus 10 well okay and really this is okay I would like you to put your solution between zero and 26 okay but so then then you have to just be able to say okay well what what is minus 10 modulo 26 really all you're doing is you're just asking yourself what do you have to add to 10 to get to to get 26 that's all you're asking okay and so this is the same thing as what mod 26 16 right and again if you're not sure just check it you you shouldn't you shouldn't um well let's see sorry I'm being a little sloppy here that's what I really mean okay all you have to do is ask yourself okay is it right does 26 divide minus 10 minus 16 well what is it minus 26 yes 26 times minus 1 is minus 26 this is definitely correct okay so when you're so just to be clear though when you're trying to say if this is at all confusing minus 10 what is it you're looking for all you're all you're doing is you're just subtracting 10 off the modulus that's all you're doing that's it okay is this okay okay well hopefully this is helping a little bit just to see kind of where you were going to go with these these problems okay what I'm going to do all right I'm not going to get to some of the stuff I'm not going to get to but I definitely want to talk about number 2 a because this is the book gives you a hint here but but I really need to do an example of this I think okay does everybody have this down now yeah okay all right I had a few people email me about this number two way so once you see the the idea here the book gives you a hint but they don't really explain where this hint comes from so if you've looked at this you might be a little confused as to what they're saying so now you're trying to solve this what's called a diophantine equation and we skip this section but it's not you might think oh well he skipped this he's screwing us now no I'm not really not okay nothing really is I mean it's just the hint that that's really what you're supposed to follow here okay so what does this mean well you've seen stuff like this in linear algebra and most of you've probably taken linear algebra I'm guessing in fact you've probably had problems like this you may have forgotten how to do this but what you would do is you would say okay well there's more variables than there are equations there's going to be free variables here I'm going to let y be t and I'm going to solve for x and so t can be anything and then x is determined by t not that easy here because the point is in linear algebra you're solving this in the real numbers now you're solving it in the integers so you can't do that anymore oh this is a linear algebra problem man I'm slick I took a linear algebra I can solve this in one line no it doesn't work that way no of course not so here's what we're going to do okay so we're going to just suppose and I'm going to kind of walk you through this suppose that x y and what we're going to do this in the same sort of notation that that you probably use in linear algebra well what's the solution it's a value of x and a value y I'm going to write it as an ordered pair you don't have to do it this way but it's I mean this is just sort of a standard convention so let's suppose that x y is a solution and we're going to see what has to be true of x and y okay so I really want you guys to really try to think about this as I go through it so that you'll understand where this hint comes from then so the first thing we can observe is that this is very simple 51 y equals 9 minus 4 x right that's not too hard you guys buy that pretty easy hence 51 divides 9 minus 4 x right because okay I didn't say this explicitly but of course the solutions are integers they're integers right so 51 times something is 9 minus 4 x so 51 divides 9 minus 4 x okay and maybe I should have written it the other way but here's the here's the first step that you want to take thus 4 x is congruent to 9 mod 51 I should have probably put everything on the other side so you can see this a little bit better but this is the point where I want you guys to think about this and make sure you understand this okay what does it what does this mean this means that 51 divides 4 x minus 9 well of course what I have is 51 divides 9 minus 4 x but if I multiply both sides by minus 1 I get 4 x minus 9 and there's a theorem that says if a is congruent to b mod n the b's congruent to a mod n it doesn't matter what the order is right so this is where this first congruence comes from I think they give you in the hint in the book okay it just comes it just comes from the fact that 51 divides it that's it okay so now we can use what we know to solve this congruence right okay so what can we say about here let me let me put a little start down underneath this an asterisk does this have a solution does it have a solution I want you guys to be thinking about this anyone yes definitely does right 451 or relatively prime they're relatively prime um so it has exactly one solution you guys remember this right I mean that what you're testing is the gcd of this and this dividing that that's what you're looking for and whatever the if it if it does the number of solutions is the gcd um so this has a unique solution and again when I say unique solution of course what I mean is mod 51 in other words there's exactly one number between 0 and 51 that makes this true okay now just because this is actually not that hard the number is already really small um that x 0 equals 15 it solves this congruence right this one I mean it turns out the numbers aren't very big here and so you know you can just kind of go through them um when you plug in 15 you get 60 60 minus 9 is 51 so 51 divides it right well I'll tell you because I'm trying to make a point here in a second okay x itself does not have to be 15 that's the that's why I'm not writing x equals 15 x can actually be x can be there an infinite number of possibilities for x but there's only one one number between 0 and 51 that solves it and that's 15 I'll I'll say something more about this in a second but so what do we know about x then so here's the here's the point remember okay four x is congruent to nine month 51 x is whatever x is x is a solution to this congruence right here but I also know that x not equals 15 is the canonical solution between 0 and 51 so what does that tell us there's a theorem I that said when you have this congruence you know it has a solution if and only if the gcd of a and n divides b and call it d there are exactly d solutions every solution is congruent to one of those modulo n since x is a solution to this x has to be congruent to 15 modulo 51 that's the point okay every solution remember there's this canonical list of solutions between 0 and the modulus every solution even the ones that are outside of it have to be congruent to exactly one of those guys that's part of the theorem that I gave you we didn't incorporate that specifically yet but we are now x is a solution the only solution mod 51 is 15 x must be congruent to that one solution because there's only one possibility yes mm-hmm yeah well well this is the one that I just didn't want to spend the time talking about the technique because I wanted I want to get through it these techniques that I've told you in the last two problems you know these these are still yeah but I just I just don't have the time to go through all that here I mean that's a good question uh well I mean this is where it gets really sticky because I mean you know where where does it where does it become unreasonable to just sort of do the guess and check method you know I don't have a great answer to that but you know in general when the numbers get really big this is when I kind of expect it you know I can say more about what I'm expecting later but I want to just get through this now but I mean it's a good question I just don't I just need to really get through this okay so since x is also a solution and 15 this is the this is the point I want to make 15 is the unique solution mod 51 we must have um x is congruent to 15 mod 51 okay again remember this is the part of the theorem that we haven't really used yet there are exact d's the gcd it divides b there are exactly d mutually incongruous solutions modulo and every solution even the ones that are out bigger than n or negative every one of those is congruent to exactly one of those guys mod n and because there's only one x has to be congruent to 15 because that's the only one there is okay okay so and here's where the next part of the hint comes from this may be seem mysterious at first but now we're just going to use the definition of congruence okay hence 51 divides x minus 15 right so say 51 t equals x minus 15 for some for some integer t right so if we solve this for x we get x equals 15 plus 51 t unbox this we're going to use this in a minute does this make sense you see I'm just using the definition of congruence it means 51 divides x minus 15 that means 51 times an integer is x minus 15 solve it for x not that it's not that bad really now we're going to do the same thing the other way we also have another congruence going on here um let's see so um uh this is sort of maybe you can start a new paragraph here I just want to use all the space here um I'm going to skip one step here but uh I want it to take a second to make sure you understand this four divides nine minus 51 y that's that's just from the original equation do you guys see that just subtract the 51 y then you get four times something is nine minus 51 y so four divides it and we're just going to play the same game you do the same thing 51 y then is congruent to nine mod four right again I kind of did this backwards but you know again this just means what is this thing this says that four divides 51 y minus nine it's true it's just multiplied by minus one on both sides okay well again so is there is there a solution to this yes right what's the gcd of 51 and four well it's the same I mean it's just things are the only difference here is that the numbers just got interchanged the positions just got flipped right so yes there's a unique solution again now it's modulo four okay well now we can employ our our tricks here because this is going to be really quick um we can reduce we don't really need to worry about multiplying by things four is already a really small number let's just reduce the big numbers mod four to get things to get numbers between zero and three right 51 and nine we can reduce both of these mod four to get very small numbers and it's very easy to solve right okay so somebody tell me what is 51 mod four what's that three right hopefully you guys are getting this I expect you guys to start to get this stuff down okay you're just dividing 51 by four and asking the remainder well four goes into 48 and 51 is three more than that so there's a remainder of three when you divide by four 51 is three then right and nine is one right when you divide by four you have a remainder of one okay so um this just becomes three y it's congruent to one mod four and i'm going to do the same thing what's the sort of canonical solution to this i'm going to again i'm going to call this y sub zero what do we want here what's our solution i'm looking for a number to plug in here so between zero and three so that four divides this minus one that's all i'm looking for three right i hope you guys are if you're not i want to answer questions i really want you guys to be picking this up here you plug in three we only have to you only have to test you have to test four numbers zero one two and three three is the one that makes this congruence work out okay so so this solves the congruence so then i'm just going to say as above then because why is a solution um see if i can squeeze this in here so then y is congruent to three mod four right okay that is really okay sorry about that why is congruent to three you can't really make this happen three mod four okay right because y was also a solution to it and there's only one mod four so y has to be congruent to that one that's why i'm writing this down part of the theorem that i gave you i'll wait till you guys get this uh any questions so far by the way no how much does everybody have this down now anybody need some more time no i can go to the next page now okay okay so you don't need to write this down again i'm just writing it down so that you see where we were so y was congruent to three mod four i just wrote that down so this implies that four divides y minus three right and again we're just going to do exactly what we did before so we're just going to write this out now um so then we can say that say four s equals y minus three for some s in z right hence if we solve for y we get y equals three plus four s and i think maybe this is also is in your book as in the hint part i think gave you this then i think the last part of it if i remember i said find the relation between s and t or something like that right um okay well you're not done yet so what you want to get is so you've got these two variables floating around but there is a relationship between them and you want to find out what that is and so um here's what you do uh and you may have remembered this um maybe from calculus or something when you did implicit differentiation a couple of times and find found the second derivative with implicit differentiation you did something like this um well what was the original equation four x plus 51 y equals nine right that was the equation we're trying to solve okay so here's the point now i'm gonna write it i'll write down some of the details i won't write down everything but the point is this is x and y in the very beginning were chosen it was chosen to be a solution to this so x and y satisfy this equation just by definition that's what they are so once i know what x is in terms of t and what y is in terms of s now i have an equation i can solve for one in terms of the other and so now s and t are now related and i can reduce this down to a single um parameter instead of two parameters and i'll show you how this goes it's not anything deeper than what you did in linear algebra it's at this point it's just basic stuff okay um so let's see so um four times make sure that you you see where i'm getting this what was x it was 15 plus 51 t and y was uh we have that above three plus four s right okay you i really encourage you to pause and make sure you understand where i'm getting this right solve for x and t before right i'm just plugging them in now into this equation okay now i'm going to i'm going to spare you the the basic eighth grade stuff here but um you can all do this i'm confident you can all do this you multiply this out simplify what you're going to get is 204 s actually i'm going to do one step before plus 204 t uh plus 204 equals zero that's what you get when you multiply this out you bring the nine over it just gets it's very simple okay i assume you all know that you can do this yourselves okay i don't want to use class time on this so of course i can cancel out the 204 right i just get s plus t plus one equals zero and therefore s is equal to minus one minus t so now what's the solution now i can actually tell you what the solution to this to the system is okay everyone see what i did here okay so you have to be careful though okay your solution is x and y now okay i'm just instead of writing it the ordered pair i'm just going to write it this way so x we already had uh as 15 plus 51 t right here's where you have to be a little careful okay once you guys pay attention to this this is going to about two of you or three of you this will screw you up if you don't pay attention to this part some of you probably two of you are going to say y is minus one minus t that is not true y is three plus four s s is minus one minus t y is three plus four times minus one minus t you see that be careful at the end okay and this ends up being uh minus one minus four t so there's your solution so what is this really saying um i want you to sort of put this in back in perspective here your problem was to solve the equation for x plus 51 y equals nine um this is the this is a problem like in linear algebra you're trying to find all integer solutions not just the one's modulo something all of them okay so remember what you did in linear algebra right when you had parameters what could the parameter they could be anything they could be any real number in this case the parameters t and it can be any integer that is exactly what the solution said it's an infinite set t can be any integer that's that's understood does that make sense okay yes oh right yeah so i mean if you if once you've got yeah once you've got x you can you can solve for y just using the original equation yes absolutely yeah you can do this a little bit more quickly the reason why i did it this way is just again sorry is just to reinforce this idea this congruent solution idea in practice that's the way you would do it you wouldn't do it all this work but i'm doing it just to again to get everyone comfortable with this congruent solution idea okay but yes you're right you're absolutely right okay yeah yes yes and so the point is if you for example if you plug in zero for t you get minus one um let's see what's happening here um yeah yeah yeah so so right so x is 15 and then uh y is minus one and if you do if you look at this right you you you plug this in you you get i mean you see it satisfied right okay and you can do this for any value of t it's going to work okay i spent a lot of time on that um so is this okay all right so what i'm going to do now now you basically should be ready to do the first two problems at this point i'm going to do uh the next part of this section called the chinese remainder theorem there was something else i was going to do i'm not i'm certainly not going to have time for that um but i am going to talk about the chinese remainder theorem i should be able to finish that and then you will be able to do a couple more problems then i'll do on thursday what i did today i'm going to try to go through a couple more problems give you some tips and then we'll finish off the section on thursday okay all right okay so now i'm going to get back to section four four um i'm not really doing a whole lot today but um hopefully going through some problems you found to be helpful i hope i could be wrong if i'm not remembering a theorem but i think this is just theorem one if i'm wrong you can tell me is it theorem two okay thank you sorry i was wrong there we go quick fix all right as you know i don't really like erasing i'm still not i don't know if i remember how to do it so um theorem two chinese remainder theorem okay um how many of you saw this in discrete math maybe some of you did a couple of you did okay all right well most of you haven't seen it yet um so this is going to unfortunately i have to state it's in general you're going to see a lot of letters here but um i'm hoping to explain this in a way so that you at least kind of understand the gist of what this is saying so here's the statement so we're going to let um i'm just going to follow the books notation n1 n2 on down to n sub r be positive integers suppose and this is an important condition suppose also that okay the gcd this is a little abstract here of n sub i comma n sub j is equal to one for i not equal to j and i'm going to pause here for a second so i want to make sure that this makes sense again i have to state this in the general form here so this is why i need all these indexes all this is saying this is all this is saying is that if you pick any two different uh any two distinct um numbers from this list from n1 through nr that they're relatively prime that's all it's saying that any two of them are relatively prime okay then yes yes it's a set of these are going to end up being the the the moduli of a system of congruences because we need this supposition in order for the theorem to be true so this is sort of like saying you know um if x and y are even then x plus y is even but we had to have that assumption in order to know that x plus y was was even because if we didn't assume that then maybe it wouldn't be even right i mean sometimes you you have to impose some conditions in order for the conclusion to be true i mean it's it's not the case for example that the sum of any two integers is even that's just not true so we have to say we have to make some restrictive condition in order to guarantee that the sum is even and so in this case we have to make this restriction in order to get the result that we want does that make sense okay okay so now we're going to be looking at uh multiple congruences now instead of just solving one we're going to be solving a bunch at the same time then this system x congruent to a1 mod n1 x congruent to a2 mod n2 and we're just going to this is just going to continue all the way down to x congruent to a sub r mod n sub r okay has a i'm just going to say this just to be clear what do i mean by this hopefully from linear algebra you know what this means it means the value of x that satisfies all of them at the same time right what's that well no no because the solution is just actually a single number it's not it's not actually a vector it's just we're just looking for one number that we plug in for x that makes it all all of them true i mean yes you could think of it as a vector but it's just a it's just a one-dimensional vector right but but no i mean it's not it's not a vector because these these x is on the other side don't don't vary there's just one of them there's just one and the solution is also unique mod the product of all these guys n1 times n2 on down to n sub r okay so the only thing i really need to do here and this is something i really have to do because you're going to have you're going to be using this um the an idea and the proof in order to solve some of your problems i'm just going to show you what the solution is i'm not really going to do much with as far as the proof goes but you should know how to get the solution because you're going to use that in some of your homeworks okay so it's a little tricky but it's really just an algorithm you can just follow it i mean there's a very specific way to come up with the solution here all right here's the idea okay yeah yeah okay so right so let me just say this again here so we're trying to solve the following system x is congruent to a1 mod n1 x is congruent to a2 mod n2 x is congruent to a3 mod n3 all the way down to x is congruent to ar mod n sub r uh no i have i have so that that system that i just said has a solution and its unique modulo the product of all of those moduli and one times n2 all the way down to n sub r yes given the fact that any two of those n uh numbers are relatively prime yes yeah yeah it's there's a lot there's a there's a lot of notation here but but yeah that i stated all of it now yeah yeah yeah exactly right once you've got the indices down yeah that's right okay so here's the idea all right so and and this is important you really kind of need to know how to get the solution like i said so we're gonna let n just to simplify the notation n is going to be n1 times n2 times n3 you know etc on down to n sub r okay and now for each k it's assumed k is an integer now for each k with uh k between one and r one less than or equal to k less than or equal to r in other words we're gonna let capital n sub k and this is actually a lot easier than it looks at first be um n1 times n2 all the way down to n sub k minus one times n sub k plus one on down to n sub r okay i'm in just for the sake of time i'm probably not going to write this but i'm just going to say in words what this capital n sub k is capital n sub k is simply the product of all these ends with the with the little n sub k thrown out that's all it is so for example and capital n sub one would be n2 times n3 times n4 all the way down to nr right capital n sub five would be n sub one n times n sub two and sub three m sub four and sub six seven eight nine right you're just you're just simply throwing out the k n in these okay okay then here's the thing to note that the gcd uh we're almost actually going to be done here in a second the gcd of capital n sub k and little n sub k equals okay and i want you to think about this for a second i'm going to spend just a little bit of time on this this is kind of the the crux of the proof here although i'm not writing out a proof i'm just going to tell you what the solution is okay so how do we figure this out okay well remember what we know and just just to fix this let's just make this a little bit simpler so let's suppose that r was five okay um well capital n sub let's say k is one okay well what what's capital n sub one it would be n sub two n sub three n sub four and sub five and then this is n sub one all of them are pairwise relatively prime so if you take any two of them they don't share any common factor okay so the question is what can you say about the gcd of the product of everything but n sub k and n sub k that's really what we're looking at here it does have to be one what's that that's what this is yeah well no no no no the gcd is not little n sub k actually um the gcd is equal to one okay let me let me i want to say something about this really quick okay and i really would like you guys to think about this is going to help you in the in the problems i think why does it have to be one well suppose it wasn't one so this is bigger than one well then in particular we'd have to have some prime that divides both of them right if the gcd was four or whatever well two is a prime that divides four so there'd have to be a prime that divides both of them well see that's the point though if the gcd was bigger than one there'd be a prime that divides this and this well okay sorry i was trying to simplify this to letting rb five that i'm kind of going back away from that now because i don't think that's really helping anything well what if a prime divides this and this well the prime divides n sub k and it divides the product of all of these n sub bytes that with with this the k removed but what do you know if a prime divides a product it divides one of them right but since the n sub k is not in this product that prime would have to divide something n sub something other than k and n sub k that contradicts the fact that those two guys are relatively prime okay i know that kind of flew over some of your heads probably but the point is that's that's kind of how we make this work because this product does not contain n sub k so if a prime divides them both the prime will have to divide n sub k and something other than n sub k in that product that contradicts the fact that whatever those two guys are relatively prime that's why the gcd is one yes but big big n sub k is the product of all of these n sub i's except with the n sub k missing that's why that's what this is denoting is that the n sub k term is not in this product yes no no it's actually one of these guys up here yeah okay so that's that's why i'm not writing it all out but that's why the gcd is one okay so well um so what can we say about this congruence by the way i know this is probably getting really heavy now but we're almost done really we are almost done um n sub k x congruent to one mod um n sub k okay that's a little bit abstract now but i want you to i'm gonna ask you a question look at what we have on the screen here does this congruence have a solution this is just a single congruence now now we're going back to what we've already done before why because the gcd of this and this is one right and one divides everything so and then of course again because the gcd is one that's how many solutions are there's a unique solution there's only one modulo n sub k little n sub k i should say right so this uh congruence i'm just going to abbreviate this uh has all right i'm sorry i'm getting stuck here has a unique solution i'm going to call this um x sub k mod little n sub k i only have one more sentence to write and then we'll be done i'll wait till you have this down okay so how much more time do we need here you guys got this i need to wait a just a few seconds so i can if you need me to you good okay all right so i wish i could throw this all on uh a single page here but um here's a solution i'm going to call that i'm going to put a little bar over this just to for clarity here a one capital n one x sub one plus a two capital n two x sub two plus all the way down to a sub r capital n sub r x sub r is a solution to the system and as i said well in the statement of the theorem it's unique modulo the product of all of the moduli and one times n two on down to n sub r i was going to prove that but i i get the sense that your brain might be overloaded at this point i don't think i'm going to do that um it's not hard to prove that it's unique but i won't i'm not going to do it um okay so just to recap remember what the a sub i's were these were the coefficients on the right hand side of the congruences okay capital n right we define those right so product of all the little n sub i's except for whatever that that subscript is thrown out that one thrown out and we know what the x one the x one x two x threes are right there the unique solutions to those corresponding congruences that i just defined on the at the bottom of the last page so all of these things i have up here i've defined for you previously and so you just have to compute it that's it okay um i'll tell you what i'll tell you what i what i may do here um and i know you probably want to leave but i think just because this assignment is you're going to find that this this is going to be a little tedious and it's going to be a little tricky i think i'm going to do i'm going to talk about one more homework problem before we go okay i mean it's only 10 minutes and i it's really going to be to your advantage i think okay of course if you want to just walk out you can if you want to i just know what's that okay okay okay okay so i i'm still what i could do at this point is do a problem that involves this but i think what i'm going to do is just just because i want to saturate your brain with with these fundamental techniques as much as possible i think i'm still going to go back to number one and talk about another one of these problems we'll talk about some of these on thursday okay and again remember you have a week and a half before this is due so you saw we still have time to do this okay um yes yeah yes yes yeah so this this is what the solution is to that system it's this in practice it's going to just require some computation but if you follow through what i what i gave you it tells you exactly how to find it um and we'll talk we'll definitely do something like with this on thursday for sure i just don't know if i have time to go through one right right now so okay so this one is actually the book gives you a hint this one's a little little trickier one f is to solve and this is another one where i think it's important for you to see this technique because now the numbers start to get a lot bigger 140x congruent to 133 mod 301 and if i don't finish it i'll at least have gotten you started on this 140x congruent to 133 mod 301 yes okay so again remember and the book gives you gives you a hint here um of course you could figure this out probably yourself but the gcd of 140 and 301 remember that's always what you check first right is seven i think the book gives you this and you can check that seven divides 133 i think it's seven times 19 or something like that this is 133 so um remember that's that's always what you do first every single one of these you always do this first if you probably have one at least one of these probably the gcd doesn't divide b in which case you're done you can say oh okay no solution all right so how many solutions are there seven right so yeah yeah absolutely yeah of course yeah so once you know once you know one of them then you just add n over d and then you just keep doing that until you get all of them until you and of course you stop once you have the seventh one okay so um now what can we do to to simplify this so we have 140 x congruent to okay 133 mod 301 okay now what you should be thinking again is just everything you can do to try to make these numbers smaller that is what you're trying to do and again if you can get the coefficient in front of x to be one or minus one then you've got and then you're really in good shape well um what can okay anybody have any ideas of what we can can do here and then I'm going to tell you it doesn't involve multiplying by anything at first divide everything by seven remember you can always do that you can so remember what I said before if you can factor out something from both the coefficients that's relatively prime to the modulus you can just cancel it out and leave the modulus the same but you can always divide through by as long as something divides all of them you can divide everything through by whatever you want okay yes but you have to do it to the modulus too yeah so I want to be very clear this is this is I think I gave this to you as a lemma I'm pretty sure um so divide by seven and again when I say divide well it'll be clear right I'm dividing everything by seven so um this gets things down reasonably well to smaller numbers so 20 x is congruent to 19 mod 43 okay now it's just going to be another kind of trick that we did before really uh yeah no no so you have to be careful that once you get this solution here that um oh sorry sorry so um yeah so about any integer x is a solution to this if and only if it's a solution to this so yes sorry these have the same solutions but when you your ultimate goal is to get all the solutions modulo 301 so when you actually get a value of x here you're going to be adding n over d but the n is the original modulus 301 okay that's that that's the important thing that you you want to remember okay because that's that's the that's our goal is to get all of these modulo 301 um so now we've got this now okay so what is it that I said I said try to multiply by something so that you can reduce these numbers down these coefficients down to significantly so you can get something in smaller magnitude maybe positive maybe negative right um but there is something we can do here there's actually a number we can multiply by that's not very big yes you um you said if we could get it to where one was to where um for example this we have the situation now where the the 20 is exactly one more than the 19 right which wasn't that the no no no no no no what we wanted was the I mean if possible it's not always possible for the number to be one more than the modulus the modulus is 43 in this case okay so in this case well there's no nice simple easy way to do this but we can at least model there's something we can multiply by so that we can reduce these numbers in magnitude a lot anybody anybody think of what we can use yeah two two we can just use two okay okay now we're not multiplying through the modulus now we're just okay so what do we get when we multiply by two we get 40x congruent to 38 mod 43 right and remember remember okay can't stress this enough you have negative numbers at your disposal these actually will help you okay what is 40 mod 43 remember one way of thinking of it okay well it's the remainder the remainder is 40 you can't change it well yes but if you use negative numbers now 40 is the same thing as minus three right and 38 is the same thing as minus five so now we've reduced the magnitude down quite a bit yes wait say that again 20 and oh okay so yeah I mean you can you can always multiply by anything you want anytime you have a congruence you can multiply both those those coefficients by anything and it's still preserved you can always you can't always divide okay so the point is you can multiply both sides both of those coefficients by anything you want to as far as dividing you can divide through by a number that divides all three but then you have to divide all three by that number but if what you're if you factored out something from both of these that's relatively prime to the modulus you can cancel it so those are the three things that you can do negative three yes oh yeah sorry thank you thank you okay you guys are you guys with me here the 40 and the minus three okay all right so okay so now you've got these small numbers and so at this point what is it you're looking for well you're looking for a value of x between zero and 43 okay I'm going to so we need I'm just going to summarize this really quickly so what we need now is we need 43 to divide five I'm going to just shuffle the algebra around a little bit five minus three x right okay I mean minus three x minus minus five is plus five we'll just put the five on the other side well now you might think oh well this is hard but it's not really now because you can eliminate all these numbers really quickly because they're just not big enough right plug in zero what do you get you get five plug in one what do you get you get two right plug in two what do you get minus one plug in three see these numbers are too small for 43 to divide it so you can eliminate all of these just by inspection right away because they're just too small okay you see that so really it you can immediately skip to you know yeah I mean but in this case you can go through it really quickly right I mean for example plug in 10 what do you what do you get minus 25 43 is not going to divide it it's not big enough so you can immediately go go past those and it's pretty quickly this isn't actually that hard you can see that 16 is going to work is going to work okay 16 times three is minus three is minus 48 so you get minus 43 and that's it but you can see that you can do this really by inspection really quickly without calculators and these big numbers now no no no I mean at this point I can say okay will you use some of the theory to break it down to something manageable and you can just eyeball it and it's easy really at this point I went through that fast because we're running out of time here but we need 43 to be able to divide five minus three x right so the congruence we had before was minus three x is congruent to minus five mod 43 so when we subtract the minus five over becomes plus five and that's where the five minus three x is coming from right yeah because it's just not big enough and that's what's helpful having the small numbers is because you can eliminate a lot of the smaller ones right away okay and so 16 will work this isn't that okay I'm going to stop here this isn't remember there's seven solutions so right so you have to add n over d to this you have to add three oh one over seven right to get and you just keep adding that until you get all seven of them of course the solutions in the back of the book anyways but this is this is how you go about getting the first solution so yeah it is yeah it is so you're just adding 43 enough times to get seven solutions so hopefully this helped you out a little bit now you kind of have a better sense of how to proceed with this stuff so no new homework right that's that I'm not adding to your assignment that's it okay so then Thursday we'll finish this up we'll do some more problems okay but I would just encourage you to get working on this before too late because you do have your exam coming up next week okay yeah okay so the 38 is the same same thing as minus five mod 43 yeah if you take 38 minus 43 you get minus five modules Oh yeah yes I'm not going to be allowed to do what makes