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
1014180101010
418101414101
101147301-7
143421-729
3211-729-36
212029-36101
So our multiplicative inverse is -36 mod 101 ≡ 65
Source: ExtendedEuclideanAlgorithm.com

nbqr t1t2t3
53312543301-4
125333261-413
332617-413-17
2673513-1764
7512-1764-81
522164-81226
2120-81226-533
So our multiplicative inverse is 226 mod 533 ≡ 226
Source: ExtendedEuclideanAlgorithm.com

nbqr t1t2t3
5696210569010
621569152101
56952104901-10
5249131-1011
493161-1011-186
313011-186569
So our multiplicative inverse is -186 mod 569 ≡ 383
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 ≡ 861 × 418-1 (mod 101) ≡ 861 × 65 (mod 101) ≡ 11 (mod 101)
x ≡ 233 × 125-1 (mod 533) ≡ 233 × 226 (mod 533) ≡ 424 (mod 533)
x ≡ 295 × 621-1 (mod 569) ≡ 295 × 383 (mod 569) ≡ 323 (mod 569)


Now the actual calculation

  1. Find the common modulus M
    M = m1 × m2 × ... × mk = 101 × 533 × 569 = 30630977
  2. We calculate the numbers M1 to M3
    M1=M/m1=30630977/101=303277,   M2=M/m2=30630977/533=57469,   M3=M/m3=30630977/569=53833
  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
    1013032770101010
    303277101300275101
    1017512601-1
    75262231-13
    262313-13-4
    233723-431
    3211-431-35
    212031-35101
    So our multiplicative inverse is -35 mod 101 ≡ 66
    Source: ExtendedEuclideanAlgorithm.com

    nbqr t1t2t3
    533574690533010
    57469533107438101
    53343819501-1
    438954581-15
    9558137-15-6
    58371215-611
    3721116-611-17
    21161511-1728
    16531-1728-101
    515028-101533
    So our multiplicative inverse is -101 mod 533 ≡ 432
    Source: ExtendedEuclideanAlgorithm.com

    nbqr t1t2t3
    569538330569010
    5383356994347101
    569347122201-1
    34722211251-12
    222125197-12-3
    125971282-35
    9728313-35-18
    2813225-1841
    13261-1841-264
    212041-264569
    So our multiplicative inverse is -264 mod 569 ≡ 305
    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
    =  (11 × 303277 × 66 +
       424 × 57469 × 432 +
       323 × 53833 × 305)   mod 30630977
    = 30017918 (mod 30630977)


    So our answer is 30017918 (mod 30630977).


Verification

So we found that x ≡ 30017918
If this is correct, then the following statements (i.e. the original equations) are true:
418x (mod 101) ≡ 861 (mod 101)
125x (mod 533) ≡ 233 (mod 533)
621x (mod 569) ≡ 295 (mod 569)

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