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
89316954801-5
169483251-516
4825123-516-21
25231216-2137
232111-2137-428
212037-428893
So our multiplicative inverse is -428 mod 893 ≡ 465
Source: ExtendedEuclideanAlgorithm.com

nbqr t1t2t3
37381037010
381371011101
37113401-3
114231-37
4311-37-10
31307-1037
So our multiplicative inverse is -10 mod 37 ≡ 27
Source: ExtendedEuclideanAlgorithm.com

nbqr t1t2t3
6838920683010
8926831209101
68320935601-3
209563411-310
5641115-310-13
411521110-1336
151114-1336-49
1142336-49134
4311-49134-183
3130134-183683
So our multiplicative inverse is -183 mod 683 ≡ 500
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 ≡ 141 × 169-1 (mod 893) ≡ 141 × 465 (mod 893) ≡ 376 (mod 893)
x ≡ 533 × 381-1 (mod 37) ≡ 533 × 27 (mod 37) ≡ 35 (mod 37)
x ≡ 892 × 892-1 (mod 683) ≡ 892 × 500 (mod 683) ≡ 1 (mod 683)


Now the actual calculation

  1. Find the common modulus M
    M = m1 × m2 × ... × mk = 893 × 37 × 683 = 22567003
  2. We calculate the numbers M1 to M3
    M1=M/m1=22567003/893=25271,   M2=M/m2=22567003/37=609919,   M3=M/m3=22567003/683=33041
  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
    893252710893010
    2527189328267101
    89326739201-3
    267922831-37
    928319-37-10
    839927-1097
    9241-1097-398
    212097-398893
    So our multiplicative inverse is -398 mod 893 ≡ 495
    Source: ExtendedEuclideanAlgorithm.com

    nbqr t1t2t3
    37609919037010
    609919371648411101
    37113401-3
    114231-37
    4311-37-10
    31307-1037
    So our multiplicative inverse is -10 mod 37 ≡ 27
    Source: ExtendedEuclideanAlgorithm.com

    nbqr t1t2t3
    683330410683010
    3304168348257101
    683257216901-2
    2571691881-23
    16988181-23-5
    8881173-58
    817114-58-93
    74138-93101
    4311-93101-194
    3130101-194683
    So our multiplicative inverse is -194 mod 683 ≡ 489
    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
    =  (376 × 25271 × 495 +
       35 × 609919 × 27 +
       1 × 33041 × 489)   mod 22567003
    = 15290322 (mod 22567003)


    So our answer is 15290322 (mod 22567003).


Verification

So we found that x ≡ 15290322
If this is correct, then the following statements (i.e. the original equations) are true:
169x (mod 893) ≡ 141 (mod 893)
381x (mod 37) ≡ 533 (mod 37)
892x (mod 683) ≡ 892 (mod 683)

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