 Welcome back, we have completed almost half of our course and among the themes we have completed two major themes and we started with the third theme in the last lecture towards the end. I hope you are also as excited as I am about this theme, this is on quadratic residues. So this is our third theme quadratic residues and what we are going to do in this is essentially to solve quadratic equations over Zn but we saw that we will have to we will of course not be able to solve the quadratic equations for every coefficients but we will need to take the 2a to be an invertible element modulo n. So a if you remember from last lecture was the coefficient of x square so that a needs to be an invertible element and moreover 2 also needs to be an invertible element. This is what we have seen in the last lecture and then we saw that to solve such an equation it is enough to find square roots of various elements. So what we are restricting ourselves at the moment is that we will look at elements which are invertible so these are elements in Un and we want to compute square roots of these elements. So this is something that I have already remarked to you that Un is a group. We have that Zn is a ring and therefore Un the set of all invertible elements modulo n forms a group under multiplication and now if I want to find what elements have square roots or what are those square roots further the simplest thing would be to compute squares of every element. So once you know what are the squares and you would also know which elements square to what element and therefore in the reverse way you will know which are the square roots of your given element whether it has a square root or not and whenever it has what are the square roots. This is the knowledge we will have so we want to compute the set of all squares in Un. This is our notation for the quadratic residues modulo n and as we have noted these are nothing but squares of elements in Un. Now there is one small thing which we are going to observe and this small remark is very useful in many of the computations that we are going to do later. So this remark is that Qn is a subgroup of Un. So perhaps we can also see a proof of this quickly. There are several ways to check when some subset is a subgroup. The essential thing is that you should check that it is closed under taking multiplication one is there and further inverse of every element is also there or all these things can be combined in the following statements. So we check that whenever a, b are elements in Qn then a, b inverse is also in Qn. This one statement will capture all the properties that you want to have. So how do we have this statement? So when if you have a and b in Qn then a is square of some alpha, b is the square of some beta for alpha, beta in Un and then it is a simple matter to check that a, b inverse is the square of alpha, beta inverse square. So a, b inverse is the square of alpha, beta inverse and therefore this is also in Qn. So we have that Qn is actually a subgroup of the group Un of all invertible elements and this one thing helps us quite a lot as we will see in the coming slides. But we also did some computations of Qn for some small integers n. Let me recall that for you. We have we computed Q7 which was 1, 2 and 4. This is sitting in U7 which you remember is 1, 2 all the way up to 6 and Q8 it is simply 1. This is sitting in U8 which is the set of all odd elements up to 8. So here we had only 4 elements in U8 and surprisingly there is only one element in Qn. Only the identity element is the square in U8 that is the only square. So there is only one element in Q8 whereas here in U7 we had 6 elements and their squares gave us a set of 3 elements. So this is something which we see is a different behavior because our 7 is a prime number and 8 is a power of 2. So 7 corresponds to something which is an odd prime and 8 corresponds to the oddest of the primes as we have started calling it the even prime 2. So this is the behavior that we are going to see. We will also see later that in most of the discussions we will of course be taking the n to be odd. So we will not look at the number 2 or in fact any even number right now. We will only look at odd numbers and so whenever we will also talk about primes we will only concentrate on odd primes. You know as far as squares are concerned when you look at z by 2z everything is a square. Z by 2z is 0 and 1, 0 square is 0 and 1 square is 1. So everything is a square only when we go beyond 2 then we get some non-square elements and so things get more interesting as you go beyond 2. So that is the reason that among the primes we will not look at the prime p equal to 2 but we will look at odd primes and as we have seen at the beginning of the discussion of this theme that when you take the quadratic polynomial a x square plus b x plus c you are going to have to divide by 2a. So 2a has to be invertible which says that a has to be invertible and 2 has to be invertible and so n will have to be an odd natural number. This is our beginning statement that you start with a in qn then the number of square roots of a so we are assuming already that a is in qn that is something that we already assume. So a is already a square then the number of square roots of a is given by the following formula. This formula is 2 power k minus 1 where n is congruent to 2 mod 4 remember that here we are not taking n equal to 2 because that is the case that we are not looking at. So here we will start with 6 onwards and so therefore you are at least going to have k to be more than 1 so k will be 2 or above and therefore 2 power k minus 1 does make sense. If you are looking at n equal to 2 then k is 1 and then you have only 0 2 power 0 which is 1 so that is also correct but at the moment we are not looking at the case n equal to 2. Here whenever 8 divides n we have the number to be 2 power k plus 1 which is 1 more than the number of primes and in all the other cases so here the other cases are where n is odd or n equal to 4 m where m is odd these are the remaining cases. So in all these cases we have that the number of prime factors if that is k then the square roots of any given element in qn is a fixed number that depends only on n and that is given by this formula. You will realize that this was the same formula we had for computing the number of square roots of 1 when we computed the solutions to the equation x square equal to 1 modulo n we got exactly the same formula and that is it is the same formula and the reason will become very clear to you once you recall that qn is a subgroup of un. So let us quickly prove this formula the formula can be proved in the following way. So we consider a group homomorphism call it phi from un to un and this is defined by sending an a to its square. So this is clearly a group homomorphism because our group is abelian. So since un is abelian phi is a group homomorphism and now by definition qn is the image of the group un under phi because we are looking at qn to be the set of all squares in un. So these are precisely the image this is precisely the image of the homomorphism phi. So this is nothing but a square where a belongs to un this is what we have and we can also determine the kernel. So the number given above and by above I mean in the statement of the result is the cardinality of the kernel of phi. So we have a cardinality of this kernel of phi what is kernel in the language of group theory kernel is the set of all elements in un which under the map phi go to the trivial element. But our map phi is defined by taking an element to its square. So kernel is precisely those elements whose square is 1 and therefore kernel is precisely the set of square roots of 1 these are precisely the elements satisfying x square minus 1 equal to 0 in z by nz. So kernel has some quantity so the cardinality of this kernel is capital N which is defined in the previous slide given by 2 to the power k minus 1, 2 to the power k or 2 to the power k plus 1 depending on how 2 divides the number n and the number of prime factors of n. We have the number so that capital N will depend only on small n and that is exactly the cardinality of the kernel. Further we have this very basic statement coming from group theory further if A is in qn. So A is alpha square then there is a bijection so then there is a bijection between 2 sets all the betas in un where beta square is A with all the gamma in un with gamma square equal to 1. And once you start with a beta here we will send the beta to beta alpha inverse. So let us check that this is indeed a bijection we will check it by using a different ink. So to show that this is a bijection clearly we have to show that whenever you start with a beta here its image beta in alpha inverse belongs to this set but that is clear because beta alpha inverse square is beta square alpha is to minus 2 you have fixed your alpha with the property that alpha square is A and you also have that beta square is A so this is equal to 1. So we have fixed beta we have fixed an alpha and then for every beta in this set call it capital A and this is our set kernel phi then we have this natural map and we will show that it is a bijection it is a natural map only once you have fixed this element alpha. So what we have shown is that the map let me call this map by theta. So there is this map theta from A to kernel phi this map is well defined now it is obtained by sending the element beta to beta alpha inverse. We want to show that this is a bijection so we should show that it is a 1 to 1 on to map. So if there is a gamma in kernel phi we take beta to be we have to take a beta such that beta alpha inverse is gamma we are now starting with an element in kernel phi and we are now trying to define an element in capital A which under the map theta gets sent to gamma. So we should construct a beta such that beta alpha inverse is gamma but this beta should be gamma into alpha so that when you cancel out alpha you get gamma this is quite clear. So this beta now so this gives on toness and now we need to show 1 to 1 property but if you have beta 1 alpha inverse equal to beta 2 alpha inverse that would imply that beta 1 is beta 2 because alpha is after all an element in un you can multiply by alpha 2 the both the sides of this equality beta 1 alpha inverse equal to beta 2 alpha inverse. So you are canceling the alpha inverse to get that beta 1 is beta 2 so this says that the map is also 1 to 1. So what we have now proved is that there is a bijection from the set capital A to the kernel of the map phi and once we have this bijection we are now able to get our result. So we would want to show that the cardinality of the set A is exactly the same as the cardinality of kernel phi and that will follow once we have that there is this bijection. So this bijection will tell us that cardinality of the set A is equal to cardinality of the set kernel phi which is the number that we had earlier 2 power k minus 1 2 power k plus 1 and 2 power k and if you remember this was n congruent to 2 mod 4 this was the case n congruent to 0 mod 8 and this is the remaining case. So this completes our proof whenever there is an element in qn then the number of all square roots of the number A the element A is given by the cardinality of the kernel of the map phi. So you see that once we have used that qn is a subgroup we know that it can be seen as image of this square map and therefore we are able to compute the cardinality of the kernel and the after all if you also remember some of the group theory you will see that the inverse image of every other element will give you a certain coset and the coset will have each coset will have the cardinality equal to the cardinality of the kernel. We see that here this A is nothing but the coset of the element alpha this is what we have. So the cosets will all have the cardinality equal to coset of the trivial element which is your subgroup by which you are going modulo. So in this case it is the kernel. So this is one very nice calculation it will tell you that once you have some element to be in qn it is going to have a large number of square roots and so we can somehow hope to compute the number of elements in qn from this. You see after all what we have is that qn being the image is also actually a subgroup of un because you have this square map from un to un sending every element to its square. So qn is the image on the right hand side a subgroup and therefore its cardinality will have to divide the cardinality of the whole group which is phi n but because the kernel has cardinality capital N then we know exactly how many elements there can be in qn. So this follows earlier proof cardinality of phi un equal to cardinality of un upon cardinality of kernel phi. So this is actually cardinality of our subgroup qn and here we have this to be cardinality un is the Euler phi function. So I should not have used the same symbol phi here. So let me write the Euler phi function in a different ink upon n where n is this number. So this phi is the Euler phi function. So this corollary follows quite easily and we also have one more small result which says that whenever the group un has a primitive root. So whenever the group un is cyclic then qn will have exactly phi n by 2 elements. So the second statement here follows quite nicely because our n is going to be 2, un is cyclic. This is because whenever your un is cyclic we know that the number of square roots of 1 is going to give you a subgroup and so you cannot have more than one cyclic subgroup of any given order inside a cyclic group. So the number of square roots of 1 will if there were more than 1, if there were more than 2 square roots then you will have multiple copies of cyclic groups of order 2 sitting in un. This is something that we have remarked earlier as well. But even here we can see that statement quite easily because it will follow from the above statement that qn is a cyclic subgroup of un generated by g square. Once we prove this then it will follow quite easily that the cardinality of qn is exactly 1 by 2 of the cardinality of un and so it will have phi n by 2 elements and this statement is also quite easy to see because qn is after all the squares of every element in un. But every element in un is some power of g because g is your primitive root. You have fixed a primitive root g and then you are going to take the square. So this is for i let us say in capital N and therefore this is nothing but a group which is generated by g square and so we get that qn is the subgroup of un which is generated by g square. So here we have proved that every element of qn is a power of g square and that already tells you that the cyclic subgroup qn of un is generated by g square. So you will have that there are exactly half the elements in qn as they are varying un and so the cardinality of qn then happens to be phi n by 2 where this phi is the Euler phi function. So here there is one small thing where I would like to draw your attention to which is that we are taking n to be bigger than 2. If your n is equal to 2 of course that is the case that we are avoiding everywhere but if you were taking n to be equal to 2 then u2 has only one element and although g which is the primitive root for u2 which is 1 is itself a square. So q2 also has one element and therefore this statement will not be quite true. So that is one small remark for which we have to take n to be bigger than 2 because then we know that phi n is going to be an even number for every n bigger than 2 the Euler phi function is always an even number. Once we have this then the rest of the things follow quite nicely. So what we are now going to do is to look very closely to the squares in general for you the squares in un try to devise a way to compute these squares and get some nice formulae about it. The punch lines that are going to come are the quadratic reciprocity laws. These are some very important laws and they have very interesting generalizations in higher dimension where instead of quadratic you have a cubic reciprocity law, a quartic reciprocity law and so on and finally there is the pinnacle of algebraic number theory which is Artin's reciprocity law. But to go to that we must first learn the quadratic reciprocity law. We will go towards that in our next lecture. I hope to see you until then. Thank you.