 So one of the reasons the Chinese remainder theorem is important is that it allows us to take a congruence where our modulus is a product and reduce it to a system of linear congruences. And this is particularly important in modern cryptography, where one of the things we have to do is evaluate c to power n mod n, where n is some product of primes. Now in general, this is a tedious task. We can speed the evaluation, however, if we know a factorization of n. And we can make the following simplifications. Suppose I know that n is p times q, where p and q are relatively prime. They don't actually even have to be prime, they just have to be relatively prime. And I want to find c to the n mod n. Well, I'll treat that as a congruence. x is congruent to c to the n mod n. Now, because I know n is p times q, I also know that x is congruent to c to the n mod p, and also c to the n mod q. But I might be able to reduce c mod p. So c is going to be some number mod p and some number mod q. Also, that exponent can be reduced because remember that we have the Euler Fermat theorem that any number to the phi of the modulus is going to be congruent to 1. So that means that I can reduce the exponent to some lower value in both cases. And so now my original congruence now becomes two congruences where I'm dealing with much smaller numbers. So for example, let's say I want to find 157 to the power 495 mod 3071. Now, if I don't know a factorization of 3071, I'm stuck. There is nothing I can do that will simplify this problem. I'll have to find this 157 to the power 495 the hard way. On the other hand, if I do know a factorization of 3071 into relatively prime factors, so for example, suppose I do know that 3071 is 37 times 83, then I have a chance of simplifying this problem. So first of all, I'll let 157 to the power 495 be congruent to x mod 3071, and I'll find x by solving the system of congruences mod 37 and 83. So the first thing I'll notice is that 157 is 74 mod 83. Now 83 is prime, so phi of 83 is 82. So I know that for any value of A, A to the power 82 is congruent to 1 mod 83. And so that means I can reduce this 157 to the 495th as, first of all, 157 becomes 74 mod 83, and next I can eliminate powers of 82. So 495 is 82 times 6 plus 3. So this 74 to the power 495 becomes 74 to the 82nd to the 6th times 74 to the 3rd. And this 74 to the 82nd is 1 to the 6th, still 1. And so this first factor can be ignored. And so this number 157 to the 495 has to be congruent to 74 to the 3rd mod 83. And that's much easier to evaluate. That's 18 mod 83. And so that gives me my first linear congruence. Whatever x is, is going to be congruent to 18 mod 83. Now let's take a look at my second thing. I want x to be congruent to 157 to the 495th mod 37. And again I can reduce 157, 157 is congruent to 9 mod 37, 37 is prime. So phi of 37 is 36. So I know that anything to power 36 is going to be congruent to 1 mod 37. And so that allows me to reduce this problem x congruent to 157 to the 495th. 157, I can replace with 9. 495 is 36 times 13 plus 27. So this exponent, 495, 9 to the power 36 to the power 13 times 9 to the 27. 9 to the 36 is going to be 1 to the 13th, still 1. So this first factor drops out and that's going to be 9 to the 27th. And it turns out that 9 to the 27th is going to be 1. So I have my second congruence and my value x is going to be something that is simultaneously congruent to 18 mod 83 and 1 mod 37. And at this point we can apply the Chinese remainder problem algorithm. First of all I can find a multiple of 37 that solves the first congruence. That's 18 more than a multiple of 83 and that works out to be 59.94. Next I can find a multiple of 83 that solves the second congruence. A multiple of 83 that's 1 more than a multiple of 37. Well 27.39 works out. And so the sum 59.94 plus 27.39, 87.33 is going to be a solution to both congruences. Now we do want to find the smallest solution because we're working mod 3071. So I can repeatedly subtract 3071 to find smaller solutions. And it turns out that the smallest solution is going to be 25.91. And so 157 to power 4.95 is going to be 25.91 mod 3071.