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
883546133701-1
54633712091-12
3372091128-12-3
2091281812-35
12881147-35-8
81471345-813
4734113-813-21
34132813-2155
13815-2155-76
851355-76131
5312-76131-207
3211131-207338
2120-207338-883
So our multiplicative inverse is 338 mod 883 ≡ 338
Source: ExtendedEuclideanAlgorithm.com

nbqr t1t2t3
85383312001-1
8332041131-142
201317-142-43
1371642-4385
7611-4385-128
616085-128853
So our multiplicative inverse is -128 mod 853 ≡ 725
Source: ExtendedEuclideanAlgorithm.com

nbqr t1t2t3
4457090445010
7094451264101
445264118101-1
2641811831-12
18183215-12-5
8315582-527
15817-527-32
871127-3259
7170-3259-445
So our multiplicative inverse is 59 mod 445 ≡ 59
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 ≡ 897 × 546-1 (mod 883) ≡ 897 × 338 (mod 883) ≡ 317 (mod 883)
x ≡ 902 × 833-1 (mod 853) ≡ 902 × 725 (mod 853) ≡ 552 (mod 853)
x ≡ 694 × 709-1 (mod 445) ≡ 694 × 59 (mod 445) ≡ 6 (mod 445)


Now the actual calculation

  1. Find the common modulus M
    M = m1 × m2 × ... × mk = 883 × 853 × 445 = 335173555
  2. We calculate the numbers M1 to M3
    M1=M/m1=335173555/883=379585,   M2=M/m2=335173555/853=392935,   M3=M/m3=335173555/445=753199
  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
    8833795850883010
    379585883429778101
    883778110501-1
    7781057431-18
    10543219-18-17
    4319258-1742
    19534-1742-143
    541142-143185
    4140-143185-883
    So our multiplicative inverse is 185 mod 883 ≡ 185
    Source: ExtendedEuclideanAlgorithm.com

    nbqr t1t2t3
    8533929350853010
    392935853460555101
    853555129801-1
    55529812571-12
    298257141-12-3
    257416112-320
    411138-320-63
    1181320-6383
    8322-6383-229
    321183-229312
    2120-229312-853
    So our multiplicative inverse is 312 mod 853 ≡ 312
    Source: ExtendedEuclideanAlgorithm.com

    nbqr t1t2t3
    4457531990445010
    7531994451692259101
    445259118601-1
    2591861731-12
    18673240-12-5
    73401332-57
    403317-57-12
    337457-1255
    7512-1255-67
    522155-67189
    2120-67189-445
    So our multiplicative inverse is 189 mod 445 ≡ 189
    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
    =  (317 × 379585 × 185 +
       552 × 392935 × 312 +
       6 × 753199 × 189)   mod 335173555
    = 290867581 (mod 335173555)


    So our answer is 290867581 (mod 335173555).


Verification

So we found that x ≡ 290867581
If this is correct, then the following statements (i.e. the original equations) are true:
546x (mod 883) ≡ 897 (mod 883)
833x (mod 853) ≡ 902 (mod 853)
709x (mod 445) ≡ 694 (mod 445)

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