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
893786110701-1
7861077371-18
10737233-18-17
3733148-1725
33481-1725-217
414025-217893
So our multiplicative inverse is -217 mod 893 ≡ 676
Source: ExtendedEuclideanAlgorithm.com

nbqr t1t2t3
4398948301-4
8983161-45
836135-45-69
65115-6974
5150-6974-439
So our multiplicative inverse is 74 mod 439 ≡ 74
Source: ExtendedEuclideanAlgorithm.com

nbqr t1t2t3
2116780211010
678211345101
2114543101-4
45311141-45
311423-45-14
143425-1461
3211-1461-75
212061-75211
So our multiplicative inverse is -75 mod 211 ≡ 136
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 ≡ 371 × 786-1 (mod 893) ≡ 371 × 676 (mod 893) ≡ 756 (mod 893)
x ≡ 552 × 89-1 (mod 439) ≡ 552 × 74 (mod 439) ≡ 21 (mod 439)
x ≡ 184 × 678-1 (mod 211) ≡ 184 × 136 (mod 211) ≡ 126 (mod 211)


Now the actual calculation

  1. Find the common modulus M
    M = m1 × m2 × ... × mk = 893 × 439 × 211 = 82717697
  2. We calculate the numbers M1 to M3
    M1=M/m1=82717697/893=92629,   M2=M/m2=82717697/439=188423,   M3=M/m3=82717697/211=392027
  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
    893926290893010
    92629893103650101
    893650124301-1
    65024321641-13
    243164179-13-4
    16479263-411
    796131-411-147
    616011-147893
    So our multiplicative inverse is -147 mod 893 ≡ 746
    Source: ExtendedEuclideanAlgorithm.com

    nbqr t1t2t3
    4391884230439010
    18842343942992101
    4399247101-4
    92711211-45
    712138-45-19
    218255-1943
    8513-1943-62
    531243-62105
    3211-62105-167
    2120105-167439
    So our multiplicative inverse is -167 mod 439 ≡ 272
    Source: ExtendedEuclideanAlgorithm.com

    nbqr t1t2t3
    2113920270211010
    3920272111857200101
    21120011101-1
    200111821-119
    11251-119-96
    212019-96211
    So our multiplicative inverse is -96 mod 211 ≡ 115
    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
    =  (756 × 92629 × 746 +
       21 × 188423 × 272 +
       126 × 392027 × 115)   mod 82717697
    = 19558349 (mod 82717697)


    So our answer is 19558349 (mod 82717697).


Verification

So we found that x ≡ 19558349
If this is correct, then the following statements (i.e. the original equations) are true:
786x (mod 893) ≡ 371 (mod 893)
89x (mod 439) ≡ 552 (mod 439)
678x (mod 211) ≡ 184 (mod 211)

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