 Now, it turns out the Chinese remainder problem turns out to be very useful because one of the things that we can do is we can take a congruence and reduce it to something that can be solved using the Chinese remainder algorithm. For example, consider a linear congruence, ax congruent to b mod n. In general, I can factor n into a product of primes. I know that is possible because of the fundamental theorem of arithmetic. What I can then do is I can reduce ax congruent to b mod n to a system of simultaneous congruences in these numbers that are relatively prime. And then I can solve this system using the Chinese remainder problem algorithm. Let's take a look at how that works. So let's say I want to find 3x congruent to 7 mod 40. So I have a way of solving this that I can make use of. But let's see what we can do here with the Chinese remainder theorem. So now the important thing is 40 can be written as a product of 8 and 5, which are relatively prime. And so what I have if 3x is congruent to 7 mod 40, well, let's check that out. That says 3x is 40 times something plus 7. Well, rearrange that a little bit. 3x is 8 times something plus 7. So that tells me 3x is going to be congruent to 7 mod 8. Likewise, because 3x is 5 times 8 plus k, 3x is going to be congruent to 7 mod 5. And remember that one of the nice things about working mod anything is you don't ever have to work with a number that is greater than or equal to the modulus. So I don't have to write 3x congruent to 7 mod 5. I can reduce it because the modulus is 5 that reduces to 3x congruent to 2 mod 5. And now I'll apply the Chinese remainder theorem, the Chinese remainder problem algorithm. So now I only have two congruences here. Now we could if we wanted to solve these using the Chinese remainder problem algorithm, but here's something that's useful to note because our numbers are much smaller. I can actually find the multiplicative inverses or I might be able to find the multiplicative inverses directly and use them to solve this equation. So let's take a look at that. So mod 8, 3 times 3 is 9, which is congruent to 1. So 3 is its own multiplicative inverse. So I can multiply this by 3 to get a solution, 9x congruent to 21, that reduces to x congruent to 5. Likewise, mod 5, I know that 3 times 2 is 6, which is congruent to 1 mod 5. So 2 is the multiplicative inverse of 3. So I'll multiply this by 2, get 6x congruent to 4, 6x I can reduce mod 5 to x, and I have x congruent to 4 mod 5. So now, so again the key to the Chinese remainder problem is to find something that is congruent with respect to 1 modulus and 0 with respect to the product of the other moduli. So here, I want to find something that's congruent to 5 mod 8, but 0 mod 5, in other words, I want to look at multiples of 5. So I find that 25 is congruent to 1 mod 8. So 16 congruent to 1 mod 5. And I want to number congruent to 5 mod 8, so I'll multiply by 5. I want to number congruent to 4 mod 5, so multiply by 4. And again, because 125 is congruent to 0 mod 5 and 64 is congruent to 0 mod 8, if I add these two numbers, I won't change either of the congruences. So I have a number, 125 plus 64, 189 satisfies both congruences. And again, I can reduce this by 5 times 8 to get the smallest solution. And there we have it. And so there's my solution to the original system, 3x congruent to 7.