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
4394900439010
490439151101
4395183101-8
51311201-89
3120111-89-17
2011199-1726
11912-1726-43
924126-43198
2120-43198-439
So our multiplicative inverse is 198 mod 439 ≡ 198
Source: ExtendedEuclideanAlgorithm.com

nbqr t1t2t3
3378580337010
8583372184101
337184115301-1
1841531311-12
15331429-12-9
3129122-911
292141-911-163
212011-163337
So our multiplicative inverse is -163 mod 337 ≡ 174
Source: ExtendedEuclideanAlgorithm.com

nbqr t1t2t3
827480134701-1
48034711331-12
347133281-12-5
133811522-57
8152129-57-12
52291237-1219
292316-1219-31
2363519-31112
6511-31112-143
5150112-143827
So our multiplicative inverse is -143 mod 827 ≡ 684
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 ≡ 89 × 490-1 (mod 439) ≡ 89 × 198 (mod 439) ≡ 62 (mod 439)
x ≡ 432 × 858-1 (mod 337) ≡ 432 × 174 (mod 337) ≡ 17 (mod 337)
x ≡ 641 × 480-1 (mod 827) ≡ 641 × 684 (mod 827) ≡ 134 (mod 827)


Now the actual calculation

  1. Find the common modulus M
    M = m1 × m2 × ... × mk = 439 × 337 × 827 = 122348861
  2. We calculate the numbers M1 to M3
    M1=M/m1=122348861/439=278699,   M2=M/m2=122348861/337=363053,   M3=M/m3=122348861/827=147943
  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
    4392786990439010
    278699439634373101
    43937316601-1
    373665431-16
    6643123-16-7
    43231206-713
    232013-713-20
    2036213-20133
    3211-20133-153
    2120133-153439
    So our multiplicative inverse is -153 mod 439 ≡ 286
    Source: ExtendedEuclideanAlgorithm.com

    nbqr t1t2t3
    3373630530337010
    3630533371077104101
    33710432501-3
    10425441-313
    25461-313-81
    414013-81337
    So our multiplicative inverse is -81 mod 337 ≡ 256
    Source: ExtendedEuclideanAlgorithm.com

    nbqr t1t2t3
    8271479430827010
    147943827178737101
    82773719001-1
    737908171-19
    901755-19-46
    175329-46147
    5221-46147-340
    2120147-340827
    So our multiplicative inverse is -340 mod 827 ≡ 487
    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
    =  (62 × 278699 × 286 +
       17 × 363053 × 256 +
       134 × 147943 × 487)   mod 122348861
    = 26311966 (mod 122348861)


    So our answer is 26311966 (mod 122348861).


Verification

So we found that x ≡ 26311966
If this is correct, then the following statements (i.e. the original equations) are true:
490x (mod 439) ≡ 89 (mod 439)
858x (mod 337) ≡ 432 (mod 337)
480x (mod 827) ≡ 641 (mod 827)

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