 Alright, so let's see how we find square root mod n. So we have our Euler criterion that if n is a prime greater than 2, then y squared congruent to k has a solution if and only if k to the power n minus 1 over 2 is congruent to 1. Unfortunately, the Euler criterion only tells us that a solution exists. It does not tell us how we can find the solution, and for that we'll have to do a little bit of work. It's convenient to break this problem into a number of cases, and the only case we'll discuss here is the case where n is a prime congruent to 3 mod 4. And while we can solve congruence where n is congruent to 1 mod 4, it's a complication we're not going to introduce at this time. So I suppose I do have a prime where n is congruent to 3 mod 4. And remember that that means that n is 3 more than a multiple of 4. It's a 4n plus 3 number. And so remember that our Euler criterion tells us that if y squared congruent to k has a solution, then by the Euler criterion, k to the power n minus 1 over 2 is congruent to 1. And so that tells me k to the power n plus 1 over 2 is congruent to k. If I multiply both sides of this congruence by k, that pops this up to k, that pops this up to n minus 1 over 2 plus 1, which a little bit of algebra, a little bit of arithmetic really, gives me that congruent statement. And this tells us something very useful. First off, I have y squared congruent to k. Well, k itself is k to the power n minus 1 over 2. And remember n is a 4n plus 3 number. So this n plus 1, 4n plus 4 over 2 gives me 2n plus 2. So y squared is k to the power 2n plus 2. And I'll rearrange that a little bit. That tells me that y squared is plus or minus k to the power n plus 1. And equivalently, if I want to go back to talking about n itself, this n plus 1 is the same as n plus 1. That's 4n plus 4 over 4. And so that tells me that if y squared equals k has a solution, that a solution is going to be found by this last expression, k to the power n plus 1 over 4. So for example, if I have the congruence y squared congruent to 31, I want to verify that there is a solution. So we find that this k to the power n minus 1 over 2 is in fact congruent to 1. So I know that there is guaranteed to have a solution. Now we can find that solution by evaluating y to the power n plus 1 over 4. Now there's sort of a built-in check here. You can only apply this when our prime is congruent to 3 mod 4. The built-in check is if you actually apply this to any other prime, this is not going to be an integer and you won't be able to find the exponentiation. So I'll evaluate that. And after some simplification, I get y congruent to 23 plus or minus. And so that's 23 or negative 23 mod 83 is congruent to 60. And so there are my two solutions. One feature that's worth noting is that we don't actually need to check if a solution exists. We can evaluate that expression k to the power n plus 1 over 4 anytime we want to. So for example, let's say I don't do that, solve if possible y congruent to 23 mod 59. And 59 is a 3 mod 4 number. So if y squared congruent to 23 has a solution, that solution is going to be plus or minus 23 to 59 plus 1 over 4. Well I can evaluate this without having to bother to check if a solution exists. I find that that expression is congruent to 6. But the catch here is we don't know that if this has a solution or not. We didn't check. We know that if a solution exists, the solution is going to be 6. But we don't know that the solution exists. So we actually should check it. We have to check at some point. We either check at the beginning to assure ourselves that there is actually a solution or perhaps more usefully, we can check at the end and verify that what we went through all this work to find actually works. And in this particular case, plus or minus 6 squared is congruent to 36. Absolutely not congruent to 23. Now one thing to notice here is that y squared congruent to 23 mod 59 does not have a solution, but y squared congruent to 36 did have a solution. It was the solution that we found. And the other thing to notice here is that 36 is the same as congruent to negative 23 mod 59. And this is a more general result. If n is a prime number and still n congruent to 3 mod 4, then exactly one of the congruences y squared congruent to k or y squared congruent to minus k will have a solution. In some, but not in all cases, this does give us a fast and easy way to check to see if y squared congruent to k has a solution. So for example, y squared congruent to 3 mod 103. Before we do any hard work, we note that 103 is congruent to 3 mod 4. And so exactly one of y squared congruent to 3, y squared congruent to negative 3 has a solution. Now negative 3 is congruent to 100. So working mod 103, so negative 3 and 100 are the same thing. So y squared congruent to 100, well that obviously has a solution. So that tells me that y squared congruent to 3 does not. And I don't have to do any work to find it because it doesn't exist. Well, one more example here, y squared congruent to 60 mod 103. We can check to see if one of those has an obvious solution. Unfortunately, negative 60 is congruent to 43. So we know that one of them has a solution, but it's not obvious which one. No problem. We'll just go ahead and evaluate 60 to 103 plus 1 over 4. 60 to power 26, and that works out to be 36. And if this congruent has a solution, the solution will be 36 or minus 36. Well, we haven't checked what the solution exists, so we might as well do that at this point. 36 to power 36 squared is congruent to 60. So y squared equals 60 has a solution, and it's going to be 36 or again minus 36 mod 103.