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
5757030575010
7035751128101
57512846301-4
12863221-49
632311-49-283
21209-283575
So our multiplicative inverse is -283 mod 575 ≡ 292
Source: ExtendedEuclideanAlgorithm.com

nbqr t1t2t3
2896190289010
619289241101
289417201-7
4122011-7141
2120-7141-289
So our multiplicative inverse is 141 mod 289 ≡ 141
Source: ExtendedEuclideanAlgorithm.com

nbqr t1t2t3
3175010317010
5013171184101
317184113301-1
1841331511-12
13351231-12-5
51311202-57
3120111-57-12
2011197-1219
11912-1219-31
924119-31143
2120-31143-317
So our multiplicative inverse is 143 mod 317 ≡ 143
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 ≡ 374 × 703-1 (mod 575) ≡ 374 × 292 (mod 575) ≡ 533 (mod 575)
x ≡ 62 × 619-1 (mod 289) ≡ 62 × 141 (mod 289) ≡ 72 (mod 289)
x ≡ 38 × 501-1 (mod 317) ≡ 38 × 143 (mod 317) ≡ 45 (mod 317)


Now the actual calculation

  1. Find the common modulus M
    M = m1 × m2 × ... × mk = 575 × 289 × 317 = 52677475
  2. We calculate the numbers M1 to M3
    M1=M/m1=52677475/575=91613,   M2=M/m2=52677475/289=182275,   M3=M/m3=52677475/317=166175
  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
    575916130575010
    91613575159188101
    57518831101-3
    188111711-352
    111110-352-575
    So our multiplicative inverse is 52 mod 575 ≡ 52
    Source: ExtendedEuclideanAlgorithm.com

    nbqr t1t2t3
    2891822750289010
    182275289630205101
    28920518401-1
    205842371-13
    8437210-13-7
    3710373-724
    10713-724-31
    732124-3186
    3130-3186-289
    So our multiplicative inverse is 86 mod 289 ≡ 86
    Source: ExtendedEuclideanAlgorithm.com

    nbqr t1t2t3
    3171661750317010
    16617531752467101
    3176744901-4
    67491181-45
    4918213-45-14
    1813155-1419
    13523-1419-52
    531219-5271
    3211-5271-123
    212071-123317
    So our multiplicative inverse is -123 mod 317 ≡ 194
    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
    =  (533 × 91613 × 52 +
       72 × 182275 × 86 +
       45 × 166175 × 194)   mod 52677475
    = 8785383 (mod 52677475)


    So our answer is 8785383 (mod 52677475).


Verification

So we found that x ≡ 8785383
If this is correct, then the following statements (i.e. the original equations) are true:
703x (mod 575) ≡ 374 (mod 575)
619x (mod 289) ≡ 62 (mod 289)
501x (mod 317) ≡ 38 (mod 317)

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