 So one of the basic problems investigated in number theory is known as a linear diapfantine equation. Although another more modern term for it is a linear congruence. And the generic linear diapfantine equation linear congruence problem is the following. We want to find a multiple of some number m that leaves a specific remainder r when we divide it by some specific divisor d. And these are called linear diapfantine equations, even though this type of problem was never actually investigated by Diapfantis. Instead, the earliest work on these types of equations were done by a number of Indian mathematicians of the very early Middle Ages, 4th and 5th centuries AD, who posed problems of this type and solved it. Using a method they called the pulverizer. Now, their description of the pulverizer is very, very, very, very difficult to wade through, but if you understand the modern method of solving linear diapfantine equations and read about the pulverizer, it's clear that the two are in fact the same methods. Just the description of the pulverizer is much more complicated because the medieval Indians did not have our modern notation and it makes it much more difficult to express complex ideas. So, for example, let's see if we can find a multiple of 5 that leaves a remainder 2 when divided by 8. So, again, we have this problem. We have a multiple of some specific number, 5. We have a specific remainder, 2, when we use a specific divisor, 8. Now, if we want to look at this in modern form, first of all, we note that a multiple of 5 is a number of the form, 5x. And if we leave a remainder of 2 when we divide this number by 8, then we know that 5x has to be 8 times y plus 2. It's 2 more than a multiple of 8. And so we know that 5x has to be equal to 8y plus 2. Well, let's do a little bit of algebra. We have two variables, x and y, and almost the first thing we would do if we were given this algebraic equation is we divide both sides by one of the coefficients. And here's the important step. 5 is the smaller of the two coefficients, so we'll want to divide both sides by 5. And so this gives us x is equal to 8y plus 2 over 5. Now, remember, we need x to be a whole number, which means that this fraction, 8y plus 2 over 5, must also be a whole number. In order to make sure that that happens, we'll do the following. We're going to split off a portion that can be divided by 5. And in this particular case, 8y plus 2 is the same as 5y plus 3y plus 2. And if we split up the numerators, we get 5y over 5 plus 3y plus 2 over 5. And that's nice because this first fraction reduces to y, and the second fraction, well, I can't do anything with it, it's 3y plus 2 over 5. However, because we want x to be a whole number, we have now reduced this problem to the following. I want to find a whole number of y that makes this fraction, 3y plus 2 over 5, equal to a whole number. If y is a whole number and 3y plus 2 is a whole number, then x is also going to be a whole number. So here's a useful idea in mathematics, in life, in number theory. If you see a solution, go ahead and use it. So you might be able to look at this expression, 3y plus 2 over 5, and say to yourself, well, self, if y equals 1, then 3y plus 2 over 5 is going to be 3 plus 2 over 5, is going to be 5 over 5, that expression is going to be 1, and so x is going to be equal to 1 plus 1, and it's going to be equal to 2. And remember that we're not looking for x, we're looking for the multiple of 5, which is going to be the number 5x. So that means that 5 times 2, 10, is going to be a multiple of 5, that leaves remainder 2 when divided by 8. Well, all of this is well and good if you can actually see the solution immediately, but what if you can't? Well, let's think about that. In this case, what we want is we want x equal to y plus 3y over 2 plus 5 to be a whole number, and that means we need this fractional part, 3y plus 2 over 5 to be a whole number. I don't know what that number is, so I'll call it z, and I'll let z be 3y plus 2 over 5. Well, nobody likes fractions, so we'll rearrange this. 5z equals 3y plus 2, and we'll do a little bit more rearrangement. 3y equals 5z minus 2, and this expression that we have here, this equation, is almost the same thing as what we started with. And what that means is we can lather and repeat, we can do the same thing we did before and continue our process to find a solution. So, let's see how that might work. So, I know that 5x equals 8y plus 2, so I'll divide both sides by the smaller coefficient. I'll split the numerator into a part that is divisible by 5 and the leftovers, and the fractional part, well, I'll say that's equal to some other whole number, some other integer, multiply both sides. I will solve for the lower coefficient, that's 3y equals 5z minus 2, and I'll do the same thing at this point. I'll divide by 3. I'll split the numerator into a part that is divisible by 3 and what's left over, and I'll reduce part, and I have another fraction. Well, now I'll do the same thing. I want that fraction to be a integer. So, I'll call it w, and I'll get rid of the fraction, multiply both sides by 3. I'll solve for the lower coefficient, I'll divide, I'll split the numerator into two parts, I'll simplify the part that I can, and I have a leftover, and I want that leftover to be an integer. So, I'll call it u, and I'll multiply both sides by 2. I'll solve for the lower coefficient, and, well, note at this point that any number I pick for u is going to give me an integer value for w, and that's also going to give me an integer value for z, an integer value for y, and an integer value for x. So, at this point, I can solve the problem. How can you solve the problem? Well, I can pick any value that I want to for u. So, I'll pick, no, no, no. How about u equals 1? There's no need to be too complicated at this point. Let's take an easy value to work with, and if u is equal to 1, then w is going to be 2 times 1 minus 2. It's going to be 0. Now that I know what w is, I can substitute that in and find the value z. z is 0 plus, 0 plus 2 over 2. That simplifies, that simplifies down to z equals 1. Now that I know what z is, I can substitute into my equation for y, and I'll find that y is equal to 1. And now that I know the value of y, I can substitute that into x and find the value for x, and x is going to be equal to 2. And at this point, the thing to remember is the actual multiple of 5 that we're looking for is going to be 5 times whatever the value of x is. So, again, 10 is going to be our solution. Well, one useful thing is that once we have these relationships, we can find as many solutions as we want. So I have my four relationships that tell me what x is, y is, z is, and w is, and I'll pick a different value for u. For example, I might let u equal to 5. So I'll drop u equal 5 into my equation for w, and I find that w is equal to 8. Now that I know what w is, I can drop that into the equation for z, and I find that z is equal to 13. I can drop that into the equation for y, and if z is equal to 13, I find y is equal to 21. I'll drop that into the equation for x, and I find that x is equal to 34. And again, the actual number I'm looking for is 5 times x. So I find that 5 times x is 170, and this is a number that is a multiple of 5, and when we divide it by 8, we do discover that it has remainder 2, which is exactly what we want. And we can use this process to generate as many solutions as we want.