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
3476751201-5
6712571-526
12715-526-31
751226-3157
5221-3157-145
212057-145347
So our multiplicative inverse is -145 mod 347 ≡ 202
Source: ExtendedEuclideanAlgorithm.com

nbqr t1t2t3
751260223101-2
2602311291-23
23129728-23-23
2928113-2326
281280-2326-751
So our multiplicative inverse is 26 mod 751 ≡ 26
Source: ExtendedEuclideanAlgorithm.com

nbqr t1t2t3
43119025101-2
190513371-27
5137114-27-9
3714297-925
14915-925-34
951425-3459
5411-3459-93
414059-93431
So our multiplicative inverse is -93 mod 431 ≡ 338
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 ≡ 464 × 67-1 (mod 347) ≡ 464 × 202 (mod 347) ≡ 38 (mod 347)
x ≡ 948 × 260-1 (mod 751) ≡ 948 × 26 (mod 751) ≡ 616 (mod 751)
x ≡ 195 × 190-1 (mod 431) ≡ 195 × 338 (mod 431) ≡ 398 (mod 431)


Now the actual calculation

  1. Find the common modulus M
    M = m1 × m2 × ... × mk = 347 × 751 × 431 = 112317307
  2. We calculate the numbers M1 to M3
    M1=M/m1=112317307/347=323681,   M2=M/m2=112317307/751=149557,   M3=M/m3=112317307/431=260597
  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
    3473236810347010
    323681347932277101
    34727717001-1
    277703671-14
    706713-14-5
    6732214-5114
    3130-5114-347
    So our multiplicative inverse is 114 mod 347 ≡ 114
    Source: ExtendedEuclideanAlgorithm.com

    nbqr t1t2t3
    7511495570751010
    149557751199108101
    751108610301-6
    108103151-67
    1035203-67-146
    53127-146153
    3211-146153-299
    2120153-299751
    So our multiplicative inverse is -299 mod 751 ≡ 452
    Source: ExtendedEuclideanAlgorithm.com

    nbqr t1t2t3
    4312605970431010
    260597431604273101
    431273115801-1
    27315811151-12
    158115143-12-3
    115432292-38
    4329114-38-11
    2914218-1130
    141140-1130-431
    So our multiplicative inverse is 30 mod 431 ≡ 30
    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
    =  (38 × 323681 × 114 +
       616 × 149557 × 452 +
       398 × 260597 × 30)   mod 112317307
    = 105073026 (mod 112317307)


    So our answer is 105073026 (mod 112317307).


Verification

So we found that x ≡ 105073026
If this is correct, then the following statements (i.e. the original equations) are true:
67x (mod 347) ≡ 464 (mod 347)
260x (mod 751) ≡ 948 (mod 751)
190x (mod 431) ≡ 195 (mod 431)

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