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
5278610527010
8615271334101
527334119301-1
33419311411-12
193141152-12-3
141522372-38
5237115-38-11
3715278-1130
15721-1130-71
717030-71527
So our multiplicative inverse is -71 mod 527 ≡ 456
Source: ExtendedEuclideanAlgorithm.com

nbqr t1t2t3
72763113401-11
63341291-1112
342915-1112-23
2955412-23127
5411-23127-150
4140127-150727
So our multiplicative inverse is -150 mod 727 ≡ 577
Source: ExtendedEuclideanAlgorithm.com

nbqr t1t2t3
4455282901-8
52291231-89
292316-89-17
236359-1760
6511-1760-77
515060-77445
So our multiplicative inverse is -77 mod 445 ≡ 368
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 ≡ 850 × 861-1 (mod 527) ≡ 850 × 456 (mod 527) ≡ 255 (mod 527)
x ≡ 943 × 63-1 (mod 727) ≡ 943 × 577 (mod 727) ≡ 315 (mod 727)
x ≡ 288 × 52-1 (mod 445) ≡ 288 × 368 (mod 445) ≡ 74 (mod 445)


Now the actual calculation

  1. Find the common modulus M
    M = m1 × m2 × ... × mk = 527 × 727 × 445 = 170492405
  2. We calculate the numbers M1 to M3
    M1=M/m1=170492405/527=323515,   M2=M/m2=170492405/727=234515,   M3=M/m3=170492405/445=383129
  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
    5273235150527010
    323515527613464101
    52746416301-1
    464637231-18
    6323217-18-17
    2317168-1725
    17625-1725-67
    651125-6792
    5150-6792-527
    So our multiplicative inverse is 92 mod 527 ≡ 92
    Source: ExtendedEuclideanAlgorithm.com

    nbqr t1t2t3
    7272345150727010
    234515727322421101
    727421130601-1
    42130611151-12
    306115276-12-5
    115761392-57
    7639137-57-12
    3937127-1219
    372181-1219-354
    212019-354727
    So our multiplicative inverse is -354 mod 727 ≡ 373
    Source: ExtendedEuclideanAlgorithm.com

    nbqr t1t2t3
    4453831290445010
    383129445860429101
    44542911601-1
    4291626131-127
    161313-127-28
    1334127-28139
    3130-28139-445
    So our multiplicative inverse is 139 mod 445 ≡ 139
    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
    =  (255 × 323515 × 92 +
       315 × 234515 × 373 +
       74 × 383129 × 139)   mod 170492405
    = 42105974 (mod 170492405)


    So our answer is 42105974 (mod 170492405).


Verification

So we found that x ≡ 42105974
If this is correct, then the following statements (i.e. the original equations) are true:
861x (mod 527) ≡ 850 (mod 527)
63x (mod 727) ≡ 943 (mod 727)
52x (mod 445) ≡ 288 (mod 445)

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