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
7517570751010
75775116101
7516125101-125
61601-125751
So our multiplicative inverse is -125 mod 751 ≡ 626
Source: ExtendedEuclideanAlgorithm.com

nbqr t1t2t3
1255430125010
543125443101
1254323901-2
4339141-23
39493-23-29
43113-2932
3130-2932-125
So our multiplicative inverse is 32 mod 125 ≡ 32
Source: ExtendedEuclideanAlgorithm.com

nbqr t1t2t3
8832142101-42
2112101-42883
So our multiplicative inverse is -42 mod 883 ≡ 841
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 ≡ 281 × 757-1 (mod 751) ≡ 281 × 626 (mod 751) ≡ 172 (mod 751)
x ≡ 159 × 543-1 (mod 125) ≡ 159 × 32 (mod 125) ≡ 88 (mod 125)
x ≡ 950 × 21-1 (mod 883) ≡ 950 × 841 (mod 883) ≡ 718 (mod 883)


Now the actual calculation

  1. Find the common modulus M
    M = m1 × m2 × ... × mk = 751 × 125 × 883 = 82891625
  2. We calculate the numbers M1 to M3
    M1=M/m1=82891625/751=110375,   M2=M/m2=82891625/125=663133,   M3=M/m3=82891625/883=93875
  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
    7511103750751010
    110375751146729101
    75172912201-1
    729223331-134
    22371-134-239
    313034-239751
    So our multiplicative inverse is -239 mod 751 ≡ 512
    Source: ExtendedEuclideanAlgorithm.com

    nbqr t1t2t3
    1256631330125010
    66313312553058101
    125815501-15
    85131-1516
    5312-1516-31
    321116-3147
    2120-3147-125
    So our multiplicative inverse is 47 mod 125 ≡ 47
    Source: ExtendedEuclideanAlgorithm.com

    nbqr t1t2t3
    883938750883010
    93875883106277101
    88327735201-3
    277525171-316
    521731-316-51
    17117016-51883
    So our multiplicative inverse is -51 mod 883 ≡ 832
    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
    =  (172 × 110375 × 512 +
       88 × 663133 × 47 +
       718 × 93875 × 832)   mod 82891625
    = 72971838 (mod 82891625)


    So our answer is 72971838 (mod 82891625).


Verification

So we found that x ≡ 72971838
If this is correct, then the following statements (i.e. the original equations) are true:
757x (mod 751) ≡ 281 (mod 751)
543x (mod 125) ≡ 159 (mod 125)
21x (mod 883) ≡ 950 (mod 883)

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