 Welcome back, we are discussing about solving the system of simultaneous linear congruences. So, I told you that this the corresponding result, the main result in this theory is called the Chinese remainder theorem. Reminder of course stands for the AIs that we have. So, what we are really looking for is a number x such that whenever you divide by ni, the remainder should be A i. This is the problem and the first occurrence until now is in the third century A d and that was from China and that is why it is called Chinese remainder theorem. So, as we can read it here it is in a book by Sun Tzu Shanshing and the problem was an elaborate problem but in the mathematical lingo this translates as asking for a solution for a natural number n which is congruent to 2 mod 3. So, when you take out groups of 3 what is left is 2, it is 3 mod 5. So, when you take out groups of 5 what is left is 3 and finally it is 2 mod 7. So, we solved this in the last lecture and we observed that the solution is 23. You can of course add 105 to it. So, you have that 128 is also a solution. We just observe here that the number 105 is obtained as the product of these 3 moduli. The modulus 3 into the modulus 5 into the modulus 7 this is what we have. In general this is actually going to be replaced by what is called the LCM of these 3 numbers. At the moment since these 3 numbers are pair wise coprime therefore their LCM is nothing but their product. But when we see a general theory maybe 2 lectures on or 3 lectures later we will see that this product is going to be replaced by the LCM. So, this is the statement of the theorem. So, statement that we have seen the problem and its solution. Let us now go towards the statement of the theorem. It is an important theorem. I am going to show it to you line by line and let us try to understand each line correctly. So, we start with n 1 into n k. These are natural numbers and the condition on them is that n i and j is 1 whenever you have i not equal to j. So, that means that pair wise these integers are coprime. This is the only condition and that is why the and using only this condition we are going to get our result. So, we have k tuple of natural numbers consisting of pair wise coprime integers. We start with any k tuple of integers a 1, a 2, a k. So, here there is no condition and now we ask for the solution of the system x congruent to a 1 mod n 1 x congruent to a 2 mod n 2 so on up to x congruent to a k mod n k. So, we want one single natural number which when you take out multiples of n 1 common will give you the remainder a 1. When you take out multiples of n 2 out gives you the remainder a 2 and so on up to kth state where you are taking multiples of n k out the remainder is a k. Once again note that there is no condition on a 1, a 2, a k. The only condition is on n 1, n 2, n k and the condition is that they be pair wise coprime meaning if I take n 1 and n 2 then there is no common factor n 1, n 3 have no common factor so on up to n 1, n k have no common prime factor. Then n 2, n 3 have no common prime factor n 2, n 4 have no common prime factor, n 2, n k have no common prime factor and the last pair that you will get is n k minus 1 and n k those two natural numbers also have no common prime factor. This is the only condition we have then this system has a unique solution we are not saying that there is a solution we even say that it has a unique solution modulo the product n which is n 1, n 2, n k. This is the statement that we have we will prove this statement the proof is actually quite simple but there is one basic idea in the proof and so we will do some of the simpler cases of this theorem where k is 2 and k is 3 and then we will do the general result. But before doing any such thing you may wonder whether there are any applications of this result meaning number theory is it used to be the branch of mathematics which had no applications and professor G. H. Hardy whose name has come up once before when I told you about the method of contradictions he had a book Apology and Apology of a Mathematician. So, in the same book he also says that he is quite proud of the fact that number theory has no applications. So, he was of the opinion that one should study only for the purpose of studying it should not get clouded by these materialistic ambitions. So, he would say that you should not look at applications you should study because the theory is beautiful you should study because you like it. So, number theory used to be one such thing but of course now with the advance of cryptography and so on there are plenty of applications of number theory. But let us go and look at one application of this particular theorem the Chinese remainder theorem and the application is as follows it is in astronomy. So, the application is as follows consider the situation where you have k events occurring regularly and the periods E, R, N1, N2, Nk. So, there are these k events which occur regularly this event can be anything. So, it can be a solar eclipse or lunar eclipse or I do not know if you remember but when I was a child this there was this comet called Halley's Comet and apparently this comet which circulates the solar system will come back and go pass through a distance which is closest to earth every 76 years. So, there are these astronomical events and many of them are periodic events there is some nice definite periodicity which one can compute and so here we assume that there are these k events which occur regularly with these periods N1, N2, Nk. So, if you had the first event occurring at some time then the next time it would occur would be at so suppose you are with the ith event happening at the time x equal to ai. So, suppose you have started counting with the Gregorian calendar and then in 2020 some event occurs and then the period of this thing occurring again is say 35 years. So, in 2055 it will occur again so that is what we have as ai and then ai plus ni and then it would continue occurring regularly with respect to those periods. So, you have these k events occurring regularly with periods ni and we assume that ai, ai plus ni and so on these are the times when they are occurring. So, when you go modulo ni the occurrence is x congruent to ai this is what we have and then you would ask for the simultaneous occurrence of this. This was an event which was of interest to astronomers when some particular set of events occur simultaneously. So, this is solvable when you have these congruence moduli ni to be coprime. So, if these periods ni happen to be pair wise coprime then of course such an x can be found and the ancient people of possibly all civilizations knew about this result and this is one event which could even be the motivation behind studying the Chinese remainder theorem. I believe that it could be one of the motivations behind the Chinese remainder theorem. So, what we are looking here is that when you have these k events occurring regularly with periods ni the first one occurring at ai then ai plus ni and so on then the occurrence is the simultaneous occurrence would be given by a solution to the simultaneous the system of simultaneous congruences x congruent to ai mod ni for all i and if these ni are pair wise coprime then of course you can simply write down and find the solution. Many times in various proofs the solution is proved only up to existence but we will see that with some techniques we can actually construct a solution. So, now we are going to prove the Chinese remainder theorem let us walk through this proof together it is a simple proof but there is one key idea. So, once you understand this key idea then the proof really becomes transparent. So, let us begin this proof what we are going to do to begin with is to consider the case k equal to 2. So, what we are asking for is that we are interested in finding a solution to this system here of course we have n 1 and n 2 to be coprime. So, we are looking at pair wise coprime and here we have a single pair. So, we are asking that whenever n 1 and n 2 are coprime do we have a solution to this. Now here we are once again I will remark that we are looking at a 1 a 2 to be any tuples any pairs of natural numbers but I will ask I will first try to get solution for this particular tuple. So, I am asking for n 1 I am asking for solution for x 1 congruent to 1 mod n 1 and x 1 congruent to 0 mod n 2 and another system where I am asking for the solutions to this. So, I am looking at 2 particular cases. So, these 2 are particular cases of the above problem but if we have a solution to these. So, if these are found then I will simply take x to be a 1 x 1 plus a 2 x 2. So, assuming that there is a solution x 1 and x 2 satisfying these various conditions with the assumption we can solve a general equation. So, if you are going modulo n 1 then here x 1 is 0 mod n 2 and a 2 is x 2 is 1 mod n 2. So, let us look at this modulo both n 1 and n 2. So, when I am going modulo n 1 modulo n 1 x 1 is 1. So, this is going to be a 1 times 1 plus a 2 times 0 and therefore it gives me a 1 and similarly for x 2 we are going to get a 1 modulo n 2. Modulo n 2 means we have to look at this particular part. So, from here we see that modulo n 2 x 1 is 0. So, I will get a 1 into 0 plus a 2 into x 2 which is 1 and therefore we get it to be a 2. So, once we have solution to these two particular cases then we are able to solve the equation. So, we go to the next page and solve these two particular cases. So, we have n 1 n 2 equal to 1 and we are now going to solve for x 1 congruent to 0 sorry x 1 is congruent to 1 mod n 1 and x 2 congruent x 1 is 0 mod n 1 and when we look at x 2 we demand that this be 0 mod n 1 and x 2 we congruent to 1 mod n 2. But this second condition is equivalent to n 2 dividing x 2 and this n 2 dividing x 1 and this condition is n 1 dividing x 2. So, what we get is that x 1 is of the type n 2 k 1 and x 2 is n 1 k 2 and so now we have to solve k 1 which is x 1 congruent to 1 mod n 1 and x 2 which is n 1 k 2 congruent to 1 mod n 2 and such case k 1 k 2 can be found n 1 n 2 is 1. So, let us go through this proof once again. What we are asking for is to solve these two special cases x 1 which has the property that it is 1 mod n 1 and 0 mod n 2 and x 2 has the property that it is 0 mod n 1 and 1 mod n 2 and we saw in the last slide that when you have solutions to such an x 1 and x 2 you can solve for a general x by simply putting it as a 1 x 1 plus a 2 x 2 gives a general solution. This is something that we have seen. So, we want to solve only for these two special cases of our system of simultaneous congruences and then this immediately told us x 1 congruent to 0 mod n 2 says that n 2 has to divide x 1 and therefore x 1 is of the form n 2 times some k 1 and similarly x 2 congruent to 0 mod n 1 will tell you that x 2 has to be of the form n 1 times k 2. So, the congruence x 2 congruent to 0 mod n 1 is solved because we are looking at x 2 to be only multiples of n 1. So, by looking at that we have solved this particular congruence. The only congruence that remains to solve is this x 2 congruent to 1 mod n 2. Similarly, by taking x 1 to be a multiple of n 2, this congruence is solved and so we have to only solve the first congruence which is x 1 congruent to 1 mod n 1. So, those things are now encoded here. So, this is x 1 congruent to 1 mod n 1, x 2 congruent to 1 mod n 2. But n 1 and n 2 are co-prime and we know from the system of solution of a linear congruence that when you have GCD of the coefficient of x and the modulus dividing the constant term then you have a solution and the number of solutions is exactly the GCD. Here you have n 1 n 2 are co-primes of the GCD is 1. Therefore, you get a solution and since the GCD is 1, your solution is unique modulo that n 1. But anyway, the uniqueness will come later. We at least have a solution for x 1 and solution for x 2 by having computed k 1 and k 2. So, when we deal with some particular problems, we will need to compute these k 1 and k 2 which so k 1 has the property that multiplied to n 2 it gives you 1 mod n 1 and k 2 has the property that multiplied to n 1 you get 1 mod n 2. So, once you solve this, then you have a system, then you have a solution to the simultaneous system of linear congruences. Let us do one more case. We want to generalize this to k events. We want to generalize this to k tuple n 1 n 2 n k. Let us do it for 3 and then we go on to do the general case. So, here we have n 1 n 2 equal to n 1 n 3 equal to n 2 n 3 which is 1 and we are looking for solutions to x congruent to a 1 mod n 1 x congruent to a 2 mod n 2 and x congruent to a 3 mod n 3. Once again, like the last time we are going to look at 3 special cases. Our first special case is x 1 which is congruent to 1 mod n 1, but it is 0 mod n 2 and 0 mod n 3. This is our first special case x 2 is the one which has congruence 1 when you divide by, when you go modulo by n 2 and otherwise you get 0. And finally, we have x 3 which will give you 0 when you divide by n 1. It will give you 0 when you divide by n 2, but it will give you 1 when you divide by n 3. And then once you have a general solution then x which is a 1 x 1 plus a 2 x 2 plus a 3 x 3 is a solution. Because when I go modulo n 1, so let us do this for one congruence at a time. So, this is going to be if I am going modulo n 1 then modulo n 1 x 1 is 1. So, I will get a 1 x 2 is 0. So, I do not get anything for a 2 x 3 is 0. So, I do not get anything for a 3. So, this is the congruence when I go modulo n 1 which is what we wanted. We wanted to have x to be a 1 mod n 1. Now, suppose we want to do it for n 3 instead of n 2. So, the similar things would work for all the other moduli. Suppose I want to go mod n 3. So, I have to look at this particular column of congruences. So, x 1 is 0 mod n 3. Therefore, a 1 x 1 will give me 0. x 2 is 0 mod n 3. So, a 2 x 2 this will give you a 2 times 0 and finally x 3 is 1. So, I get a 3 times 1 which is simply a 3 mod n 3 and this is what we wanted to obtain. So, these three very special systems of simultaneous linear congruences will give you a general solution to a system of simultaneous linear congruences. So, now we have to solve for each of these three. So, x 1 congruent to 1 mod n 1 and 0 mod n 2 n 3, x 2 congruent to 1 mod n 2 and 0 mod n 1 n 3 and x 3 congruent to 1 mod n 3 and 0 mod the first 2 n 1 n 2 this is to be solved. So, let me just write it here again that we have these three to be co-prime and we are looking at. So, because x 1 is 0 mod n 2 and x 1 is 0 mod n 3, we have that x 1 is n 2 n 3 times a k 1 and we want to solve for 1 mod n 1. So, we have this n 2 n 3 then we look at x 2 which is n 1 n 3 k 2 because we would have that x 2 is 0 mod n 1 and 0 mod n 3 but 1 mod n n 2. So, x 2 is divisible by n 1 and n 3. So, we have x 2 to be n 1 n 3 k 2 congruent to 1 mod n 2 and finally, we will solve for x 3 to be n 1 n 2 k 3 which we ask to be congruent to 1 mod n 3. So, all these numbers that we have in the bracket. So, call c 1 to be the product n 2 n 3 c 2 to be the product n 1 n 3 and c 3 to be the product n 1 n 2 then we observe that c 1 and n 1 are co-prime because n 1 has no common prime with n 2 and n 1 has no common prime factor with n 3. So, c 1 which is nothing but the product of n 2 and n 3 is going to be co-prime with n 1. Similarly, c 2 n 2 are co-prime and c 3 n 3 are co-prime. So, once you have these co-prime things then we know that there is a unique solution to this there is a unique solution to this there is a unique solution to this modulo each of the n i's. So, since c i n i is 1 for all i we have a solution k i to the 3 above congruences and hence k equal to 3 case is done. So, we have done the case k equal to 2 where we had a pair of co-prime integers n 1 and n 2 and then we proved the Chinese remainder theorem for this particular case. Then we have now the case k equal to 3 where we had 3 elements 3 natural numbers n 1 n 2 n 3 and they had the property that they were relatively pair wise relatively prime or pair wise co-prime. And then we proved that there is a solution to x congruent to a 1 mod n 1 x congruent to a 2 mod n 2 and x congruent to a 3 mod n 3. Now the time is to go for a general proof but we will do it in the next lecture. So, I hope you will remember the cases k equal to 2 k equal to 3 and see you in the next lecture. Thank you.