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
605211218301-2
2111831281-23
18328615-23-20
28151133-2023
151312-2023-43
1326123-43281
2120-43281-605
So our multiplicative inverse is 281 mod 605 ≡ 281
Source: ExtendedEuclideanAlgorithm.com

nbqr t1t2t3
653394125901-1
39425911351-12
2591351124-12-3
1351241112-35
12411113-35-58
113325-58179
3211-58179-237
2120179-237653
So our multiplicative inverse is -237 mod 653 ≡ 416
Source: ExtendedEuclideanAlgorithm.com

nbqr t1t2t3
7618340761010
834761173101
76173103101-10
73312111-1021
311129-1021-52
1191221-5273
9241-5273-344
212073-344761
So our multiplicative inverse is -344 mod 761 ≡ 417
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 ≡ 409 × 211-1 (mod 605) ≡ 409 × 281 (mod 605) ≡ 584 (mod 605)
x ≡ 14 × 394-1 (mod 653) ≡ 14 × 416 (mod 653) ≡ 600 (mod 653)
x ≡ 798 × 834-1 (mod 761) ≡ 798 × 417 (mod 761) ≡ 209 (mod 761)


Now the actual calculation

  1. Find the common modulus M
    M = m1 × m2 × ... × mk = 605 × 653 × 761 = 300644465
  2. We calculate the numbers M1 to M3
    M1=M/m1=300644465/605=496933,   M2=M/m2=300644465/653=460405,   M3=M/m3=300644465/761=395065
  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
    6054969330605010
    496933605821228101
    605228214901-2
    2281491791-23
    14979170-23-5
    7970193-58
    70977-58-61
    97128-6169
    7231-6169-268
    212069-268605
    So our multiplicative inverse is -268 mod 605 ≡ 337
    Source: ExtendedEuclideanAlgorithm.com

    nbqr t1t2t3
    6534604050653010
    46040565370540101
    65340161301-16
    4013311-1649
    131130-1649-653
    So our multiplicative inverse is 49 mod 653 ≡ 49
    Source: ExtendedEuclideanAlgorithm.com

    nbqr t1t2t3
    7613950650761010
    395065761519106101
    76110671901-7
    106195111-736
    191118-736-43
    1181336-4379
    8322-4379-201
    321179-201280
    2120-201280-761
    So our multiplicative inverse is 280 mod 761 ≡ 280
    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
    =  (584 × 496933 × 337 +
       600 × 460405 × 49 +
       209 × 395065 × 280)   mod 300644465
    = 67424809 (mod 300644465)


    So our answer is 67424809 (mod 300644465).


Verification

So we found that x ≡ 67424809
If this is correct, then the following statements (i.e. the original equations) are true:
211x (mod 605) ≡ 409 (mod 605)
394x (mod 653) ≡ 14 (mod 653)
834x (mod 761) ≡ 798 (mod 761)

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