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
2878150287010
8152872241101
28724114601-1
241465111-16
461142-16-25
112516-25131
2120-25131-287
So our multiplicative inverse is 131 mod 287 ≡ 131
Source: ExtendedEuclideanAlgorithm.com

nbqr t1t2t3
2898134601-3
81461351-34
4635111-34-7
3511324-725
11251-725-132
212025-132289
So our multiplicative inverse is -132 mod 289 ≡ 157
Source: ExtendedEuclideanAlgorithm.com

nbqr t1t2t3
92313092010
31392337101
923721801-2
3718211-25
181180-25-92
So our multiplicative inverse is 5 mod 92 ≡ 5
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 ≡ 959 × 815-1 (mod 287) ≡ 959 × 131 (mod 287) ≡ 210 (mod 287)
x ≡ 560 × 81-1 (mod 289) ≡ 560 × 157 (mod 289) ≡ 64 (mod 289)
x ≡ 566 × 313-1 (mod 92) ≡ 566 × 5 (mod 92) ≡ 70 (mod 92)


Now the actual calculation

  1. Find the common modulus M
    M = m1 × m2 × ... × mk = 287 × 289 × 92 = 7630756
  2. We calculate the numbers M1 to M3
    M1=M/m1=7630756/287=26588,   M2=M/m2=7630756/289=26404,   M3=M/m3=7630756/92=82943
  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
    287265880287010
    2658828792184101
    287184110301-1
    1841031811-12
    10381122-12-3
    81223152-311
    221517-311-14
    1572111-1439
    7170-1439-287
    So our multiplicative inverse is 39 mod 287 ≡ 39
    Source: ExtendedEuclideanAlgorithm.com

    nbqr t1t2t3
    289264040289010
    2640428991105101
    28910527901-2
    105791261-23
    792631-23-11
    2612603-11289
    So our multiplicative inverse is -11 mod 289 ≡ 278
    Source: ExtendedEuclideanAlgorithm.com

    nbqr t1t2t3
    9282943092010
    829439290151101
    925114101-1
    51411101-12
    411041-12-9
    1011002-992
    So our multiplicative inverse is -9 mod 92 ≡ 83
    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
    =  (210 × 26588 × 39 +
       64 × 26404 × 278 +
       70 × 82943 × 83)   mod 7630756
    = 1928850 (mod 7630756)


    So our answer is 1928850 (mod 7630756).


Verification

So we found that x ≡ 1928850
If this is correct, then the following statements (i.e. the original equations) are true:
815x (mod 287) ≡ 959 (mod 287)
81x (mod 289) ≡ 560 (mod 289)
313x (mod 92) ≡ 566 (mod 92)

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