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
7199220719010
9227191203101
719203311001-3
2031101931-34
11093117-34-7
9317584-739
17821-739-85
818039-85719
So our multiplicative inverse is -85 mod 719 ≡ 634
Source: ExtendedEuclideanAlgorithm.com

nbqr t1t2t3
34928316601-1
283664191-15
661939-15-16
199215-1637
9190-1637-349
So our multiplicative inverse is 37 mod 349 ≡ 37
Source: ExtendedEuclideanAlgorithm.com

nbqr t1t2t3
547147310601-3
1471061411-34
10641224-34-11
41241174-1115
241717-1115-26
1772315-2667
7321-2667-160
313067-160547
So our multiplicative inverse is -160 mod 547 ≡ 387
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 ≡ 401 × 922-1 (mod 719) ≡ 401 × 634 (mod 719) ≡ 427 (mod 719)
x ≡ 261 × 283-1 (mod 349) ≡ 261 × 37 (mod 349) ≡ 234 (mod 349)
x ≡ 442 × 147-1 (mod 547) ≡ 442 × 387 (mod 547) ≡ 390 (mod 547)


Now the actual calculation

  1. Find the common modulus M
    M = m1 × m2 × ... × mk = 719 × 349 × 547 = 137259257
  2. We calculate the numbers M1 to M3
    M1=M/m1=137259257/719=190903,   M2=M/m2=137259257/349=393293,   M3=M/m3=137259257/547=250931
  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
    7191909030719010
    190903719265368101
    719368135101-1
    3683511171-12
    351172011-12-41
    1711162-4143
    11615-4143-84
    651143-84127
    5150-84127-719
    So our multiplicative inverse is 127 mod 719 ≡ 127
    Source: ExtendedEuclideanAlgorithm.com

    nbqr t1t2t3
    3493932930349010
    3932933491126319101
    34931913001-1
    3193010191-111
    3019111-111-12
    19111811-1223
    11813-1223-35
    832223-3593
    3211-3593-128
    212093-128349
    So our multiplicative inverse is -128 mod 349 ≡ 221
    Source: ExtendedEuclideanAlgorithm.com

    nbqr t1t2t3
    5472509310547010
    250931547458405101
    547405114201-1
    40514221211-13
    142121121-13-4
    121215163-423
    211615-423-27
    1653123-27104
    5150-27104-547
    So our multiplicative inverse is 104 mod 547 ≡ 104
    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
    =  (427 × 190903 × 127 +
       234 × 393293 × 221 +
       390 × 250931 × 104)   mod 137259257
    = 102995020 (mod 137259257)


    So our answer is 102995020 (mod 137259257).


Verification

So we found that x ≡ 102995020
If this is correct, then the following statements (i.e. the original equations) are true:
922x (mod 719) ≡ 401 (mod 719)
283x (mod 349) ≡ 261 (mod 349)
147x (mod 547) ≡ 442 (mod 547)

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