 A fairly important method of proof in mathematics in general and number theory in particular is something called a pigeonhole proof, and this is based on the following theorem. Suppose I have n pigeons and m pigeonholes, and my goal is eventually to place every pigeon in one of the pigeonholes, and n is greater than m. In that case, it's guaranteed that at least one of these pigeonholes will have more than one pigeon. Now, we also have an infinite pigeonhole theorem, that's corresponding to the case where we have an infinite number of pigeons, and likewise, the extension here is if there's an infinite number of birds, then at least one of the pigeonholes must contain an infinite number of pigeons. Now it's reasonable to say, well, this is just common sense, but do note that these are actually theorems, and we can actually prove that it's necessary that both of these situations arise, that with a finite number of pigeons, then we have pigeonholes that contain more than one pigeon, and likewise with an infinite number of pigeons, at least one of those pigeonholes must contain an infinite number of pigeons. So let's take a look at this. So we have this following problem, 4 to the x congruent to 1 mod 629, and right now what I want to do is I want to prove that a solution actually exists, and this is a fairly common thing to do in mathematics. We're not actually trying to find a solution yet, we're just trying to find that one solution does actually exist, so that we might actually consider devoting the time and effort to finding that solution. All right, so we'll note a couple of important things. First of all, the values 4 and 629, their greatest common divisor is 1. So that tells us that 4 to the power x is never going to be congruent to 0. Since this is a statement on YouTube, you know that it must be true. Actually, you should think about how you might prove such a statement. Here's a quick reminder, if it ever is 0, then that says somehow we've managed to collect the factors of 629 from powers of 4. Well, remember the fundamental theorem of arithmetic guarantees that the prime factorization of a number is unique. All right, so let's find our pigeons first of all. The hardest part of a pigeon hole proof is identifying what the pigeons are and what the pigeon holes are going to be. So our pigeons are going to be, in this case, these powers of 4, and those are the pigeons. And where we're going to place them is going to be determined by these powers reduced mod 629. Now remember there's an infinite number of pigeons, there's an infinite number of powers of 4, but there's only a finite number of things reduced mod 629. So that guarantees that at least one of those pigeon holes, one of those values, mod 629, will contain an infinite number of pigeons. Which tells us that at least two of the powers of 4 have to be congruent. So I didn't know what they are, but I'll call them 4 to power p and 4 to power q. And the thing I know, the thing I can assume is that p is going to be greater than q. Well, I can do a little bit of algebra. I can do a little bit more algebra. And because 4 and 629 are relatively prime, I know that 4 to power q has a multiplicative inverse. Well, I know that 4 has a multiplicative inverse. So multiplying that by q times, then I can get my multiplicative inverse of 4 to power q, so I can eliminate that factor. And I get 4 to power p minus q minus 1, congruent to 0, which tells me that some power of 4 must be congruent to 1. So I'm guaranteed that some solution actually has to exist. Well, again, the purpose of proof is not necessarily to prove something that we would be perfectly willing to accept as true anyway. It's to remind us of things. It's to give us insight into things. And in this particular case, our proof gives us some insight into how we might actually find a solution. So let's take a look at that. So our proof that a solution existed relied on the fact that two of the powers of 4 had to be equivalent mod 629. Well, what that says is that if I can find two powers that are equivalent, I can solve the congruence. So let's use the fast powering algorithm to see what we can find. So 4 squared to 16, and squaring again, and again, and again, and again, and again, and again, oh, wait, there we go. Power of 4, power of 4, they are congruent. And so that gives us our equivalence. Two powers of 4, they're equivalent. So I can do the algebra, do the algebra, and yet my solution for to power 252 is going to be congruent to 1.