 Welcome back. So, we are considering the solutions to linear congruences this modulo n and we saw that there is an algorithm. So, algorithm had two lemmas which we have proved but let me see put the algorithm here for your reference. So, what we have done is in the first step that we have been able to reduce the coefficient of x the constant term as well as the congruence by having divided by the GCD. So, of course, if the answer is no then there are no solutions. If yes then we proceed this is what we do and then we come to step 2 which is to solve for a by dx congruent to b by d modulo the smaller congruence now n by d and having done this the number of solutions has changed because earlier we had these solutions and now because the GCD of a by d and n by d is 1 here we are now going to get a unique solution. So, this implies unique solution whereas in the earlier case here we will have d solutions. So, that is one small thing that we need to take care. Now, we want to know how to reduce the coefficient of x further and I told you that this can be done by canceling out anything which is there in the coefficient of a. So, you can look at am x congruent to b by m x mod n solutions to this are related to solutions to a x congruent to b mod n. This is our second step we proved this was the second lemma which we proved in the last lecture that even if you have the GCD of a and b n to be 1. So, that you cannot reduce the modulus further the modulus of the congruence which is n that can be cannot be reduced because now the GCD of a and n is 1 you cannot divide by the GCD the GCD is not more than 1. So, the modulus does not reduce but you can still reduce the coefficient of x and the congruence. So, that is something that we can do but there is one more method plus one more method which we will hopefully see in the next equation. So, let us go towards solving this we want to solve 18 x congruent to 42 modulo 50. So, the GCD here is 2 as we can see. So, step 1 tells us that the GCD of 18 and 50 you can cancel out the multiples of 18 from 50. So, that will give you 18 and 14 because 18 into 2 is 36 once you remove 36 from 50 you are left with 14 this is same as 4 comma 14 which is same as 4 comma 2 and therefore the GCD is 2 here 2 divides 42. So, there exists a solution in fact solutions modulo 50 this will be x naught and x naught plus 25 and now we apply step 2 to cancel this GCD which is 2. So, we will solve 9 x congruent to 21 modulo 25 we have divided by 2 to all the coefficients remember 9 is 18 upon 2 this was 18 21 is 42 divided by 2 here we have 42 and 25 is 50 by 2 here we have 50. So, we want to now solve for 9 x congruent to 21 modulo 25 the GCD of 9 and 25 now is 1, but 9 and 21 have a non-trivial GCD which is 3. So, this can be still cancelled out from the coefficients of x and the constant term and thus we get 3 x congruent to 7 modulo 25. So, we have reached up to this level here now the GCD of 3 comma 25 is 1 the GCD of 3 comma 7 is also 1. So, no further numbers can be cancelled and therefore what we do is apply a small trick. So, this is how that small trick goes solve 3 x congruent to 7 mod 25, but 7 is same thing as 32 mod 25 because 7 plus 25 is 32 we still do not have the GCD of 3 and 32 to be bigger than 1. So, I will add 25 to this further to obtain 57 because we have 32 plus 25 is 57. Now, the GCD of 3 and 57 is 3 we can cancel this and thus we need to solve x congruent to 19 mod 25, but there is nothing to solve here this is itself our solution. So, we obtained a solution x congruent to 19 mod 25 and as I pointed out to you when we proved those lemmas that this solution is not going to change. So, all solutions modulo 50 are 19 and 19 plus 25 which is 44. So, we had in our algorithm 3 steps the first step was to check whether the GCD divided the constant term which is b. The second step was then to cancel out the GCD. So, you would be left with a prime x congruent to b prime modulo n prime. The third step was to see and try to cancel out common terms from a prime and b prime. So, you have now that the coefficient of x which we call a prime and n prime they have GCD equal to 1 because the earlier GCD of a and n has now been cancelled. So, there is no further GCD and therefore, you cannot cancel terms from all the 3. However, you can cancel still try to cancel terms from the constant term and the coefficient of x and the next step would be where all the GCDs are 1 you have the GCD of a and n equal to 1 you have the GCD of a and b equal to 1 and still. So, then of course, there are 2 options you can try to invert a once you have the possibility of inverting a then you can simply multiply by the inverse of a to b and that will give you a solution or another way is to keep adding n to b. So, that the GCD of a and some b plus n times alpha becomes more than 1 reduce that GCD again by canceling out the GCD from the coefficient of x and the constant term and proceed. So, we will just note down this extra step. So, the impromptu step applies when you have that the GCD of a comma n is 1 and the GCD of a comma b is 1 and the step is that add multiples n to b to obtain some b prime which is b plus n into k such that the GCD of a and b prime is now bigger than 1. But whenever we apply any such step we should be able to prove that this is possible. So, the question is why is this possible that means why should you be able to find this k such that you get the corresponding b prime and the GCD of a and b prime is bigger than 1. We saw it in the last example where we had 3 and 7 modulo 25 we added 25 into 2 which was 50 to 7 to obtain 57 and that gave us the answer. So, a is 3 b is 7 and n is 25 here k equal to 2 works. But why should such a k exist in general this is going to be part of the exercise sheets that I am going to circulate. So, I will not explain this to you at this moment. But this is not a very difficult thing. This is simply playing around with the earlier theme on primes that we have developed quite a lot and that will help you in solving this. So, we have this algorithm once again for your reference check if the d which is the GCD of a and n divides b no means no solution yes then proceed further. Then you solve for a prime x congruent to b prime mod n prime and this can be done in 2 ways a by m x congruent to b by m mod n or invert a and these are the steps of the algorithm which will definitely help you solving any linear congruence provided of course that there is a solution. You should always check that after applying for this the number of solutions has changed. This is something that you should always note. This is something that you should note and so we put it in the red ink. So, the now next thing that we want to do after having obtained a condition for solving linear congruence is the following thing that we would like to solve for simultaneous linear congruences. We are looking for solutions to simultaneous linear congruences but with a small thing that to begin with we are going to keep the coefficient of x to be equal to 1. So, it will solve 2 things it will tell us that the GCD is 1 and therefore there are always solutions and it will also tell you the second thing that because the GCD is 1 there is a unique solution. So, we will not have to worry about the non-existence of solutions and we will also not have to worry about multiple solutions. So, as the mathematics keeps developing the subject of history of mathematics also keeps developing and one wonders what was the time when a particular thing was studied first or who was the person where the particular thing was studied first. Often there is some tradition to hold a particular time to be the first time when something is studied and then people realize that this was studied much before that and then one has to correct the history and perhaps go on correcting history for some time. So, for this the theorem that we are going to talk about is called the Chinese remainder theorem and this is called the Chinese remainder theorem because it was studied for the first time as the history tells us now in China during the third century AD. So, the first occurrence of this seems to be in a book by this Chinese mathematician Sun Tzu Xuansheng in the third century AD it was a very nice delightful book. There is there are lots of parallels that we should see here. So, in India we know that Bhaskaracharya had written Leela Vati which was basically a collection of problems and these solutions to these problems led to various theories on how to solve these problems. So, there were problems of similar types, there were methods described to solve these problems and so we learnt new methods. Similarly, this book by Sun Tzu Xuansheng had a problem which reads as follows. So, the problem says that there are certain things whose number is unknown. So, you have n things if we count them by 3s we have 2 left over. So, when you partition the number n in groups of 3s there will be 2 which are left over. So, n is a multiple of 3 plus 2 or n is congruent to 2 mod 3 this is what we would say in our current language. If you group them by 5 then there are 3 left over. So, that means n when partitioned in the groups of 5s 3 things are left over which means that n is a multiple of 5 plus 3 or n is congruent to 3 modulo 5 and when you do it by 7s then 2 are left over. That means when you try to partition n in the groups of 7s after having done after having separated some groups of 7s 2 things will be left over. So, n is a multiple of 7 plus 2 or that n is congruent to 2 mod 7. Then,zu Xuansheng asks how many things are there. So, this is the problem that is pretty well defined. What we need to do is to convert this problem in the language that we understand better. So, we read the problem again and try to take out the information that is of importance to us when you counted by 3 2 are left over. So, it is 2 mod 3 when you counted by 5 3 are left over. So, this is 3 mod 5 and when you do it by 7 again 2 are left over and we use this to write the problem in the language that we understand. So, we have n is congruent to 2 mod 3, n is congruent to 3 mod 5 and n is congruent to 2 mod 7. And then,zu Xuanshu asks what is the number n. So, of course any solution n naught gives infinitely many solutions. How we just take the product of 3 and 5 which is 15 and multiplied by 7 to get 105. So, the moment you have a solution n naught adding any multiple of 105 will give you a solution because n naught and any multiple of 105 are going to be congruent modulo 105. But if you have two numbers a and b then a and b are congruent modulo n if and only if and b are congruent modulo pi power ni where you have the prime factorization of 100 n as product of pi power ni. This was the result which we have proved some lectures back. So, the numbers n naught and n naught plus 105 are going to be congruent to each other mod 105 and therefore, they are congruent to each other modulo 3 modulo 5 and modulo 7. That means, you have one more solution to the problem which was proposed by Xuanshu. Now, we want to solve this. So, solving such a problem actually requires a method. But in some very special cases one may still be able to solve this problem in the following way. So, here we observe that there is a same congruence modulo 2 modulo i. So, n is 2 mod 3 and n is 2 mod 7. What does it give us? So, because n is congruent to 2 mod 3 and n is congruent to 2 mod 7 it tells us that 3 divides n minus 2 and 7 divides n minus 2. So, we have 3 divides n minus 2 and 7 divides n minus 2. Now, this will occur if and only if we have 21 divides n minus 2. So, what we have done is to replace these two congruences by one single congruence which is that n is congruent to 2 mod 21. So, the three congruences that we had first are now reduced to two congruences. n is congruent to 3 mod 5 and n is congruent to 2 mod 21. We will now solve this. So, let us just go over the things which are 2 mod 21. So, 2 is 2 mod 21 is not congruent to 3 mod 5. So, 2 is not a solution. Let us add 21 to 2. So, 2 plus 21 which is 23. This is congruent to 2 mod 21 and as luck would have it we have that 23 is also congruent to 3 mod 5. So, all our congruences are satisfied. So, the answer is 23. Check that this is 2 modulo 3. This is congruent to 3 modulo 5 and that this is congruent to 2 modulo 7. 23 is 21 plus 2. Therefore, it is 2 mod 3. It is 20 plus 3. Therefore, this is 3 mod 5 and it is 21 plus 2 once again. So, it is 2 mod 7. This was an impromptu method to solve this very special equation. But we need a result which will guarantee that whenever we have these things there is always a solution. So, what was one special thing here? We had 2 mod 3 and 2 mod 7 and immediately we jumped to 2 mod 21. The reason for that was that 3 and 7 were co-prime. There was no common prime factor for 3 and 7. Similarly, the third moduli that we had the third modulus was 5 and so all these 3, 3, 5 and 7 these are all relatively prime to each other. What are known as pair wise relatively prime? If you took 2 and 3, if you took 3 and 5 the GCD is 1, 5 and 7 GCD is 1 and finally 3 and 7 the GCD is 1. So, whenever we have such pair wise relatively co-prime numbers there is a guarantee that there will be a solution and this solution will be unique modulo the number n which is product of all these moduli. So, let us see the statement of this result. So, this is called the Chinese remainder theorem. The statement says that we start with any k natural numbers n1, n2 up to nk and so there is no restriction on what k can be in our problem we had k equal to 3. The only condition and that is a very important condition is that the ni and nj be co-prime whenever you have i not equal to j. So, whenever i is not equal to j the numbers ni and nj are relatively prime. So, n1, n2, n1, n3, n1, n4 all the way up to n1, nk then n2, n3, n2, n4 again all the way up to n2, nk and so on up to nk minus 1, nk. So, all these pairs should give you pairs of relatively prime integers which means that there is no common factor between any 2 of this chosen ni. Once you have this take any natural numbers a1, a2, ak there is no condition on these. Then this system x congruent to a1 mod n1, x congruent to a2 mod nk, n2 so on up to x congruent to ak mod nk has a unique solution modulo the number n which is product of all these ni. So, we will need to prove that there is a solution in the natural numbers and we will further prove that the solution is unique modulo this n. We will see this proof in the next lecture. So, I hope to see you by until then.