 Welcome back. We are looking at proof of the Chinese remainder theorem. We have done two baby cases k equal to 2 and k equal to 3. These two cases were easy but they tell us how we can do the general cases. So, k equal to 2 case just to go through that orally very quickly was that we first solved for two systems of solutions x 1 congruent to 1 mod n 1 and 0 mod n 2 and x 2 congruent to 0 mod n 1 and 1 mod n 2. So, the x 1 which was 0 mod n 2 directly gave you that x 1 has to be a multiple of n 2. And so, we write it as n 2 k 1 and the first part of that system of simultaneous linear congruences would then ask you for solving for this k 1. So, we will then have a system n 2 k 1 congruent to 1 mod n 1 and we are solving for k 1 which is guaranteed because n 1 and n 2 are co-prime. Similarly, you solve for x 2 because x 2 is multiple of n 1. So, x 2 will be n 1 k 2 and then we are asking for n 1 k 2 congruent to 1 mod n 2. So, you can solve for k 2 also and once you have solutions to these very special cases of simultaneous congruences you can solve the general case by taking linear combinations of these two. We have a similar situation when we had the case for k equal to 3 x 1 was the system which was 1 mod n 1 and 0 mod all others n 2 and n 3. So, x 1 was a multiple of n 2 and 3. So, we wrote x 1 as n 2 n 3 k 1 and we called that n 2 n 3 as c 1 and then c 1 n 1 are co-prime because n 1 had no common factor with n 2 neither did it have a common factor with n 3. So, n 1 would have no common prime factor with the product n 2 n 3. So, c 1 and n 1 are co-prime and therefore, c 1 k 1 congruent to 1 mod n 1 has a solution. Similarly, x 2 was the special system where you had 1 mod n 2 and 0 mod n 1 0 mod n 3. So, x 2 should be a multiple of n 1 n 3 and then you solve for k 2 because n 2 n 3 the product which we call n 1 n 3 the product which we call c 2 is co-prime with n 2 and then similarly we do x 3 and so on. So, we are going to do the general case now. Let me just remind you with the statement of the theorem we have n 1 n 2 n k this is the case that we are now going to prove. We have a k tuple of natural numbers consisting of pair wise co-prime integers. We have a k tuple of another k tuple of natural numbers a 1 a 2 a k and we are asking for the solution to the system x congruent to a 1 mod n 1 a 2 mod n 2 a k mod n k. The uniqueness part will be seen later. So, now we are going to prove this general case. So, we now prove or we now solve the special system for each i going from 1 to up to k and the special system is x i congruent to 1 mod n i and x i congruent to 0 mod n j whenever i not equal to j. So, this was the system which we had in the last case the case k equal to 3 where we had x 1 which was 1 mod n 1 0 mod n 2 0 mod n 3 x 2 which was 1 mod n 2 0 mod n 1 0 mod n 3 and x 3 which was 1 mod n 3 but 0 mod n 1 0 mod n 2. So, similarly here we have this x i which is 1 mod n i and 0 mod n j whenever i is not equal to j. So, if we define c i to be n 1 n 2 dot dot dot n i hat dot dot dot n k. So, here the hat means we are omitting this particular number. So, what we are doing is that we are taking the product n 1 into n k and dividing by n i or to make it more precise we are looking at the product n 1 n 2 n i minus 1 n i plus 1 up to n k. We are looking at this particular product and now we observe that since n i with n j is 1 for each j not equal to i. So, c i and n i are co-prime and let us again recall what we were looking at for x i x i we wanted to be 1 mod n i and x i was 0 mod n j for each j not equal to i. So, this condition tells us that this x i is a multiple of c i because each n j wherever j is not equal to i would divide x i again for each j not equal to i and therefore x the product n j where j not equal to i divides x i but this is simply c i by our definition of c i. So, we have that x i can be written as c i times some integer k i and now we need to solve for this. So, we have c i k i congruent to 1 mod n i but this has a solution since c i and n i are co-prime. So, thus each x i can be found the general solution x equal to a 1 x 1 plus a 2 x 2 plus dot dot dot a k x k. So, if you were to look at it modulo any particular n i so mod n i if we go then x is congruent to remember mod n i each of the x i where i is not equal to j is going to give you 0. So, the only thing which survives in this is a i x i which is congruent to a i because x i is now 1 mod n i. So, this is our solution to the general system of the simultaneous linear congruences. So, once again we solved very special systems which were giving 1 mod a particular n i and 0 mod all other n j's then the solution will be a multiple of the product of these n j's and using the property that since each of the n j is co-prime to n i the product of n j's is also co-prime to n i we have a solution to that particular spatial system of congruences simultaneous congruences and then we have a general solution. So, now that we have proved the existence of a solution we go towards proving the uniqueness. What is the meaning of uniqueness before that let me write what we have done and what we are yet to do. So, thus we have proved the existence of a solution now we go towards proving uniqueness this solution modulo n which is the product of these k natural numbers. So, what is the meaning to say that we are looking at uniqueness it means that if you have two solutions suppose I have a natural number alpha which satisfies that simultaneous system of linear congruences. So, I would have alpha congruent to a 1 mod n 1 alpha congruent to a 2 mod n 2 so on up to alpha congruent to a k mod n k and suppose we have one more natural number beta satisfying the same then alpha and beta should be congruent to each other modulo n this is what we want to prove. So, let us write it. So, if alpha beta they exist in let us say natural integers meaning why only natural numbers such that alpha congruent to ai mod ni and beta also congruent to ai mod ni then alpha is congruent to beta mod n this is the statement that we are to prove this is the statement that we want to prove. So, let us see how one can prove such a statement. So, since we want to show that alpha and beta are congruent modulo n we must look at alpha minus beta and we have that alpha is congruent to ai modulo ni and beta is also congruent to ai modulo ni. So, mod each ni we are going to get that alpha minus beta is 0 and this is to say that each of the ni is going to divide the product alpha minus beta. But if ni divides alpha minus beta and we also have that ni are pair wise coprime therefore the product ni is going to divide alpha minus beta which says that n divides alpha minus beta or that we have alpha congruent to beta modulo n. So, let me make some comments about this particular statement that when you have some set of coprime elements divide an element then the whole product goes and divides it. So, how do we think about this? So, let me state that here and prove it for you. So, we now prove that if ni divide gamma for each i then product ni divides gamma since ni nj is 1 for all i not equal to j. So, this tells us that first of all you have n1 dividing gamma and therefore gamma can be written as n1 into let us say m1. Once you have written gamma as n1 m1 we consider the case that n2 divides gamma. Once you have n2 dividing gamma, gamma is n1 m1. Now each prime factor of n2 will have to divide m1 because n1 and n2 are pair wise coprime. So, all the prime factors of n2 will divide m1 with the same power. So, n2 will divide m1 and hence the product n1 n2 divides gamma and then by induction then the proof follows by induction. So, the only thing to note here is that we have the fundamental theorem of arithmetic which guarantees that the primes occurring in a factorization are unique with the powers also being uniquely determined by the integer n. That is the only thing which will give us all these solutions. So, what we have now done is we have completed the proof of the Chinese remainder theorem. We proved the existence of solution by proving the existence of solutions for a very special case of simultaneous congruences and then we also have proved the uniqueness modulo n. So, after having proved this impressive theorem, the next thing to do is to try our hand at some problems. So, we look at this particular problem to begin with. This system says that we want to solve for x congruent to 1 mod 4, x congruent to 2 mod 3 and x congruent to 3 mod 5. So, here our a1 is 1. Let us compute, let us write all our tuples. So, n2, n3, n1, n2, n3 are 4, 3 and 5 in that order and clearly we have that they are all pair wise coprime. Then we have a1, a2, a3. So, these are 1, 2 and 3 and then if you remember the proof that we had done, we had actually looked at c1, c2, c3. So, c1 was n2, n3. Therefore, this is 15. c2 was n1, n3. So, that is here 20 and c3 was n1, n2. So, that product is 4 into 3 which is 12. And then once again we observe that 4 and 15 are coprime, 3 and 20 are coprime and 5 and 12 are coprime. So, we construct 3 systems from this where we are asking for inverse of each of these inverse of each side of the CI modulo ni. So, we solve for CI, KI congruent to 1 mod ni. This is the system that we are going to now solve first. So, 15, 20 and 12 modulo 4, 3 and 5. So, the first one is the product of these two. So, 15 k1 congruent to 1 mod 4 and then we see this quite easily that here k1 has to be 3. So, x1 equal to 45. After that we look at 4 into 5 which is 20 k2 congruent to 1 mod 3 which will give us. So, remember 20 itself is congruent to 2 mod 3. So, if I multiply 20 by 2 I get 40 which is congruent to 1 mod 3. So, k2 is 2 and x2 is 40. And similarly we solve for x3 by asking for 12 k3 congruent to 1 mod 5 and then we observe that k3 is 3. So, we have x3 congruent to x3 equal to 36. We can quickly observe that each of these have the required properties that 45 is divisible by 5 and 3 and is congruent to 1 mod 4. Similarly, 40 is divisible by 5 and 4 but is congruent to 1 mod 3 and 36 is divisible by 4 and 3 and is congruent to 1 mod 5. So, let me write it here once again we have 45, 40 and 36. These are the values of x1, x2, x3 and to compute the final answer we have to simply multiply the xi by ai and compute the final answer. So, x is 1 into 45 that is simply 45 plus 2 into 40 that is 80 plus 3 into 36 which gives you 108. So, 45 plus so we have 5 plus 8 gives you 13. So, you have 1 coming out and then 8 plus 4 is 12 plus 1 gives you 13. So, you have 3 and 1 more coming out and then finally you have 233. But we should also go modulo. So, we should we go modulo the product of the 3 moduli which we have here. So, 4 into 3 into 5 which is 12 into 5 which is 60 and thus our answer is x is congruent to 53 mod 60. So, I will now just write 60 here and we can easily check that when we go modulo this is what we always tell all the school students that once you have computed the answer you should check it again. So, when you go modulo 4 for 53 you see that 52 goes out and what is remaining is 1. When you go mod 3 you see that 51 is subtracted and what is left is 2 and when you go modulo 5 then from 53 you subtract 50 and what you are left with is 3. So, the answer is indeed 53 mod 60. Let us do one more problem before we finish this lecture. So, this problem is similar we want to solve this system of the simultaneous linear congruences and I will now be slightly fast because you know the method already. So, we will write n1, n2 and n3 in the order 7, 9 and 4 and we have a1, a2 and a3 which are nothing but 2, 7 and 3 and then finally we need to compute c1, c2, c3. So, remember once again c1 is the product of n2, n3. So, this is now 36, c2 is the product of n1 and n3 which is 7 into 4 so that is 28 and c3 is n1, n2 which is the number 63. So, now we want to solve for xi to be ci ki congruent to 1 mod ni this is the solution. So, we need to solve for the k. So, we go to the next slide but remember we have 36, 28 and 63 as the ci so c1, c2 and c3 are 36, 28 and 63 and I want to solve for k1. So, k1 should give me the property that 36 k1 should be 1 mod 7 but 36 is already 1. So, we have that this is 1 into k1 congruent to 1 modulo 7 and therefore k1 is 1. So, I get the final answer is that k1 is 1. I will solve similarly for k2 which should have the property that 28 k2 should be congruent to 1 modulo n2 which is 9 but 28 already is 1 mod 9. So, this gives me k2 congruent to 1 mod 9 and therefore k2 is 1. So, we get k2 also to be equal to 1. We should now solve for k3 with the property that 63 k3 is congruent to 1 mod 4 but 63 is 3. So, we should solve for 3 k3 congruent to 1 mod 4 but 3 k3 the k3 should be equal to 3 because 3 into 3 is 9 which is 1 mod 4. So, k3 has to be equal to 3. So, these are the values which we obtained for k1 k2 k3 and from these we should now obtain the xi x1 x2 x3 remember x1 is c1 k1 x2 is c2 k2 and x3 is c3 k3. So, x1 is 36 into 1 therefore this is 36 x2 is 28 into 1. So, that is simply 28 and x3 is going to be 63 into 3. So, I hope you have your multiplication tables with you it gives you the number 189. So, 36, 28 and 189 these are the x1 x2 x3 36, 28 and 189 this is x1 x2 and x3 and now what we should do to compute the final answer is to take x to be summation ai xi. So, I will multiply to 36 by 2 I get 72 then 228 I multiply by 7. So, 28 into 7 28 is already 7 into 4. So, that gives us 49 into 4 and 49 into 4 is 200 minus 4 because 50 into 4 is 200. So, we get it to be 196 plus 189 into 3. So, this is the product that we have to do in our in our head 9 into 3 gives us 27. So, we have 7 and then there are 2 left and 18 threes are 54 and we add those 2 to get 567. So, the final answer here is 7 plus 6 is 13 plus 2 is 15. So, we write 5 and 1 is left 6 plus 1 is 7 plus 9 is 16 plus 7 is 23. So, we have 3 and then there are 2. So, 5 plus 2 is 7 and 1 8 8 35 this is the answer but we have to go modulo the LCM which is 9 into 7 63 into 4 63 into 4 is 252. So, we need to subtract multiples of 252 from this number we multiply 252 by 3 to get 756 after subtracting this from this we get 5 mix 15 minus 6 is 9 you have 1 here 83 minus 76 this becomes 7. So, the answer is 79 mod 252 let us just verify quickly that 79 is indeed the answer. So, when you go modulo 7 to 79 11 into 7 or 77 and what we are left with is 2 when you go modulo 9 you will remove 72 what is left is 7 and when you go modulo 4 of course 76 are removed and what is left is 3. So, we have successfully applied the Chinese reminder theorem to apply these 2 systems of linear congruences what we are going to do in the next lecture is to look at some more complicated systems and try to use Chinese remainder theorem by doing some modifications to the system. So, I hope to see you in the next lecture. Thank you.