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
67222067010
22267321101
67213401-3
214511-316
4140-316-67
So our multiplicative inverse is 16 mod 67 ≡ 16
Source: ExtendedEuclideanAlgorithm.com

nbqr t1t2t3
481368111301-1
3681133291-14
11329326-14-13
2926134-1317
26382-1317-149
321117-149166
2120-149166-481
So our multiplicative inverse is 166 mod 481 ≡ 166
Source: ExtendedEuclideanAlgorithm.com

nbqr t1t2t3
4278847501-4
88751131-45
7513510-45-29
1310135-2934
10331-2934-131
313034-131427
So our multiplicative inverse is -131 mod 427 ≡ 296
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 ≡ 835 × 222-1 (mod 67) ≡ 835 × 16 (mod 67) ≡ 27 (mod 67)
x ≡ 557 × 368-1 (mod 481) ≡ 557 × 166 (mod 481) ≡ 110 (mod 481)
x ≡ 520 × 88-1 (mod 427) ≡ 520 × 296 (mod 427) ≡ 200 (mod 427)


Now the actual calculation

  1. Find the common modulus M
    M = m1 × m2 × ... × mk = 67 × 481 × 427 = 13760929
  2. We calculate the numbers M1 to M3
    M1=M/m1=13760929/67=205387,   M2=M/m2=13760929/481=28609,   M3=M/m3=13760929/427=32227
  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
    67205387067010
    20538767306532101
    67322301-2
    3231021-221
    3211-221-23
    212021-2367
    So our multiplicative inverse is -23 mod 67 ≡ 44
    Source: ExtendedEuclideanAlgorithm.com

    nbqr t1t2t3
    481286090481010
    2860948159230101
    48123022101-2
    2302110201-221
    212011-221-23
    20120021-23481
    So our multiplicative inverse is -23 mod 481 ≡ 458
    Source: ExtendedEuclideanAlgorithm.com

    nbqr t1t2t3
    427322270427010
    3222742775202101
    42720222301-2
    202238181-217
    231815-217-19
    1853317-1974
    5312-1974-93
    321174-93167
    2120-93167-427
    So our multiplicative inverse is 167 mod 427 ≡ 167
    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
    =  (27 × 205387 × 44 +
       110 × 28609 × 458 +
       200 × 32227 × 167)   mod 13760929
    = 9517176 (mod 13760929)


    So our answer is 9517176 (mod 13760929).


Verification

So we found that x ≡ 9517176
If this is correct, then the following statements (i.e. the original equations) are true:
222x (mod 67) ≡ 835 (mod 67)
368x (mod 481) ≡ 557 (mod 481)
88x (mod 427) ≡ 520 (mod 427)

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