 So one variation of the Chinese remainder problem is this one. Find a number that leaves remainder 7 when divided by 12, 3 when divided by 20, and 4 when divided by 9. So we might try to solve the problem as follows. We want to find a multiple of 20 times 9, 180, that leaves a remainder of 1 when divided by 12. But we can't. And that's because every multiple of 180 is also a multiple of 12, and so the remainder is always 0. And the reason that this happened is our divisors. Since the divisors 12, 20, and 9 have common factors, we won't in general be able to find a multiple of the product of two of the numbers that has remainder 1 when divided by the third. But a solution definitely exists, 103, so what can we do? And this leads to what are sometimes called the generalized Dian rules. A solution to problems of this type appeared in Xinzhe Xiao's mathematical treatise in the nine sections written around the 13th century. The first step is to transform the problem into a similar problem with moduli that have no common factors. And here's a useful result. Suppose a number has a remainder r when divided by p times q. Then that number will have remainder r when divided by p or by q. So for example, if we count by 35s and leave 2, then since 35 is 5 7s, we'd leave 2 if we counted by 7s. And since 35 is 7 5s, we'd also leave 2 if we counted by 5s. Now this is mostly true, but there are some wrinkles. So suppose we count by 12s and leave 7s. Now since 12 is 2 6s, we'd also leave 7 if we counted by 6s. But if we left 7 when counting by 6s, we'd be able to remove another 6 leaving just 1. Similarly, since 12 is 3 4s, we'd leave 7 if we counted by 4s. But if we left 7 when counting by 4s, we'd be able to remove another 4 leaving just 3. So for example, if we wanted to find a number that has a remainder 7 when divided by 12 and 3 when divided by 20, we might proceed as follows. If we leave 7 when counting by 12s, we also leave 7 when counting by 3s and by 4s. But if we left 7 when counting by 3s, we could remove 2 more 3s leaving just 1. And if we left 7 when counting by 4s, we could remove another 4 leaving 3. As for the 20, if we leave 3 when dividing by 20, we also leave 3 when dividing by 5 or by 4. And so putting this all together, we want a number that has remainder 1 when dividing by 3, remainder 3 when dividing by 4, remainder 3 when dividing by 4, and remainder 3 when dividing by 5. Now there's two important things to recognize here. First of all, the remainder when dividing by 4 is the same. It's 3 in both cases. And this is important because if it isn't the same, the problem is unsolvable. The other thing that's important to recognize here is we have a Chinese remainder problem. Find a number that has remainder 1 when divided by 3, remainder 3 when divided by 4, and remainder 3 when divided by 5. Now suppose we have several divisors. So Chen Jiexiao's procedure goes as follows. We could reduce our divisors as follows. If A and B have a common factor, we're going to divide the larger by N and reduce the remainders as necessary, but this isn't actually necessary. And you don't actually need to reduce the remainders if you keep in mind the purpose of the set numbers. They are, for every unit left, set down some amount. So it really doesn't matter what your remainder is. It just means you're going to set down more than you absolutely need to. So let's go back to our problem. Find a number that leaves remainder 7 when divided by 12, 3 when divided by 20, and 4 when divided by 9. So we'll set down the remainders and the divisors, 7 when divided by 12, 3 when divided by 20, and 4 when divided by 9. And first, we'll reduce the divisors. So we might begin with the observation that 12 and 20 have a common factor of 4, so we'll divide the larger by 4. So 20 divided by 4 gives us 5, and that becomes our new divisor in place of the 20. We also see that 12 and 9 have a common factor of 3, so we divide the larger by this common factor. 12 divided by 3 gives us 4 as our replacement divisor. And now we can restate our problem as a Chinese remainder problem. Find a number with remainder 7 when divided by 4, 3 when divided by 5, and 4 when divided by 9. So first, let's find our set numbers. So we want to find a multiple of 5 times 9, 45, that leaves a remainder of 1 when divided by 4, and that number is 45. Next, we'll take the divisors 4 and 9, and we want to find a multiple of 4 times 9, 36, that leaves remainder 1 when divided by 5, and that number is 36. And finally, we want to find a multiple of 4 times 5, 20, that leaves remainder 1 when divided by 9, and that number is 100. And so we might identify our set numbers as follows. For every unit left when divided by 4, set 45. For every unit left when divided by 5, set 36. And for every unit left when divided by 9, set 100. And so since we have remainder 7 when divided by 4, we'll set down 7, 45s, then 3, 36s, and 4, 100s. Add them up to get our solution, 823. And we can reduce this by 4 times 5 times 9, 180, to get our smallest solution. So if I keep subtracting 180, I'll end up with the smallest solution, 103. Now, that's what we got when we didn't reduce the remainders, but we could also reduce the remainders. So if our remainder is 7 when dividing by 4, then we can remove another 4 to get a remainder of 7 minus 4 or 3. And the other two remainders are not going to change, so we find that we have another solution. We could put down 3, 45s, then 3, 36s, and 4, 100s to get another solution, 643. And again, we can reduce this by 180 to get a smaller solution. And if we do that, our smallest solution is going to be 103 once again.