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
6717250671010
725671154101
67154122301-12
5423281-1225
23827-1225-62
871125-6287
7170-6287-671
So our multiplicative inverse is 87 mod 671 ≡ 87
Source: ExtendedEuclideanAlgorithm.com

nbqr t1t2t3
3778070377010
807377253101
377537601-7
536851-757
6511-757-64
515057-64377
So our multiplicative inverse is -64 mod 377 ≡ 313
Source: ExtendedEuclideanAlgorithm.com

nbqr t1t2t3
925193415301-4
1931531401-45
15340333-45-19
4033175-1924
33745-1924-115
751224-115139
5221-115139-393
2120139-393925
So our multiplicative inverse is -393 mod 925 ≡ 532
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 ≡ 809 × 725-1 (mod 671) ≡ 809 × 87 (mod 671) ≡ 599 (mod 671)
x ≡ 459 × 807-1 (mod 377) ≡ 459 × 313 (mod 377) ≡ 30 (mod 377)
x ≡ 918 × 193-1 (mod 925) ≡ 918 × 532 (mod 925) ≡ 901 (mod 925)


Now the actual calculation

  1. Find the common modulus M
    M = m1 × m2 × ... × mk = 671 × 377 × 925 = 233994475
  2. We calculate the numbers M1 to M3
    M1=M/m1=233994475/671=348725,   M2=M/m2=233994475/377=620675,   M3=M/m3=233994475/925=252967
  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
    6713487250671010
    348725671519476101
    671476119501-1
    4761952861-13
    19586223-13-7
    86233173-724
    231716-724-31
    1762524-3186
    6511-3186-117
    515086-117671
    So our multiplicative inverse is -117 mod 671 ≡ 554
    Source: ExtendedEuclideanAlgorithm.com

    nbqr t1t2t3
    3776206750377010
    6206753771646133101
    377133211101-2
    1331111221-23
    1112251-23-17
    2212203-17377
    So our multiplicative inverse is -17 mod 377 ≡ 360
    Source: ExtendedEuclideanAlgorithm.com

    nbqr t1t2t3
    9252529670925010
    252967925273442101
    92544224101-2
    4424110321-221
    413219-221-23
    3293521-2390
    9514-2390-113
    541190-113203
    4140-113203-925
    So our multiplicative inverse is 203 mod 925 ≡ 203
    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
    =  (599 × 348725 × 554 +
       30 × 620675 × 360 +
       901 × 252967 × 203)   mod 233994475
    = 218687551 (mod 233994475)


    So our answer is 218687551 (mod 233994475).


Verification

So we found that x ≡ 218687551
If this is correct, then the following statements (i.e. the original equations) are true:
725x (mod 671) ≡ 809 (mod 671)
807x (mod 377) ≡ 459 (mod 377)
193x (mod 925) ≡ 918 (mod 925)

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