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
5299070529010
9075291378101
529378115101-1
3781512761-13
15176175-13-4
7675113-47
751750-47-529
So our multiplicative inverse is 7 mod 529 ≡ 7
Source: ExtendedEuclideanAlgorithm.com

nbqr t1t2t3
3883129101-129
31301-129388
So our multiplicative inverse is -129 mod 388 ≡ 259
Source: ExtendedEuclideanAlgorithm.com

nbqr t1t2t3
2694690269010
4692691200101
26920016901-1
200692621-13
696217-13-4
627863-435
7611-435-39
616035-39269
So our multiplicative inverse is -39 mod 269 ≡ 230
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 ≡ 972 × 907-1 (mod 529) ≡ 972 × 7 (mod 529) ≡ 456 (mod 529)
x ≡ 33 × 3-1 (mod 388) ≡ 33 × 259 (mod 388) ≡ 11 (mod 388)
x ≡ 654 × 469-1 (mod 269) ≡ 654 × 230 (mod 269) ≡ 49 (mod 269)


Now the actual calculation

  1. Find the common modulus M
    M = m1 × m2 × ... × mk = 529 × 388 × 269 = 55212788
  2. We calculate the numbers M1 to M3
    M1=M/m1=55212788/529=104372,   M2=M/m2=55212788/388=142301,   M3=M/m3=55212788/269=205252
  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
    5291043720529010
    104372529197159101
    52915935201-3
    15952331-310
    523171-310-173
    313010-173529
    So our multiplicative inverse is -173 mod 529 ≡ 356
    Source: ExtendedEuclideanAlgorithm.com

    nbqr t1t2t3
    3881423010388010
    142301388366293101
    38829319501-1
    29395381-14
    958117-14-45
    87114-4549
    7170-4549-388
    So our multiplicative inverse is 49 mod 388 ≡ 49
    Source: ExtendedEuclideanAlgorithm.com

    nbqr t1t2t3
    2692052520269010
    2052522697635101
    269553401-53
    54111-5354
    4140-5354-269
    So our multiplicative inverse is 54 mod 269 ≡ 54
    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
    =  (456 × 104372 × 356 +
       11 × 142301 × 49 +
       49 × 205252 × 54)   mod 55212788
    = 5463439 (mod 55212788)


    So our answer is 5463439 (mod 55212788).


Verification

So we found that x ≡ 5463439
If this is correct, then the following statements (i.e. the original equations) are true:
907x (mod 529) ≡ 972 (mod 529)
3x (mod 388) ≡ 33 (mod 388)
469x (mod 269) ≡ 654 (mod 269)

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