 Welcome back, we are now going towards finding squares in un and as our experience tells us until now that things are very nice when we are looking at n to be a prime number. And remember also that we are looking at odd n, so we should be looking at odd primes. So, we begin with trying to compute the squares in up or what we would like to do is to find how many elements are squares in up or what are the elements which are squares in up. So, this was studied quite sometime back 2 centuries back by the mathematician Legendre who has done lot of other work including work in differential equations. And there is a one particular quantity that Legendre defined that is called the Legendre symbol. So, we will see the definition of this Legendre symbol. What we have is that we take n, we take an element a in the natural numbers and let p be any odd prime. So, here our n is the set of natural numbers and we are starting with any odd prime p then we define the Legendre symbol of a with respect to p. And this is so given any odd prime we are going to define the Legendre symbol for any natural number a and the formula is a complicated formula. Let us look at the formula once and we will then try to understand the formula in some detail. So, the formula is as given here. It says that the quantity is 0 the Legendre symbol is 0 if p divides a. So, for all the natural numbers a which are divisible by p the Legendre symbol is 0 and for the non-zero elements the elements which are so this is of course to say that when a is congruent to 0 mod p that is all that is what we are going to have here. So, whenever you have a not to be congruent to 0 mod p the Legendre symbol can be 1 or minus 1 depending on whether a is a square modulo p or whether a is not a square modulo p. So, this Legendre symbol has 3 values it will be 0 for all the natural numbers which are divisible by p. So, 0 and if you are looking at natural numbers we will start with p. So, p 2p 3p 4p and so on for all these numbers the Legendre symbol is 0. So, then for the squares modulo p Legendre symbol is 1. So, this is a computation that we will have to do separately for each prime very carefully. We already observed that in the case where p was 7 we had 3 squares 1, 2 and 4 these were the 3 squares. So, when you are going modulo 7 the Legendre symbol will be 1 for these 3 elements for the remaining 3 elements in u 7 the Legendre symbol will be minus 1 and whenever 7 divides some particular a the Legendre symbol will be 0. This is the understanding of Legendre symbol. So, in other words what we have is that this symbol a by p this is our definition of Legendre symbol we will call it a by p this is the symbol we are looking at. So, this is 0 exactly when p divides a just as the last slide also told us else it is 1 or minus 1 depending on whether a is an element of q p or not whenever a is a square modulo p Legendre symbol is 1 whenever a is not a square modulo p the Legendre symbol is minus 1. So, let us do some computation of Legendre symbols. Let p be 7 and suppose now we want to do the computation of Legendre symbols. So, we want to compute a by 7 that is what we want to compute. So, we have that u 7 is 1, 2, 3, 4, 5, 6 the invertible elements modulo 7 are exactly 1, 2, 3, 4, 5, 6. So, among these we have computed the squares explicitly and let us just do it once again. So, 1 will give you 1 as the square and 6 also gives you 1, 2 will give you the square 4 and minus 2 which is 5 that will also give you the square to be 4 because 5 square is 25 which is 4 modulo 7 and 3 as well as 4 will give you the square to be 2. So, we have exactly 3 squares in u 7 or there are exactly 3 elements in q 7 and when you write them by order you will write them as 1, 2, 4 and so this is exactly what we have. So, whenever these element is 1, 2 or 4 modulo 7 then you have that the computation of Legendre symbol modulo 7 is 1. The remaining 3 elements which are 3, 5, 6 mod 7 there the Legendre symbol value is minus 1 and of course whenever a is divisible by 7 we have that the Legendre symbol is 0. Now, this computing the squares explicitly is not going to work all the time. There are some very high numbers very large numbers which are primes and we would like to find a way to do these computations effectively. So, there are some laws that we will require to do these computations. So, we will prove these laws in due course right now what we will do is to try to get some hand of how these Legendre symbols behave. So, this is the first lemma that we have in that direction that we will start with an odd prime p then for every a and b in the set of natural numbers. So, you are taking a and b coming from n then we always have that the Legendre symbol of a, b with respect to p is the product of the Legendre symbols of a and b with respect to p. So, when you want to compute suppose you wanted to compute the Legendre symbol modulo 23, 23 is a prime prime. If you wanted to compute the Legendre symbol of say 15 modulo 23 it would be difficult to see whether 15 is a square or not. But if you know whether 3 is a square or not and 5 is a square or not you will have the information about 15 being a square or not. So, whenever you know the value of the Legendre symbol 3 by 23 and 5 by 23 that will allow you to compute the Legendre symbol for 15 by 23. So, this way we can compute from the small elements we by taking products we will be able to compute the Legendre symbols for all elements modulo p. And of course, we know that you will then have to compute it only for primes and you can actually start with these a, b to be elements in integers not necessarily only in natural numbers. So, you will look at negative numbers you will look at positive numbers and among the negative numbers if you know how to compute the Legendre symbol of minus 1 then you can just do the calculation for positive numbers. And with minus 1 you have the calculation for all integers and among positive numbers also once you know how to compute Legendre symbol for each prime with respect to a given prime p then you have lot of freedom then you have lot of tools at your hand to compute these Legendre symbols. So, let us prove this statement right now we want to prove that this a, b by p is a by p b by p. So, first possibility is that if p divides a, b then p divides a or p divides b. This is one statement that we know quite well by now and this is in fact also true if and only if. So, you will in fact have that this happens if and only if you have that p divides a or p divides b. So, we will get that a, b by p is 0 if and only if a by p is 0 or b by p is 0. So, here on the right hand side of the if and only if symbol I have two numbers and I am saying that this number is 0 or that number is 0 and when you have two numbers and you have the possibility that one of them can be 0 this is written in terms of having the product being 0. So, we have the equality a, b by p equal to a by p b by p whenever we have the equality to be 0. So, now we will assume that we do not have any of these three values a, b by p, a by p and b by p we assume that none of these are 0. So, what we will have is that a is in up b is in up and therefore a b is also in up and then we will compute these Legendre symbols and see whether we get the equality. So, we are we can therefore assume now. So, we now assume that a, b is an element in up. This is our standing assumption now. So, a, b are in up and we want to check whether a, b by p is same as a by p b by p. Now, we observe that up has a primitive root. We have proved in fact that when p is an odd prime up power e has a primitive root. So, in particular up has a primitive root and then we also saw that the number of squares will have cardinality exactly p minus 1 by 2. The subgroup consisting of all squares has cardinality p minus 1 by 2 exactly half the elements are squares. So, clearly if a, b belong to q, p then a the product a, b is also in q, p because it is a subgroup. Remember I had said that this fact is going to play an important role. So, if a comma b both are in q, p then the product a, b is in q, p and then we get the equality quite easily because all these Legendre symbols are one. Now, we have to deal with the case where one of the two is in q, p and the other is not in q, p and then finally, we will have to deal with the case where none of those two is in q, p. So, those are the only two conditions that we need to verify our proof in. So, we start with a in q, p and b not in q, p but observe that the cardinality of q, p is exactly 1 by 2 of the cardinality of u, p. So, q, p which is the subgroup of u, p has exactly half the elements and the remaining set of elements is therefore, going to be a single coset. We have observed that whenever you have a normal subgroup here the groups are abelian. So, we have the subgroup q, p inside u, p and then you will take the cosets of q, p in u, p you will take the cosets of q, n in u, n in general then each coset will have cardinality equal to the cardinality of q, n. But since q, p has cardinality exactly half of that of u, p the elements which are outside u, p will form a single coset. So, since cardinality of q, p is cardinality of u, p upon 2 these set u, p minus q, p is a single coset. Since b is not in q, p this is equal to the coset b, q, p. Now we have that a is in q, p and then b, a also belongs to the coset b, q, p which is actually equal to u, p minus q, p. So, here we get that when you have a in q, p b is not in q, p it will tell you that b, a or a, b is not in q, p. So, the computations will tell you that a, b by p which is now minus 1 because a, b is not in q, p is also equal to a by p, b by p which is 1 into minus 1 which is minus 1. So, the case a being in q, p and b not in q, p is now done because then a, b is also not in q, p and now we have to deal with the final case where we will take both a and b not in q, p. If a is not in q, p and b is not in q, p then by our earlier assumption observation we have that up minus q, p is a single coset. So, we have that b is in b, q, p and a is also in b, q, p. So, that will tell you that a is equal to b times some element alpha where alpha belongs to q, p and similarly whenever b is not in q, p you will have that b inverse is also not in q, p and so b inverse will also give you the same coset and therefore a is b inverse alpha. q, p being the subgroup if b inverse was in q, p then b would also have to be in q, p. So, we get a equal to b inverse alpha which says that a, b is alpha which is in q, p and therefore we get that the product a, b by p which is now 1 because a, b is in q, p is equal to the product of 2 minus 1. So, we get equality in all the cases. Once again what we have observed is only the following thing. When you have p dividing a, b that is true if and only p divides a or p divides b. So, a, b by p can be 0 precisely when one of the a by p and b by p is 0. So, if a by p and b by 2 are both non-zero then a, b by p cannot be 0. So, whenever p divides a or p divides b then we have the equality for a, b by p equal to a by p into b by p and therefore we are now going into the case where a, b are in up these are invertible modulo p. When these are invertible modulo p the possibilities are that a and b will belong to q, p or not but there is a you know there would be 4 cases a and b in q, p a in q, p b not in q, p a not in q, p but b in q, p actually this is the same as the second case because then you can just replace a by b and b by a and the third case now for us is when none of the a, b is in q, p and what we observe is that a, b belong to q, p implies a, b belongs to q, p. So, we have the equation that the equation holds if a is in q, p and b is not in q, p then we prove that a, b is not in q, p. So, indeed you get 1 into minus 1 to be minus 1 and finally we see that whenever a is not in q, p, b is not in q, p a, b has to be in q, p. So, you get minus 1 into minus 1 equal to 1. So, the equality of the a, b by p the Legendre symbol of the products is the product of the Legendre symbols that equality holds in all cases and that completes our result for us. However, our up's also have primitive roots. So, with respect to the primitive roots we can actually have this result quite nicely that whenever g is a primitive root in up then the Legendre symbol of g power i is simply minus 1 to the power i and the only thing that we have to prove here is that the Legendre symbol of g is minus 1 that g cannot be inside q, p. Once we prove this then the Legendre symbol of g has to be minus 1 and this result will follow by whatever we have proved earlier. So, that is the only thing we have to see. So, we need to prove g is not in q, p but this is quite clear because the group generated by g is the group up. If your g was sitting in q, p then the whole up will be sitting in q, p but q, p is also a subset of up. So, this would force that up equal to q, p but this is a contradiction by the computation of the order of q, p that we have seen earlier. We have seen that whenever we have a primitive element there are exactly 2 square roots of 1 namely 1 and minus 1 we are taking p to be an odd prime. So, 1 and minus 1 are distinct elements modulo p. So, 1 and minus 1 are 2 square roots of 1 therefore the map which sends every element to its square the homomorphism that we saw in the last lecture that has a nontrivial kernel of cardinality 2 and therefore by looking at the cardinalities we get a contradiction. So, we have that g is not in q, p and therefore the Legendre symbol of g by p is minus 1 and then it will follow quite easily that the Legendre symbol of g power i with respect to p is the Legendre symbol of g with respect to p to the power i because we have seen that it is a homomorphism Legendre symbol is multiplicative and so we get this to be minus 1 to the power i. So, very simple fact will tell you that you can compute the Legendre symbol of every element once you know the Legendre symbol of the primitive element or in other words once you know a primitive element. Once you know a primitive element you can write every element as power of this primitive element and then you will be able to compute the Legendre symbols for every element quite easily using these 2 things. This is also another simple result but it is a big theorem because it will help us computing lots and lots of Legendre symbols. The basic thing that is different here is that on the left hand side we have the Legendre symbol which can be 1 or minus 1 or 0 but on the right hand side we have something which is purely in terms of a. So, when you are feeding this as an algorithm to computer it would be very easy for computer to tell that given an a compute the a power p minus 1 by 2 whereas if you were to tell the computer to check whether a is a square or not or whether p divides a or not and so on then that would be more difficult things to prove or to implement on a computer program whereas this is something which is quite feasible. This is something which is quite doable. So, this is one of the very important theorems. Let us see a proof of this very quickly and once we have a proof of this then we can also do some computations and try to compute Legendre symbols for various other elements. So, the basic step here is that it is enough to come to prove this for a primitive g in UP. This is because so I will give a reason to tell why this is enough. So, if a is g power i then we know that the Legendre symbol a by p is the ith power of the Legendre symbol g by p and this is also minus 1 to the power i and further we have that a is g power i. So, a to the power p minus 1 by 2 is g to the power i into p minus 1 by 2 and this is nothing but g power p minus 1 by 2 the whole thing to the power i. So, if we prove the result for the primitive element which would tell you that g power p minus 1 by 2 is congruent to minus 1 modulo p then here we would put the value and get that a to the p minus 1 by 2 is congruent to minus 1 to the power i and from the previous step this is nothing but the Legendre symbol a by p these are both mod p. So, when we have a by p to be equal to minus 1 to the power i and once you prove that g power p minus 1 by 2 once you prove this equality then using this formula we will get directly that modulo p a raise to p minus 1 by 2 is simply the Legendre symbol a by p. So, what we need to show is that g to the power p minus 1 by 2 is not equal to 1 in the group up. So, this simply means that the p minus 1 by 2 power g inside up is equal to minus 1 this is what we want to show when we want to show that modulo p g to the p minus 1 by 2 is minus 1. So, we are going to take these powers of g in up and we want to show that when you raise it to this particular power you get it to be minus 1. So, first of all we note that g to the p minus 1 has to be 1 because the order of g being primitive the order of g is the primitive is the cardinality of u p which is p minus 1. So, g to the p minus 1 is 1 which says that if you were to take this power g to the p minus 1 by 2 and take the square then you get 1. So, this element here is a square root of 1. So, the possibilities are that we get the element g to the p minus 1 by 2 equal to 1 or minus 1 the order of g in up is p minus 1. So, it is not this number which is smaller than p minus 1 and therefore, the power p minus 1 by 2 of g has to be minus 1 in u p. So, this completes the proof. So, what we have proved once again I should recall this for you that the Legendre symbol can be computed very easily simply by taking the p minus 1 by 2 power of your natural number a and going modulo the prime p. So, we will see some more such things which will help us computing the Legendre symbols in the coming lectures. See you until then. Thank you.