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
92386316001-1
8636014231-115
6023214-115-31
23141915-3146
14915-3146-77
951446-77123
5411-77123-200
4140123-200923
So our multiplicative inverse is -200 mod 923 ≡ 723
Source: ExtendedEuclideanAlgorithm.com

nbqr t1t2t3
593363123001-1
36323011331-12
230133197-12-3
133971362-35
9736225-35-13
36251115-1318
251123-1318-49
1133218-49165
3211-49165-214
2120165-214593
So our multiplicative inverse is -214 mod 593 ≡ 379
Source: ExtendedEuclideanAlgorithm.com

nbqr t1t2t3
5437100543010
7105431167101
54316734201-3
167423411-310
424111-310-13
41141010-13543
So our multiplicative inverse is -13 mod 543 ≡ 530
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 ≡ 367 × 863-1 (mod 923) ≡ 367 × 723 (mod 923) ≡ 440 (mod 923)
x ≡ 655 × 363-1 (mod 593) ≡ 655 × 379 (mod 593) ≡ 371 (mod 593)
x ≡ 809 × 710-1 (mod 543) ≡ 809 × 530 (mod 543) ≡ 343 (mod 543)


Now the actual calculation

  1. Find the common modulus M
    M = m1 × m2 × ... × mk = 923 × 593 × 543 = 297205077
  2. We calculate the numbers M1 to M3
    M1=M/m1=297205077/923=321999,   M2=M/m2=297205077/593=501189,   M3=M/m3=297205077/543=547339
  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
    9233219990923010
    321999923348795101
    923795112801-1
    7951286271-17
    12827420-17-29
    2720177-2936
    20726-2936-101
    761136-101137
    6160-101137-923
    So our multiplicative inverse is 137 mod 923 ≡ 137
    Source: ExtendedEuclideanAlgorithm.com

    nbqr t1t2t3
    5935011890593010
    501189593845104101
    59310457301-5
    104731311-56
    7331211-56-17
    3111296-1740
    11912-1740-57
    924140-57268
    2120-57268-593
    So our multiplicative inverse is 268 mod 593 ≡ 268
    Source: ExtendedEuclideanAlgorithm.com

    nbqr t1t2t3
    5435473390543010
    5473395431007538101
    5435381501-1
    538510731-1108
    5312-1108-109
    3211108-109217
    2120-109217-543
    So our multiplicative inverse is 217 mod 543 ≡ 217
    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
    =  (440 × 321999 × 137 +
       371 × 501189 × 268 +
       343 × 547339 × 217)   mod 297205077
    = 15430231 (mod 297205077)


    So our answer is 15430231 (mod 297205077).


Verification

So we found that x ≡ 15430231
If this is correct, then the following statements (i.e. the original equations) are true:
863x (mod 923) ≡ 367 (mod 923)
363x (mod 593) ≡ 655 (mod 593)
710x (mod 543) ≡ 809 (mod 543)

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