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
3565170356010
5173561161101
35616123401-2
161344251-29
342519-29-11
259279-1131
9712-1131-42
723131-42157
2120-42157-356
So our multiplicative inverse is 157 mod 356 ≡ 157
Source: ExtendedEuclideanAlgorithm.com

nbqr t1t2t3
2896080289010
608289230101
2893091901-9
30191111-910
191118-910-19
1181310-1929
8322-1929-77
321129-77106
2120-77106-289
So our multiplicative inverse is 106 mod 289 ≡ 106
Source: ExtendedEuclideanAlgorithm.com

nbqr t1t2t3
811709110201-1
7091026971-17
1029715-17-8
9751927-8159
5221-8159-326
2120159-326811
So our multiplicative inverse is -326 mod 811 ≡ 485
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 ≡ 890 × 517-1 (mod 356) ≡ 890 × 157 (mod 356) ≡ 178 (mod 356)
x ≡ 168 × 608-1 (mod 289) ≡ 168 × 106 (mod 289) ≡ 179 (mod 289)
x ≡ 758 × 709-1 (mod 811) ≡ 758 × 485 (mod 811) ≡ 247 (mod 811)


Now the actual calculation

  1. Find the common modulus M
    M = m1 × m2 × ... × mk = 356 × 289 × 811 = 83438924
  2. We calculate the numbers M1 to M3
    M1=M/m1=83438924/356=234379,   M2=M/m2=83438924/289=288716,   M3=M/m3=83438924/811=102884
  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
    3562343790356010
    234379356658131101
    35613129401-2
    131941371-23
    9437220-23-8
    37201173-811
    201713-811-19
    1735211-19106
    3211-19106-125
    2120106-125356
    So our multiplicative inverse is -125 mod 356 ≡ 231
    Source: ExtendedEuclideanAlgorithm.com

    nbqr t1t2t3
    2892887160289010
    2887162899995101
    289557401-57
    54111-5758
    4140-5758-289
    So our multiplicative inverse is 58 mod 289 ≡ 58
    Source: ExtendedEuclideanAlgorithm.com

    nbqr t1t2t3
    8111028840811010
    102884811126698101
    811698111301-1
    6981136201-17
    11320513-17-36
    2013177-3643
    13716-3643-79
    761143-79122
    6160-79122-811
    So our multiplicative inverse is 122 mod 811 ≡ 122
    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
    =  (178 × 234379 × 231 +
       179 × 288716 × 58 +
       247 × 102884 × 122)   mod 83438924
    = 48433978 (mod 83438924)


    So our answer is 48433978 (mod 83438924).


Verification

So we found that x ≡ 48433978
If this is correct, then the following statements (i.e. the original equations) are true:
517x (mod 356) ≡ 890 (mod 356)
608x (mod 289) ≡ 168 (mod 289)
709x (mod 811) ≡ 758 (mod 811)

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