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
467181210501-2
1811051761-23
10576129-23-5
76292183-513
2918111-513-18
18111713-1831
11714-1831-49
741331-4980
4311-4980-129
313080-129467
So our multiplicative inverse is -129 mod 467 ≡ 338
Source: ExtendedEuclideanAlgorithm.com

nbqr t1t2t3
64805064010
805641237101
643712701-1
37271101-12
271027-12-5
107132-57
7321-57-19
31307-1964
So our multiplicative inverse is -19 mod 64 ≡ 45
Source: ExtendedEuclideanAlgorithm.com

nbqr t1t2t3
947653129401-1
6532942651-13
29465434-13-13
65341313-1316
343113-1316-29
31310116-29306
3130-29306-947
So our multiplicative inverse is 306 mod 947 ≡ 306
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 ≡ 428 × 181-1 (mod 467) ≡ 428 × 338 (mod 467) ≡ 361 (mod 467)
x ≡ 422 × 805-1 (mod 64) ≡ 422 × 45 (mod 64) ≡ 46 (mod 64)
x ≡ 476 × 653-1 (mod 947) ≡ 476 × 306 (mod 947) ≡ 765 (mod 947)


Now the actual calculation

  1. Find the common modulus M
    M = m1 × m2 × ... × mk = 467 × 64 × 947 = 28303936
  2. We calculate the numbers M1 to M3
    M1=M/m1=28303936/467=60608,   M2=M/m2=28303936/64=442249,   M3=M/m3=28303936/947=29888
  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
    467606080467010
    60608467129365101
    467365110201-1
    3651023591-14
    10259143-14-5
    59431164-59
    4316211-59-23
    1611159-2332
    11521-2332-87
    515032-87467
    So our multiplicative inverse is -87 mod 467 ≡ 380
    Source: ExtendedEuclideanAlgorithm.com

    nbqr t1t2t3
    64442249064010
    4422496469109101
    6497101-7
    91901-764
    So our multiplicative inverse is -7 mod 64 ≡ 57
    Source: ExtendedEuclideanAlgorithm.com

    nbqr t1t2t3
    947298880947010
    2988894731531101
    947531141601-1
    53141611151-12
    416115371-12-7
    115711442-79
    7144127-79-16
    44271179-1625
    2717110-1625-41
    17101725-4166
    10713-4166-107
    732166-107280
    3130-107280-947
    So our multiplicative inverse is 280 mod 947 ≡ 280
    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
    =  (361 × 60608 × 380 +
       46 × 442249 × 57 +
       765 × 29888 × 280)   mod 28303936
    = 25587758 (mod 28303936)


    So our answer is 25587758 (mod 28303936).


Verification

So we found that x ≡ 25587758
If this is correct, then the following statements (i.e. the original equations) are true:
181x (mod 467) ≡ 428 (mod 467)
805x (mod 64) ≡ 422 (mod 64)
653x (mod 947) ≡ 476 (mod 947)

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