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
6837180683010
718683135101
68335191801-19
35181171-1920
181711-1920-39
17117020-39683
So our multiplicative inverse is -39 mod 683 ≡ 644
Source: ExtendedEuclideanAlgorithm.com

nbqr t1t2t3
83107083010
10783124101
832431101-3
2411221-37
11251-37-38
21207-3883
So our multiplicative inverse is -38 mod 83 ≡ 45
Source: ExtendedEuclideanAlgorithm.com

nbqr t1t2t3
5279800527010
9805271453101
52745317401-1
45374691-17
74982-17-57
92417-57235
2120-57235-527
So our multiplicative inverse is 235 mod 527 ≡ 235
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 ≡ 993 × 718-1 (mod 683) ≡ 993 × 644 (mod 683) ≡ 204 (mod 683)
x ≡ 514 × 107-1 (mod 83) ≡ 514 × 45 (mod 83) ≡ 56 (mod 83)
x ≡ 333 × 980-1 (mod 527) ≡ 333 × 235 (mod 527) ≡ 259 (mod 527)


Now the actual calculation

  1. Find the common modulus M
    M = m1 × m2 × ... × mk = 683 × 83 × 527 = 29875103
  2. We calculate the numbers M1 to M3
    M1=M/m1=29875103/683=43741,   M2=M/m2=29875103/83=359941,   M3=M/m3=29875103/527=56689
  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
    683437410683010
    437416836429101
    68329231601-23
    29161131-2324
    161313-2324-47
    1334124-47212
    3130-47212-683
    So our multiplicative inverse is 212 mod 683 ≡ 212
    Source: ExtendedEuclideanAlgorithm.com

    nbqr t1t2t3
    83359941083010
    35994183433653101
    835313001-1
    53301231-12
    302317-12-3
    237322-311
    7231-311-36
    212011-3683
    So our multiplicative inverse is -36 mod 83 ≡ 47
    Source: ExtendedEuclideanAlgorithm.com

    nbqr t1t2t3
    527566890527010
    56689527107300101
    527300122701-1
    3002271731-12
    2277338-12-7
    738912-765
    8180-765-527
    So our multiplicative inverse is 65 mod 527 ≡ 65
    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
    =  (204 × 43741 × 212 +
       56 × 359941 × 47 +
       259 × 56689 × 65)   mod 29875103
    = 29171817 (mod 29875103)


    So our answer is 29171817 (mod 29875103).


Verification

So we found that x ≡ 29171817
If this is correct, then the following statements (i.e. the original equations) are true:
718x (mod 683) ≡ 993 (mod 683)
107x (mod 83) ≡ 514 (mod 83)
980x (mod 527) ≡ 333 (mod 527)

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