 So one of the useful things we'll be able to do is to find the square root of an integer mod n. And a definition for square roots is the same as we have for the integers. If the square of y is congruent to k, then we say that y is the square root of k mod n. And as with square roots among the integers, not all numbers have square roots. So it would be nice to have some way of identifying whether a number had a square root, and if the square root existed to find what that square root is. And as usual, the starting point is our fundamental theorem, the Euler Fermat theorem. If two numbers are relatively prime, and phi of n is the Euler phi function, then a to the power phi of n is going to be congruent to one mod n. Now we're particularly interested in the case where n is a prime number, so in general, in that case, phi of n is just going to be n minus one, and so I have a to the power n minus one congruent to one mod n. Now if n is prime, in general, with one exception, it will be an odd number, and so that means that n minus one will be even, and that means n minus one over two is going to be some integer. And so let's think about that. Suppose a square root exists. Suppose that y squared congruent to k mod n actually has a solution. Now if I raise both sides to power n minus one over two, guaranteed to be an integer, then I get y to this and k to the same thing, and over on the left-hand side, I get y to the power n minus one, and I know from our fundamental theorem, our Euler Fermat theorem, that anything to power n minus one is going to be congruent to one. So that tells me that k to the power n minus one over two is going to be congruent to one, and joining our starting point, y squared congruent to k has a solution to our ending point, k to the power n minus one over two is congruent to one, gives us a useful result. If y squared equals k mod n has a solution, then k to the power n minus one over two is congruent to one. So for example, let's take a look at the problem y squared congruent to 17 mod 23, and so we might make the following chain of arguments. If this has a solution, then 17 to the power 23 minus one over two will be congruent to one, and we can check to see if this is true. So evaluating that, that's 17 to the 11, that's 22, and well, what does this tell us? This says that this is not congruent to one, so we take our counter positive. If this has a solution, then this is congruent to one. If this is not congruent to one, this has no solution. Let's take a look at another example. So again, if y squared equals k to the power n minus one over two has a solution, then 31 to the power 83 minus one over two is congruent to one, so we'll check it, and we find it's congruent to one, and since 31 to the power 41 is congruent to one, we know that 34 to the power 41 is congruent to one. Our result is that if the congruent has a solution, then k to the power n minus one over two is congruent to one. It does not tell us what we get if k to power n minus one over two is congruent to one. In general, remember, we cannot rely on the truth of the converse of a statement. It might be true, it might not be true. However, we are in luck this case, because we can actually prove the converse, and so this gives us what's known as the Euler criterion, but n be a prime number greater than two, y squared congruent to k mod n has a solution if and only if k to the power n minus one over two is congruent to one. So we saw that if we had a solution, we knew this was true. We also, in this one particular case, not in general, but in this one particular case, we know the converse is also true, that if this congruent is true, then this congruent has a solution, and all we have to do at this point is figure out what that solution is.