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
92521845301-4
21853461-417
53685-417-140
651117-140157
5150-140157-925
So our multiplicative inverse is 157 mod 925 ≡ 157
Source: ExtendedEuclideanAlgorithm.com

nbqr t1t2t3
787338211101-2
338111351-27
1115221-27-156
51507-156787
So our multiplicative inverse is -156 mod 787 ≡ 631
Source: ExtendedEuclideanAlgorithm.com

nbqr t1t2t3
3779400377010
9403772186101
3771862501-2
18653711-275
5150-275-377
So our multiplicative inverse is 75 mod 377 ≡ 75
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 ≡ 259 × 218-1 (mod 925) ≡ 259 × 157 (mod 925) ≡ 888 (mod 925)
x ≡ 668 × 338-1 (mod 787) ≡ 668 × 631 (mod 787) ≡ 463 (mod 787)
x ≡ 205 × 940-1 (mod 377) ≡ 205 × 75 (mod 377) ≡ 295 (mod 377)


Now the actual calculation

  1. Find the common modulus M
    M = m1 × m2 × ... × mk = 925 × 787 × 377 = 274446575
  2. We calculate the numbers M1 to M3
    M1=M/m1=274446575/925=296699,   M2=M/m2=274446575/787=348725,   M3=M/m3=274446575/377=727975
  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
    9252966990925010
    296699925320699101
    925699122601-1
    6992263211-14
    226211016-14-41
    2116154-4145
    16531-4145-176
    515045-176925
    So our multiplicative inverse is -176 mod 925 ≡ 749
    Source: ExtendedEuclideanAlgorithm.com

    nbqr t1t2t3
    7873487250787010
    34872578744384101
    7878493101-9
    84312221-919
    312219-919-28
    2292419-2875
    9421-2875-178
    414075-178787
    So our multiplicative inverse is -178 mod 787 ≡ 609
    Source: ExtendedEuclideanAlgorithm.com

    nbqr t1t2t3
    3777279750377010
    7279753771930365101
    37736511201-1
    365123051-131
    12522-131-63
    522131-63157
    2120-63157-377
    So our multiplicative inverse is 157 mod 377 ≡ 157
    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
    =  (888 × 296699 × 749 +
       463 × 348725 × 609 +
       295 × 727975 × 157)   mod 274446575
    = 47279488 (mod 274446575)


    So our answer is 47279488 (mod 274446575).


Verification

So we found that x ≡ 47279488
If this is correct, then the following statements (i.e. the original equations) are true:
218x (mod 925) ≡ 259 (mod 925)
338x (mod 787) ≡ 668 (mod 787)
940x (mod 377) ≡ 205 (mod 377)

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