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
913654125901-1
65425921361-13
2591361123-13-4
1361231133-47
1231396-47-67
136217-67141
6160-67141-913
So our multiplicative inverse is 141 mod 913 ≡ 141
Source: ExtendedEuclideanAlgorithm.com

nbqr t1t2t3
925813111201-1
8131127291-18
11229325-18-25
2925148-2533
25461-2533-223
414033-223925
So our multiplicative inverse is -223 mod 925 ≡ 702
Source: ExtendedEuclideanAlgorithm.com

nbqr t1t2t3
3798070379010
807379249101
3794973601-7
49361131-78
3613210-78-23
1310138-2331
10331-2331-116
313031-116379
So our multiplicative inverse is -116 mod 379 ≡ 263
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 ≡ 501 × 654-1 (mod 913) ≡ 501 × 141 (mod 913) ≡ 340 (mod 913)
x ≡ 730 × 813-1 (mod 925) ≡ 730 × 702 (mod 925) ≡ 10 (mod 925)
x ≡ 307 × 807-1 (mod 379) ≡ 307 × 263 (mod 379) ≡ 14 (mod 379)


Now the actual calculation

  1. Find the common modulus M
    M = m1 × m2 × ... × mk = 913 × 925 × 379 = 320074975
  2. We calculate the numbers M1 to M3
    M1=M/m1=320074975/913=350575,   M2=M/m2=320074975/925=346027,   M3=M/m3=320074975/379=844525
  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
    9133505750913010
    350575913383896101
    91389611701-1
    8961752121-153
    171215-153-54
    1252253-54161
    5221-54161-376
    2120161-376913
    So our multiplicative inverse is -376 mod 913 ≡ 537
    Source: ExtendedEuclideanAlgorithm.com

    nbqr t1t2t3
    9253460270925010
    34602792537477101
    9257712101-12
    7717701-12925
    So our multiplicative inverse is -12 mod 925 ≡ 913
    Source: ExtendedEuclideanAlgorithm.com

    nbqr t1t2t3
    3798445250379010
    8445253792228113101
    37911334001-3
    113402331-37
    403317-37-10
    337457-1047
    7512-1047-57
    522147-57161
    2120-57161-379
    So our multiplicative inverse is 161 mod 379 ≡ 161
    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
    =  (340 × 350575 × 537 +
       10 × 346027 × 913 +
       14 × 844525 × 161)   mod 320074975
    = 254649735 (mod 320074975)


    So our answer is 254649735 (mod 320074975).


Verification

So we found that x ≡ 254649735
If this is correct, then the following statements (i.e. the original equations) are true:
654x (mod 913) ≡ 501 (mod 913)
813x (mod 925) ≡ 730 (mod 925)
807x (mod 379) ≡ 307 (mod 379)

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