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
73971712201-1
7172232131-133
221319-133-34
1391433-3467
9421-3467-168
414067-168739
So our multiplicative inverse is -168 mod 739 ≡ 571
Source: ExtendedEuclideanAlgorithm.com

nbqr t1t2t3
929786114301-1
7861435711-16
1437121-16-13
7117106-13929
So our multiplicative inverse is -13 mod 929 ≡ 916
Source: ExtendedEuclideanAlgorithm.com

nbqr t1t2t3
46942314601-1
42346991-110
46951-110-51
919010-51469
So our multiplicative inverse is -51 mod 469 ≡ 418
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 ≡ 572 × 717-1 (mod 739) ≡ 572 × 571 (mod 739) ≡ 713 (mod 739)
x ≡ 949 × 786-1 (mod 929) ≡ 949 × 916 (mod 929) ≡ 669 (mod 929)
x ≡ 570 × 423-1 (mod 469) ≡ 570 × 418 (mod 469) ≡ 8 (mod 469)


Now the actual calculation

  1. Find the common modulus M
    M = m1 × m2 × ... × mk = 739 × 929 × 469 = 321983039
  2. We calculate the numbers M1 to M3
    M1=M/m1=321983039/739=435701,   M2=M/m2=321983039/929=346591,   M3=M/m3=321983039/469=686531
  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
    7394357010739010
    435701739589430101
    739430130901-1
    43030911211-12
    309121267-12-5
    121671542-57
    6754113-57-12
    5413427-1255
    13261-1255-342
    212055-342739
    So our multiplicative inverse is -342 mod 739 ≡ 397
    Source: ExtendedEuclideanAlgorithm.com

    nbqr t1t2t3
    9293465910929010
    34659192937374101
    92974124101-12
    74411331-1213
    413318-1213-25
    3384113-25113
    8180-25113-929
    So our multiplicative inverse is 113 mod 929 ≡ 113
    Source: ExtendedEuclideanAlgorithm.com

    nbqr t1t2t3
    4696865310469010
    6865314691463384101
    46938418501-1
    384854441-15
    8544141-15-6
    4441135-611
    413132-611-149
    321111-149160
    2120-149160-469
    So our multiplicative inverse is 160 mod 469 ≡ 160
    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
    =  (713 × 435701 × 397 +
       669 × 346591 × 113 +
       8 × 686531 × 160)   mod 321983039
    = 43881055 (mod 321983039)


    So our answer is 43881055 (mod 321983039).


Verification

So we found that x ≡ 43881055
If this is correct, then the following statements (i.e. the original equations) are true:
717x (mod 739) ≡ 572 (mod 739)
786x (mod 929) ≡ 949 (mod 929)
423x (mod 469) ≡ 570 (mod 469)

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