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
44939815101-1
398517411-18
5141110-18-9
4110418-944
101100-944-449
So our multiplicative inverse is 44 mod 449 ≡ 44
Source: ExtendedEuclideanAlgorithm.com

nbqr t1t2t3
9239398601-9
9386171-910
867122-910-129
723110-129397
2120-129397-923
So our multiplicative inverse is 397 mod 923 ≡ 397
Source: ExtendedEuclideanAlgorithm.com

nbqr t1t2t3
1939520193010
9521934180101
19318011301-1
1801313111-114
131112-114-15
1125114-1589
2120-1589-193
So our multiplicative inverse is 89 mod 193 ≡ 89
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 ≡ 962 × 398-1 (mod 449) ≡ 962 × 44 (mod 449) ≡ 122 (mod 449)
x ≡ 419 × 93-1 (mod 923) ≡ 419 × 397 (mod 923) ≡ 203 (mod 923)
x ≡ 406 × 952-1 (mod 193) ≡ 406 × 89 (mod 193) ≡ 43 (mod 193)


Now the actual calculation

  1. Find the common modulus M
    M = m1 × m2 × ... × mk = 449 × 923 × 193 = 79984411
  2. We calculate the numbers M1 to M3
    M1=M/m1=79984411/449=178139,   M2=M/m2=79984411/923=86657,   M3=M/m3=79984411/193=414427
  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
    4491781390449010
    178139449396335101
    449335111401-1
    33511421071-13
    11410717-13-4
    10771523-463
    7231-463-193
    212063-193449
    So our multiplicative inverse is -193 mod 449 ≡ 256
    Source: ExtendedEuclideanAlgorithm.com

    nbqr t1t2t3
    923866570923010
    8665792393818101
    923818110501-1
    8181057831-18
    10583122-18-9
    83223178-935
    221715-935-44
    1753235-44167
    5221-44167-378
    2120167-378923
    So our multiplicative inverse is -378 mod 923 ≡ 545
    Source: ExtendedEuclideanAlgorithm.com

    nbqr t1t2t3
    1934144270193010
    414427193214756101
    1935632501-3
    5625261-37
    25641-37-31
    61607-31193
    So our multiplicative inverse is -31 mod 193 ≡ 162
    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
    =  (122 × 178139 × 256 +
       203 × 86657 × 545 +
       43 × 414427 × 162)   mod 79984411
    = 41340450 (mod 79984411)


    So our answer is 41340450 (mod 79984411).


Verification

So we found that x ≡ 41340450
If this is correct, then the following statements (i.e. the original equations) are true:
398x (mod 449) ≡ 962 (mod 449)
93x (mod 923) ≡ 419 (mod 923)
952x (mod 193) ≡ 406 (mod 193)

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