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
741571117001-1
5711703611-14
17061248-14-9
61481134-913
481339-913-48
1391413-4861
9421-4861-170
414061-170741
So our multiplicative inverse is -170 mod 741 ≡ 571
Source: ExtendedEuclideanAlgorithm.com

nbqr t1t2t3
943511143201-1
5114321791-12
43279537-12-11
7937252-1124
37572-1124-179
522124-179382
2120-179382-943
So our multiplicative inverse is 382 mod 943 ≡ 382
Source: ExtendedEuclideanAlgorithm.com

nbqr t1t2t3
7439720743010
9727431229101
74322935601-3
22956451-313
565111-313-146
515013-146743
So our multiplicative inverse is -146 mod 743 ≡ 597
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 ≡ 664 × 571-1 (mod 741) ≡ 664 × 571 (mod 741) ≡ 493 (mod 741)
x ≡ 663 × 511-1 (mod 943) ≡ 663 × 382 (mod 943) ≡ 542 (mod 943)
x ≡ 117 × 972-1 (mod 743) ≡ 117 × 597 (mod 743) ≡ 7 (mod 743)


Now the actual calculation

  1. Find the common modulus M
    M = m1 × m2 × ... × mk = 741 × 943 × 743 = 519180909
  2. We calculate the numbers M1 to M3
    M1=M/m1=519180909/741=700649,   M2=M/m2=519180909/943=550563,   M3=M/m3=519180909/743=698763
  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
    7417006490741010
    700649741945404101
    741404133701-1
    4043371671-12
    3376752-12-11
    6723312-11365
    2120-11365-741
    So our multiplicative inverse is 365 mod 741 ≡ 365
    Source: ExtendedEuclideanAlgorithm.com

    nbqr t1t2t3
    9435505630943010
    550563943583794101
    943794114901-1
    7941495491-16
    1494932-16-19
    4922416-19462
    2120-19462-943
    So our multiplicative inverse is 462 mod 943 ≡ 462
    Source: ExtendedEuclideanAlgorithm.com

    nbqr t1t2t3
    7436987630743010
    698763743940343101
    74334325701-2
    34357611-213
    571570-213-743
    So our multiplicative inverse is 13 mod 743 ≡ 13
    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
    =  (493 × 700649 × 365 +
       542 × 550563 × 462 +
       7 × 698763 × 13)   mod 519180909
    = 261147418 (mod 519180909)


    So our answer is 261147418 (mod 519180909).


Verification

So we found that x ≡ 261147418
If this is correct, then the following statements (i.e. the original equations) are true:
571x (mod 741) ≡ 664 (mod 741)
511x (mod 943) ≡ 663 (mod 943)
972x (mod 743) ≡ 117 (mod 743)

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