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
70911462501-6
114254141-625
2514111-625-31
14111325-3156
11332-3156-199
321156-199255
2120-199255-709
So our multiplicative inverse is 255 mod 709 ≡ 255
Source: ExtendedEuclideanAlgorithm.com

nbqr t1t2t3
601483111801-1
4831184111-15
11811108-15-51
118135-5156
8322-5156-163
321156-163219
2120-163219-601
So our multiplicative inverse is 219 mod 601 ≡ 219
Source: ExtendedEuclideanAlgorithm.com

nbqr t1t2t3
521263125801-1
263258151-12
2585513-12-103
53122-103105
3211-103105-208
2120105-208521
So our multiplicative inverse is -208 mod 521 ≡ 313
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 ≡ 868 × 114-1 (mod 709) ≡ 868 × 255 (mod 709) ≡ 132 (mod 709)
x ≡ 459 × 483-1 (mod 601) ≡ 459 × 219 (mod 601) ≡ 154 (mod 601)
x ≡ 622 × 263-1 (mod 521) ≡ 622 × 313 (mod 521) ≡ 353 (mod 521)


Now the actual calculation

  1. Find the common modulus M
    M = m1 × m2 × ... × mk = 709 × 601 × 521 = 222002789
  2. We calculate the numbers M1 to M3
    M1=M/m1=222002789/709=313121,   M2=M/m2=222002789/601=369389,   M3=M/m3=222002789/521=426109
  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
    7093131210709010
    313121709441452101
    709452125701-1
    45225711951-12
    257195162-12-3
    19562392-311
    62968-311-69
    981111-6980
    8180-6980-709
    So our multiplicative inverse is 80 mod 709 ≡ 80
    Source: ExtendedEuclideanAlgorithm.com

    nbqr t1t2t3
    6013693890601010
    369389601614375101
    601375122601-1
    37522611491-12
    226149177-12-3
    149771722-35
    777215-35-8
    7251425-8117
    5221-8117-242
    2120117-242601
    So our multiplicative inverse is -242 mod 601 ≡ 359
    Source: ExtendedEuclideanAlgorithm.com

    nbqr t1t2t3
    5214261090521010
    426109521817452101
    52145216901-1
    452696381-17
    6938131-17-8
    3831177-815
    31743-815-68
    732115-68151
    3130-68151-521
    So our multiplicative inverse is 151 mod 521 ≡ 151
    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
    =  (132 × 313121 × 80 +
       154 × 369389 × 359 +
       353 × 426109 × 151)   mod 222002789
    = 42903140 (mod 222002789)


    So our answer is 42903140 (mod 222002789).


Verification

So we found that x ≡ 42903140
If this is correct, then the following statements (i.e. the original equations) are true:
114x (mod 709) ≡ 868 (mod 709)
483x (mod 601) ≡ 459 (mod 601)
263x (mod 521) ≡ 622 (mod 521)

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