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
731492123901-1
4922392141-13
23914171-13-52
1411403-52731
So our multiplicative inverse is -52 mod 731 ≡ 679
Source: ExtendedEuclideanAlgorithm.com

nbqr t1t2t3
5892932301-2
29339721-2195
3211-2195-197
2120195-197589
So our multiplicative inverse is -197 mod 589 ≡ 392
Source: ExtendedEuclideanAlgorithm.com

nbqr t1t2t3
1733100173010
3101731137101
17313713601-1
137363291-14
362917-14-5
297414-524
7170-524-173
So our multiplicative inverse is 24 mod 173 ≡ 24
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 ≡ 270 × 492-1 (mod 731) ≡ 270 × 679 (mod 731) ≡ 580 (mod 731)
x ≡ 702 × 293-1 (mod 589) ≡ 702 × 392 (mod 589) ≡ 121 (mod 589)
x ≡ 751 × 310-1 (mod 173) ≡ 751 × 24 (mod 173) ≡ 32 (mod 173)


Now the actual calculation

  1. Find the common modulus M
    M = m1 × m2 × ... × mk = 731 × 589 × 173 = 74486707
  2. We calculate the numbers M1 to M3
    M1=M/m1=74486707/731=101897,   M2=M/m2=74486707/589=126463,   M3=M/m3=74486707/173=430559
  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
    7311018970731010
    101897731139288101
    731288215501-2
    28815511331-23
    155133122-23-5
    13322613-533
    221220-533-731
    So our multiplicative inverse is 33 mod 731 ≡ 33
    Source: ExtendedEuclideanAlgorithm.com

    nbqr t1t2t3
    5891264630589010
    126463589214417101
    589417117201-1
    4171722731-13
    17273226-13-7
    73262213-717
    262115-717-24
    2154117-24113
    5150-24113-589
    So our multiplicative inverse is 113 mod 589 ≡ 113
    Source: ExtendedEuclideanAlgorithm.com

    nbqr t1t2t3
    1734305590173010
    4305591732488135101
    17313513801-1
    135383211-14
    3821117-14-5
    2117144-59
    17441-59-41
    41409-41173
    So our multiplicative inverse is -41 mod 173 ≡ 132
    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
    =  (580 × 101897 × 33 +
       121 × 126463 × 113 +
       32 × 430559 × 132)   mod 74486707
    = 60588784 (mod 74486707)


    So our answer is 60588784 (mod 74486707).


Verification

So we found that x ≡ 60588784
If this is correct, then the following statements (i.e. the original equations) are true:
492x (mod 731) ≡ 270 (mod 731)
293x (mod 589) ≡ 702 (mod 589)
310x (mod 173) ≡ 751 (mod 173)

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