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
743552119101-1
55219121701-13
191170121-13-4
17021823-435
212101-435-354
212035-354743
So our multiplicative inverse is -354 mod 743 ≡ 389
Source: ExtendedEuclideanAlgorithm.com

nbqr t1t2t3
4579348501-4
9385181-45
858105-45-54
85135-5459
5312-5459-113
321159-113172
2120-113172-457
So our multiplicative inverse is 172 mod 457 ≡ 172
Source: ExtendedEuclideanAlgorithm.com

nbqr t1t2t3
5176900517010
6905171173101
517173217101-2
173171121-23
1712851-23-257
21203-257517
So our multiplicative inverse is -257 mod 517 ≡ 260
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 ≡ 195 × 552-1 (mod 743) ≡ 195 × 389 (mod 743) ≡ 69 (mod 743)
x ≡ 848 × 93-1 (mod 457) ≡ 848 × 172 (mod 457) ≡ 73 (mod 457)
x ≡ 508 × 690-1 (mod 517) ≡ 508 × 260 (mod 517) ≡ 245 (mod 517)


Now the actual calculation

  1. Find the common modulus M
    M = m1 × m2 × ... × mk = 743 × 457 × 517 = 175547867
  2. We calculate the numbers M1 to M3
    M1=M/m1=175547867/743=236269,   M2=M/m2=175547867/457=384131,   M3=M/m3=175547867/517=339551
  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
    7432362690743010
    236269743317738101
    7437381501-1
    738514731-1148
    5312-1148-149
    3211148-149297
    2120-149297-743
    So our multiplicative inverse is 297 mod 743 ≡ 297
    Source: ExtendedEuclideanAlgorithm.com

    nbqr t1t2t3
    4573841310457010
    384131457840251101
    457251120601-1
    2512061451-12
    20645426-12-9
    45261192-911
    261917-911-20
    1972511-2051
    7512-2051-71
    522151-71193
    2120-71193-457
    So our multiplicative inverse is 193 mod 457 ≡ 193
    Source: ExtendedEuclideanAlgorithm.com

    nbqr t1t2t3
    5173395510517010
    339551517656399101
    517399111801-1
    3991183451-14
    11845228-14-9
    45281174-913
    2817111-913-22
    17111613-2235
    11615-2235-57
    651135-5792
    5150-5792-517
    So our multiplicative inverse is 92 mod 517 ≡ 92
    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
    =  (69 × 236269 × 297 +
       73 × 384131 × 193 +
       245 × 339551 × 92)   mod 175547867
    = 1479382 (mod 175547867)


    So our answer is 1479382 (mod 175547867).


Verification

So we found that x ≡ 1479382
If this is correct, then the following statements (i.e. the original equations) are true:
552x (mod 743) ≡ 195 (mod 743)
93x (mod 457) ≡ 848 (mod 457)
690x (mod 517) ≡ 508 (mod 517)

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