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
9837513801-13
758931-13118
8322-13118-249
3211118-249367
2120-249367-983
So our multiplicative inverse is 367 mod 983 ≡ 367
Source: ExtendedEuclideanAlgorithm.com

nbqr t1t2t3
9071560701-60
157211-60121
7170-60121-907
So our multiplicative inverse is 121 mod 907 ≡ 121
Source: ExtendedEuclideanAlgorithm.com

nbqr t1t2t3
899475142401-1
4754241511-12
42451816-12-17
5116332-1753
16351-1753-282
313053-282899
So our multiplicative inverse is -282 mod 899 ≡ 617
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 ≡ 611 × 75-1 (mod 983) ≡ 611 × 367 (mod 983) ≡ 113 (mod 983)
x ≡ 175 × 15-1 (mod 907) ≡ 175 × 121 (mod 907) ≡ 314 (mod 907)
x ≡ 140 × 475-1 (mod 899) ≡ 140 × 617 (mod 899) ≡ 76 (mod 899)


Now the actual calculation

  1. Find the common modulus M
    M = m1 × m2 × ... × mk = 983 × 907 × 899 = 801531319
  2. We calculate the numbers M1 to M3
    M1=M/m1=801531319/983=815393,   M2=M/m2=801531319/907=883717,   M3=M/m3=801531319/899=891581
  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
    9838153930983010
    815393983829486101
    98348621101-2
    486114421-289
    11251-289-447
    212089-447983
    So our multiplicative inverse is -447 mod 983 ≡ 536
    Source: ExtendedEuclideanAlgorithm.com

    nbqr t1t2t3
    9078837170907010
    883717907974299101
    90729931001-3
    299102991-388
    10911-388-91
    919088-91907
    So our multiplicative inverse is -91 mod 907 ≡ 816
    Source: ExtendedEuclideanAlgorithm.com

    nbqr t1t2t3
    8998915810899010
    891581899991672101
    899672122701-1
    67222722181-13
    22721819-13-4
    21892423-499
    9241-499-400
    212099-400899
    So our multiplicative inverse is -400 mod 899 ≡ 499
    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
    =  (113 × 815393 × 536 +
       314 × 883717 × 816 +
       76 × 891581 × 499)   mod 801531319
    = 237456542 (mod 801531319)


    So our answer is 237456542 (mod 801531319).


Verification

So we found that x ≡ 237456542
If this is correct, then the following statements (i.e. the original equations) are true:
75x (mod 983) ≡ 611 (mod 983)
15x (mod 907) ≡ 175 (mod 907)
475x (mod 899) ≡ 140 (mod 899)

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