Bootstrap
  C.R.T. .com
It doesn't have to be difficult if someone just explains it right.

Welcome to ChineseRemainderTheorem.com!

×

Modal Header

Some text in the Modal Body

Some other text...

Use the calculator below to get a step-by-step calculation of the Chinese Remainder Theory. Just enter the numbers you would like and press "Calculate" .


This removes all numbers from the textboxes, such that you can fill in your own.

This fills all textboxes with random numbers. If you fill in random numbers yourself, it is very likely that those numbers do not have a solution. To avoid disappointment, use this button instead! It only uses random numbers that do have a solution.

This button is similar to the "Clear everything" button, but only clears the left column.
This is useful if you want your equations to be of the form x ≡ a (mod m) rather than bx ≡ a (mod m).
In that case, it can be especially useful after using the random numbers button.

Do you want to use more equations? Go ahead and use this button. It adds another row that you can fill in. Not sure what numbers to put in this newly added row? Use the random numbers button again!

Do you have too many rows? Use one of these buttons to remove a row. You can always add a row again using the yellow "Add a row" button.

Are you ready to view a full step-by-step Chinese Remainder Theorem calculation for the numbers you have entered? Then use this button!

Want to know more?


Transform the equations

You used one or more of the fields on the left, so your equations are of the form bx ≡ a mod m.
We want them to be of the form x ≡ a mod m, so we need to move the values on the left to the right side of the equation.
For a more detailed explanation about how this works, see this part of our page about how to execute the Chinese Remainder algorithm.

First, we calculate the inverses of the leftmost value on each row:

nbqr t1t2t3
729602112701-1
6021274941-15
12794133-15-6
94332285-617
332815-617-23
2855317-23132
5312-23132-155
3211132-155287
2120-155287-729
So our multiplicative inverse is 287 mod 729 ≡ 287
Source: ExtendedEuclideanAlgorithm.com

nbqr t1t2t3
7337301301-1
730324311-1244
3130-1244-733
So our multiplicative inverse is 244 mod 733 ≡ 244
Source: ExtendedEuclideanAlgorithm.com

nbqr t1t2t3
81540221101-2
402113661-273
11615-273-75
651173-75148
5150-75148-815
So our multiplicative inverse is 148 mod 815 ≡ 148
Source: ExtendedEuclideanAlgorithm.com

Click on any row to reveal a more detailed calculation of each multiplicative inverse.

Now that we now the inverses, let's move the leftmost value on each row to the right of the equation:

x ≡ 908 × 602-1 (mod 729) ≡ 908 × 287 (mod 729) ≡ 343 (mod 729)
x ≡ 170 × 730-1 (mod 733) ≡ 170 × 244 (mod 733) ≡ 432 (mod 733)
x ≡ 63 × 402-1 (mod 815) ≡ 63 × 148 (mod 815) ≡ 359 (mod 815)


Now the actual calculation

  1. Find the common modulus M
    M = m1 × m2 × ... × mk = 729 × 733 × 815 = 435500955
  2. We calculate the numbers M1 to M3
    M1=M/m1=435500955/729=597395,   M2=M/m2=435500955/733=594135,   M3=M/m3=435500955/815=534357
  3. We now calculate the modular multiplicative inverses M1-1 to M3-1
    Have a look at the page that explains how to calculate modular multiplicative inverse.
    Using, for example, the Extended Euclidean Algorithm, we will find that:

    nbqr t1t2t3
    7295973950729010
    597395729819344101
    72934424101-2
    344418161-217
    411629-217-36
    1691717-3653
    9712-3653-89
    723153-89320
    2120-89320-729
    So our multiplicative inverse is 320 mod 729 ≡ 320
    Source: ExtendedEuclideanAlgorithm.com

    nbqr t1t2t3
    7335941350733010
    594135733810405101
    733405132801-1
    4053281771-12
    32877420-12-9
    77203172-929
    201713-929-38
    1735229-38219
    3211-38219-257
    2120219-257733
    So our multiplicative inverse is -257 mod 733 ≡ 476
    Source: ExtendedEuclideanAlgorithm.com

    nbqr t1t2t3
    8155343570815010
    534357815655532101
    815532128301-1
    53228312491-12
    283249134-12-3
    249347112-323
    341131-323-72
    11111023-72815
    So our multiplicative inverse is -72 mod 815 ≡ 743
    Source: ExtendedEuclideanAlgorithm.com
  4. Now we can calculate x with the equation we saw earlier
    x = (a1 × M1 × M1-1   +   a2 × M2 × M2-1   + ... +   ak × Mk × Mk-1)   mod M
    =  (343 × 597395 × 320 +
       432 × 594135 × 476 +
       359 × 534357 × 743)   mod 435500955
    = 166302739 (mod 435500955)


    So our answer is 166302739 (mod 435500955).


Verification

So we found that x ≡ 166302739
If this is correct, then the following statements (i.e. the original equations) are true:
602x (mod 729) ≡ 908 (mod 729)
730x (mod 733) ≡ 170 (mod 733)
402x (mod 815) ≡ 63 (mod 815)

Let's see whether that's indeed the case if we use x ≡ 166302739.