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
833554127901-1
55427912751-12
27927514-12-3
27546832-3206
4311-3206-209
3130206-209833
So our multiplicative inverse is -209 mod 833 ≡ 624
Source: ExtendedEuclideanAlgorithm.com

nbqr t1t2t3
607358124901-1
35824911091-12
249109231-12-5
109313162-517
3116115-517-22
16151117-2239
151150-2239-607
So our multiplicative inverse is 39 mod 607 ≡ 39
Source: ExtendedEuclideanAlgorithm.com

nbqr t1t2t3
4798050479010
8054791326101
479326115301-1
3261532201-13
15320713-13-22
2013173-2225
13716-2225-47
761125-4772
6160-4772-479
So our multiplicative inverse is 72 mod 479 ≡ 72
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 ≡ 445 × 554-1 (mod 833) ≡ 445 × 624 (mod 833) ≡ 291 (mod 833)
x ≡ 54 × 358-1 (mod 607) ≡ 54 × 39 (mod 607) ≡ 285 (mod 607)
x ≡ 910 × 805-1 (mod 479) ≡ 910 × 72 (mod 479) ≡ 376 (mod 479)


Now the actual calculation

  1. Find the common modulus M
    M = m1 × m2 × ... × mk = 833 × 607 × 479 = 242197249
  2. We calculate the numbers M1 to M3
    M1=M/m1=242197249/833=290753,   M2=M/m2=242197249/607=399007,   M3=M/m3=242197249/479=505631
  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
    8332907530833010
    29075383334936101
    8333623501-23
    365711-23162
    5150-23162-833
    So our multiplicative inverse is 162 mod 833 ≡ 162
    Source: ExtendedEuclideanAlgorithm.com

    nbqr t1t2t3
    6073990070607010
    399007607657208101
    607208219101-2
    2081911171-23
    19117114-23-35
    174413-35143
    4140-35143-607
    So our multiplicative inverse is 143 mod 607 ≡ 143
    Source: ExtendedEuclideanAlgorithm.com

    nbqr t1t2t3
    4795056310479010
    5056314791055286101
    479286119301-1
    2861931931-12
    1939327-12-5
    9371322-567
    7231-567-206
    212067-206479
    So our multiplicative inverse is -206 mod 479 ≡ 273
    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
    =  (291 × 290753 × 162 +
       285 × 399007 × 143 +
       376 × 505631 × 273)   mod 242197249
    = 7548937 (mod 242197249)


    So our answer is 7548937 (mod 242197249).


Verification

So we found that x ≡ 7548937
If this is correct, then the following statements (i.e. the original equations) are true:
554x (mod 833) ≡ 445 (mod 833)
358x (mod 607) ≡ 54 (mod 607)
805x (mod 479) ≡ 910 (mod 479)

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