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
709548116101-1
5481613651-14
16165231-14-9
6531234-922
313101-922-229
313022-229709
So our multiplicative inverse is -229 mod 709 ≡ 480
Source: ExtendedEuclideanAlgorithm.com

nbqr t1t2t3
859666119301-1
6661933871-14
19387219-14-9
87194114-940
191118-940-49
1181340-4989
8322-4989-227
321189-227316
2120-227316-859
So our multiplicative inverse is 316 mod 859 ≡ 316
Source: ExtendedEuclideanAlgorithm.com

nbqr t1t2t3
467362110501-1
3621053471-14
10547211-14-9
4711434-940
11332-940-129
321140-129169
2120-129169-467
So our multiplicative inverse is 169 mod 467 ≡ 169
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 ≡ 836 × 548-1 (mod 709) ≡ 836 × 480 (mod 709) ≡ 695 (mod 709)
x ≡ 289 × 666-1 (mod 859) ≡ 289 × 316 (mod 859) ≡ 270 (mod 859)
x ≡ 649 × 362-1 (mod 467) ≡ 649 × 169 (mod 467) ≡ 403 (mod 467)


Now the actual calculation

  1. Find the common modulus M
    M = m1 × m2 × ... × mk = 709 × 859 × 467 = 284417477
  2. We calculate the numbers M1 to M3
    M1=M/m1=284417477/709=401153,   M2=M/m2=284417477/859=331103,   M3=M/m3=284417477/467=609031
  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
    7094011530709010
    401153709565568101
    709568114101-1
    568141441-15
    1414351-15-176
    41405-176709
    So our multiplicative inverse is -176 mod 709 ≡ 533
    Source: ExtendedEuclideanAlgorithm.com

    nbqr t1t2t3
    8593311030859010
    331103859385388101
    85938828301-2
    388834561-29
    8356127-29-11
    5627229-1131
    272131-1131-414
    212031-414859
    So our multiplicative inverse is -414 mod 859 ≡ 445
    Source: ExtendedEuclideanAlgorithm.com

    nbqr t1t2t3
    4676090310467010
    609031467130463101
    4676372601-7
    63262111-715
    261124-715-37
    1142315-3789
    4311-3789-126
    313089-126467
    So our multiplicative inverse is -126 mod 467 ≡ 341
    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
    =  (695 × 401153 × 533 +
       270 × 331103 × 445 +
       403 × 609031 × 341)   mod 284417477
    = 174896106 (mod 284417477)


    So our answer is 174896106 (mod 284417477).


Verification

So we found that x ≡ 174896106
If this is correct, then the following statements (i.e. the original equations) are true:
548x (mod 709) ≡ 836 (mod 709)
666x (mod 859) ≡ 289 (mod 859)
362x (mod 467) ≡ 649 (mod 467)

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