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
55748417301-1
484736461-17
7346127-17-8
46271197-815
271918-815-23
1982315-2361
8322-2361-145
321161-145206
2120-145206-557
So our multiplicative inverse is 206 mod 557 ≡ 206
Source: ExtendedEuclideanAlgorithm.com

nbqr t1t2t3
1696230169010
6231693116101
16911615301-1
116532101-13
531053-13-16
103313-1651
3130-1651-169
So our multiplicative inverse is 51 mod 169 ≡ 51
Source: ExtendedEuclideanAlgorithm.com

nbqr t1t2t3
592449114301-1
4491433201-14
1432073-14-29
203624-29178
3211-29178-207
2120178-207592
So our multiplicative inverse is -207 mod 592 ≡ 385
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 ≡ 399 × 484-1 (mod 557) ≡ 399 × 206 (mod 557) ≡ 315 (mod 557)
x ≡ 981 × 623-1 (mod 169) ≡ 981 × 51 (mod 169) ≡ 7 (mod 169)
x ≡ 338 × 449-1 (mod 592) ≡ 338 × 385 (mod 592) ≡ 482 (mod 592)


Now the actual calculation

  1. Find the common modulus M
    M = m1 × m2 × ... × mk = 557 × 169 × 592 = 55726736
  2. We calculate the numbers M1 to M3
    M1=M/m1=55726736/557=100048,   M2=M/m2=55726736/169=329744,   M3=M/m3=55726736/592=94133
  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
    5571000480557010
    100048557179345101
    557345121201-1
    34521211331-12
    212133179-12-3
    133791542-35
    7954125-35-8
    5425245-821
    25461-821-134
    414021-134557
    So our multiplicative inverse is -134 mod 557 ≡ 423
    Source: ExtendedEuclideanAlgorithm.com

    nbqr t1t2t3
    1693297440169010
    329744169195125101
    1692561901-6
    2519161-67
    19631-67-27
    61607-27169
    So our multiplicative inverse is -27 mod 169 ≡ 142
    Source: ExtendedEuclideanAlgorithm.com

    nbqr t1t2t3
    592941330592010
    941335921595101
    5925118201-118
    52211-118237
    2120-118237-592
    So our multiplicative inverse is 237 mod 592 ≡ 237
    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
    =  (315 × 100048 × 423 +
       7 × 329744 × 142 +
       482 × 94133 × 237)   mod 55726736
    = 3540050 (mod 55726736)


    So our answer is 3540050 (mod 55726736).


Verification

So we found that x ≡ 3540050
If this is correct, then the following statements (i.e. the original equations) are true:
484x (mod 557) ≡ 399 (mod 557)
623x (mod 169) ≡ 981 (mod 169)
449x (mod 592) ≡ 338 (mod 592)

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