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
56318231701-3
1821710121-331
171215-331-34
1252231-3499
5221-3499-232
212099-232563
So our multiplicative inverse is -232 mod 563 ≡ 331
Source: ExtendedEuclideanAlgorithm.com

nbqr t1t2t3
2115650211010
5652112143101
21114316801-1
14368271-13
68795-13-28
75123-2831
5221-2831-90
212031-90211
So our multiplicative inverse is -90 mod 211 ≡ 121
Source: ExtendedEuclideanAlgorithm.com

nbqr t1t2t3
7438080743010
808743165101
74365112801-11
6528291-1123
28931-1123-80
919023-80743
So our multiplicative inverse is -80 mod 743 ≡ 663
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 ≡ 603 × 182-1 (mod 563) ≡ 603 × 331 (mod 563) ≡ 291 (mod 563)
x ≡ 342 × 565-1 (mod 211) ≡ 342 × 121 (mod 211) ≡ 26 (mod 211)
x ≡ 234 × 808-1 (mod 743) ≡ 234 × 663 (mod 743) ≡ 598 (mod 743)


Now the actual calculation

  1. Find the common modulus M
    M = m1 × m2 × ... × mk = 563 × 211 × 743 = 88263199
  2. We calculate the numbers M1 to M3
    M1=M/m1=88263199/563=156773,   M2=M/m2=88263199/211=418309,   M3=M/m3=88263199/743=118793
  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
    5631567730563010
    156773563278259101
    56325924501-2
    259455341-211
    4534111-211-13
    34113111-1350
    111110-1350-563
    So our multiplicative inverse is 50 mod 563 ≡ 50
    Source: ExtendedEuclideanAlgorithm.com

    nbqr t1t2t3
    2114183090211010
    4183092111982107101
    211107110401-1
    107104131-12
    1043342-12-69
    32112-6971
    2120-6971-211
    So our multiplicative inverse is 71 mod 211 ≡ 71
    Source: ExtendedEuclideanAlgorithm.com

    nbqr t1t2t3
    7431187930743010
    118793743159656101
    74365618701-1
    656877471-18
    8747140-18-9
    4740178-917
    40755-917-94
    751217-94111
    5221-94111-316
    2120111-316743
    So our multiplicative inverse is -316 mod 743 ≡ 427
    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 × 156773 × 50 +
       26 × 418309 × 71 +
       598 × 118793 × 427)   mod 88263199
    = 23073720 (mod 88263199)


    So our answer is 23073720 (mod 88263199).


Verification

So we found that x ≡ 23073720
If this is correct, then the following statements (i.e. the original equations) are true:
182x (mod 563) ≡ 603 (mod 563)
565x (mod 211) ≡ 342 (mod 211)
808x (mod 743) ≡ 234 (mod 743)

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