 In this video we're going to state and prove the Chinese remainder theorem and actually show how one can solve a system of modular congruences using the Chinese remainder theorem. Now in this video we're going to take a very group theory perspective to the Chinese remainder theorem as opposed to the number of theoretical perspective many people take. So the version of the Chinese remainder theorem that we're going to state and prove is actually a little bit different than what one might expect if you saw this in a number theory situation. So we actually are going to find it and prove it with respect to cyclic groups. So the group Z4 cross Zm, so this is the direct product between the cyclic group of order n and the cyclic group of order m. So the group Zn cross Zm is isomorphic to Zmn if and only if the GCD of n and m is equal to 1. So this statement right here gives us a necessary sufficient condition for when the direct product of two cyclic groups is itself a cyclic group. Now to see the proof the first thing to observe here is that when you consider these two groups the cyclic group of order n times n versus the the product of the cyclic groups Zn and Zm these are both groups of the same order right. So the group Znm that cyclic group clearly has order Z is clearly going to be order nm. On the other hand when you take the direct product of a excuse me take the order of a direct product that's always equal to the order of G times the order of H which would then be n times m. So these are both abelian groups of the same order. So to prove to prove this statement we just have to determine under one conditions is Zm times Zm cyclic. So we want to show that that Zn times Zm is cyclic if and only if the GCD is in the GCD of n and m is equal to 1 okay because every cyclic group is uniquely determined by its order that is if we can prove that this group is cyclic then since they have the same order that would then force an isomorphism between those two. So let's investigate why Zn times Zn would be cyclic if and only if the GCD there is 1. So for the sake of simplicity let G be a shorthand for this group Zn times Zm and let's take an arbitrary element inside of G so we're going to take k comma l as this element. Well in the previous video we proved in fact how to compute the order of an element in a direct product. So let's say that the order of the first term is r and the order of the second term l let's say that's equal to s. So then the previous video we proved that the order of the order of this pair k comma l is going to be the least common multiple of r and s. So in particular we see well also since k has order r and k belongs to Zn then by Lagrange's theorem we know that r divides n but by similar reason since l has order s and l belongs to the cyclic group Zm that would imply that s divides m. So since r divides n and since s divides m the least common multiple of r and s is going to divide the least common multiple of n and m. So this condition right here tells us that any any common multiple of n and m will also be a common multiple of r and s. So the smallest common multiple of r and s will divide the smallest common multiple of n and m. Okay so that's where we are right now and notice that the significance here of the LCM of r s is because it's the order of the element and play right here. Well the order of every element in g divides the least common multiple of n and m because we know we know that everything in Zn if you raise it to the nth power will give you the identity and everything in Zm if you raise it to the nth power gives you the identity. So if we take an element such as k comma l and we raise it to the LCM of n and m power right here this will equal the identity because any multiple of n will send k to the identity and any multiple of m will send l to the identity like so. So raising something raising something to the LCM of n and m will give you the identity if you're inside this group g that's that's a completely completely legitimate statement and that's you know that's where we can derive statements like this from. Okay so come down come down to this observation right here. So this observation right here tells us that the maximal order of any element in g is going to be the least common multiple of n and m. In group theory this is referred to as the exponent of the group that is the smallest number for which every element raised to that power gives you the identity. Okay so a quick example of what I mean by that here is if you take the cyclic groups oh sorry take the abelian group Z4 versus the climb four group right in the and the cyclic group the exponent is of this of the group is going to be four because since you have an element of order four particularly like one in three though there's no order that'll get the idea smaller than that. On the other hand if you take like the climb four group let's call the elements a b and c this group has the property that the exponent's actually equal to two but because if I take a squared or b squared or c squared or of course the identity squared this is always equal to the identity. So the group has order four that's how many elements are in the group and if you raise something to the fourth power you get the identity but it turns out a smaller number can do it for the entire abelian group and this is the exponent here. So what we have going on here in this conversation is that the least common multiple of n and m one could make the argument is the exponent of the group but if we want the group to be cyclic the the if you want the group to be cyclic the abelian group be cyclic then the exponent of the group has to equal the order of the group that has there has to be an element there has to be an element g whose order is actually the size of the whole group that's what's necessary to be cyclic. So let's for the sake of contradiction suppose that the least common multiple of n and m is strictly less than n times m that would suggest that there cannot be an element of order nm and therefore the group cannot be cyclic. But what's the relationship between LCMs and GCDs? Well we know that if you take the product of LCM and GCDs that's equal to the product of the two numbers n and m which you can then write it as the LCM of n and m is equal to mn and the GCD of nm. So if this inequality was strict that means the GCD can't equal one so the GCD is some positive number that shrinks this product or this fraction down to give us the LCM here. So the LCM is strictly less than the product only when the GCD is not equal to one so under the condition that the GCD is equal to one then that means that the LCM of n and m would equal m and n and therefore in that situation we would get that the exponent and the order are actually the same thing and in particular what we saw in the previous video the order of the element one comma one is going to be well we saw that it's equal to the LCM of m and n and so those two things are the same thing that would mean that the order of this element is the order of the group so it's cyclic and these of course are only equal to each other when the GCD is equal to one like so. So some important corollaries to this result this Chinese remainder theorem so first of all we can induct on this like we did it with two factors a moment ago you can have as many direct factors as you want and so the order I should say that this group will be cyclic the direct product of these cyclic groups will be cyclic right the product in one times n two times n three up to nk will when their common GCD is equal to one this follows from a straightforward induction argument that I'll leave for the viewer to figure out the next thing to mention also is that if you have a prime factorization of the integer in then the cyclic group Zn has a natural decomposition natural factorization as direct products for which you can then take cyclic groups of prime power orders which again this is a fairly immediate consequence of the previous corollary for which this is immediate induction argument following the Chinese remainder theorem we saw on the previous slide. Now what I have in front of us now is our last corollary for the Chinese remainder theorem and I want to mention that in number theory the Chinese remainder theorem typically looks like this that is let n one into up to nk be some list of positive integers such that pairwise GCDs are equal to one for and then for any integers a one up to a k the system of equations you see this system of modular congruences x is congruent to a one mod n one a x is congruent to a uh that should be a two right there mod n two all the way up to x is congruent to a k mod nk so you have this system of linear congruences this has a unique solution modulo in one times into up to nk so that again this is how one typically thinks of the Chinese remainder theory and this is how it's always presented in a number theory course it gets the name Chinese remainder theorem uh because of the writings of sun g for which he wrote translated into english of course there are certain things whose number is unknown if we count them by threes we have two left over by fives we have three left over by sevens two are left over how many things are there so this was a math problem presented where you had to figure out the number based upon different remainders that the number had that in modern uh mathematics is equivalent to solving this system of modular equations right here now this core i'm actually going to present this as a corollary because from the group theoretic perspective we've taken this conclusion here is immediate from the theorems that we've already proven so what we have to do is we take an isomorphism from z in one into up to nk to the direct product from one to k of the z and k's right so we proved previously from from on the previous slide here we mentioned that oh if all of these of all these gcds are one then this cyclic group is isomorphic to this direct product of cyclic groups it's an isomorphism and so in particular it's surjective so there exists some element x inside the cyclic group such that when you take phi of x it'll equal a1 a2 up to ak there's some element that maps on to this there's gotta be and that's we with from surjectivity and since it's an injective map it's an isomorphism we get that there's a unique x that does it so that gives us the unique solution to the system now again a number theory oftentimes we try to generalize this to be like okay if we have some of these gcd conditions we can talk about when there when there are solutions when there's multiple solutions um as this this lecture series is not about number theory it's on algebra i'm not going to go into all the fine details about that but i do want to show you how one can solve a system of linear congruences so let's say we have to find a number which is congruent to three mod four and is congruent to four mod five the chinese remainder theorem gives us a proof that it exists but let's actually come up with a procedure to show what that number actually would be so since x is congruent to three mod four that tells me that there's some integer k such that x is equal to three plus four k you know for some integer k like i said what we can then do is we can then substitute that uh this expression into the second congruence right here so we see that three plus four k is congruent to four mod five we can make that substitution in there and work through it if we subtract three from both sides we get four k is congruent to one right and since since four and five are since four and five are uh relatively prime their gcd is one that means that four has a multiplicative inverse when we work mod five and it turns out the number is four itself if we times both sides of the equation by four we end up with k equals four notice that four times four sixteen which is one mod five because it's one more than 15 which is a multiple of five so the solution here would be k is congruent to four mod five well that means that k right k is equal to four plus a multiple of five uh let's call it l in this situation and so we're gonna then back substitute this into the observation we had before like so so we get that x is equal to three plus four times k but k is four plus five times l distribute the four we get x is equal to three plus 16 plus four times five times l of course three plus 16 is equal to 19 so we get x equals 19 plus 20 l so what we see here is that x should be congruent to 19 mod 20 which the significance of 20 of course is 20 it's four times five the product of the two and so 19 is the unique solution to this system of congruences up to mod 20 and so this is a pretty the pretty neat application of the Chinese remainder theorem you can solve these linear congruences this way it's kind of like doing linear algebra over different uh different rings right um i also want to mention that other among other applications the Chinese remainder theorem can be helpful in computer design in fact like with regard to calculations of large integers and uh parallel processing and such if anyone's interested in learning more about that you should check out the example in chapter 16 of Judson's textbook uh at the time of the recording it's example 1645 you'd want to check out that example in the preceding three paragraphs in the textbook it'll give you some more details on how the Chinese remainder theorem helps with computation computations on a computer