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
9259820925010
982925157101
92557161301-16
5713451-1665
13523-1665-146
531265-146211
3211-146211-357
2120211-357925
So our multiplicative inverse is -357 mod 925 ≡ 568
Source: ExtendedEuclideanAlgorithm.com

nbqr t1t2t3
7119160711010
9167111205101
71120539601-3
205962131-37
961375-37-52
135237-52111
5312-52111-163
3211111-163274
2120-163274-711
So our multiplicative inverse is 274 mod 711 ≡ 274
Source: ExtendedEuclideanAlgorithm.com

nbqr t1t2t3
983410216301-2
4101632841-25
16384179-25-7
8479155-712
795154-712-187
541112-187199
4140-187199-983
So our multiplicative inverse is 199 mod 983 ≡ 199
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 ≡ 921 × 982-1 (mod 925) ≡ 921 × 568 (mod 925) ≡ 503 (mod 925)
x ≡ 252 × 916-1 (mod 711) ≡ 252 × 274 (mod 711) ≡ 81 (mod 711)
x ≡ 254 × 410-1 (mod 983) ≡ 254 × 199 (mod 983) ≡ 413 (mod 983)


Now the actual calculation

  1. Find the common modulus M
    M = m1 × m2 × ... × mk = 925 × 711 × 983 = 646494525
  2. We calculate the numbers M1 to M3
    M1=M/m1=646494525/925=698913,   M2=M/m2=646494525/711=909275,   M3=M/m3=646494525/983=657675
  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
    9256989130925010
    698913925755538101
    925538138701-1
    53838711511-12
    387151285-12-5
    151851662-57
    8566119-57-12
    6619397-1243
    19921-1243-98
    919043-98925
    So our multiplicative inverse is -98 mod 925 ≡ 827
    Source: ExtendedEuclideanAlgorithm.com

    nbqr t1t2t3
    7119092750711010
    9092757111278617101
    71161719401-1
    617946531-17
    9453141-17-8
    53411127-815
    411235-815-53
    1252215-53121
    5221-53121-295
    2120121-295711
    So our multiplicative inverse is -295 mod 711 ≡ 416
    Source: ExtendedEuclideanAlgorithm.com

    nbqr t1t2t3
    9836576750983010
    65767598366948101
    98348202301-20
    4823221-2041
    232111-2041-471
    212041-471983
    So our multiplicative inverse is -471 mod 983 ≡ 512
    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
    =  (503 × 698913 × 827 +
       81 × 909275 × 416 +
       413 × 657675 × 512)   mod 646494525
    = 138682053 (mod 646494525)


    So our answer is 138682053 (mod 646494525).


Verification

So we found that x ≡ 138682053
If this is correct, then the following statements (i.e. the original equations) are true:
982x (mod 925) ≡ 921 (mod 925)
916x (mod 711) ≡ 252 (mod 711)
410x (mod 983) ≡ 254 (mod 983)

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