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
925588133701-1
58833712511-12
337251186-12-3
251862792-38
867917-38-11
7971128-11129
7231-11129-398
2120129-398925
So our multiplicative inverse is -398 mod 925 ≡ 527
Source: ExtendedEuclideanAlgorithm.com

nbqr t1t2t3
3765330376010
5333761157101
37615726201-2
157622331-25
6233129-25-7
3329145-712
29471-712-91
414012-91376
So our multiplicative inverse is -91 mod 376 ≡ 285
Source: ExtendedEuclideanAlgorithm.com

nbqr t1t2t3
9219950921010
995921174101
92174123301-12
7433281-1225
33841-1225-112
818025-112921
So our multiplicative inverse is -112 mod 921 ≡ 809
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 ≡ 543 × 588-1 (mod 925) ≡ 543 × 527 (mod 925) ≡ 336 (mod 925)
x ≡ 38 × 533-1 (mod 376) ≡ 38 × 285 (mod 376) ≡ 302 (mod 376)
x ≡ 766 × 995-1 (mod 921) ≡ 766 × 809 (mod 921) ≡ 782 (mod 921)


Now the actual calculation

  1. Find the common modulus M
    M = m1 × m2 × ... × mk = 925 × 376 × 921 = 320323800
  2. We calculate the numbers M1 to M3
    M1=M/m1=320323800/925=346296,   M2=M/m2=320323800/376=851925,   M3=M/m3=320323800/921=347800
  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
    9253462960925010
    346296925374346101
    925346223301-2
    34623311131-23
    23311327-23-8
    11371613-8131
    7170-8131-925
    So our multiplicative inverse is 131 mod 925 ≡ 131
    Source: ExtendedEuclideanAlgorithm.com

    nbqr t1t2t3
    3768519250376010
    8519253762265285101
    37628519101-1
    285913121-14
    911277-14-29
    127154-2933
    7512-2933-62
    522133-62157
    2120-62157-376
    So our multiplicative inverse is 157 mod 376 ≡ 157
    Source: ExtendedEuclideanAlgorithm.com

    nbqr t1t2t3
    9213478000921010
    347800921377583101
    921583133801-1
    58333812451-12
    338245193-12-3
    245932592-38
    9359134-38-11
    59341258-1119
    342519-1119-30
    2592719-3079
    9712-3079-109
    723179-109406
    2120-109406-921
    So our multiplicative inverse is 406 mod 921 ≡ 406
    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
    =  (336 × 346296 × 131 +
       302 × 851925 × 157 +
       782 × 347800 × 406)   mod 320323800
    = 131725886 (mod 320323800)


    So our answer is 131725886 (mod 320323800).


Verification

So we found that x ≡ 131725886
If this is correct, then the following statements (i.e. the original equations) are true:
588x (mod 925) ≡ 543 (mod 925)
533x (mod 376) ≡ 38 (mod 376)
995x (mod 921) ≡ 766 (mod 921)

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