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
3594960359010
4963591137101
35913728501-2
137851521-23
8552133-23-5
52331193-58
3319114-58-13
1914158-1321
14524-1321-55
541121-5576
4140-5576-359
So our multiplicative inverse is 76 mod 359 ≡ 76
Source: ExtendedEuclideanAlgorithm.com

nbqr t1t2t3
83753083010
7538396101
83613501-13
65111-1314
5150-1314-83
So our multiplicative inverse is 14 mod 83 ≡ 14
Source: ExtendedEuclideanAlgorithm.com

nbqr t1t2t3
844709113501-1
7091355341-16
13534333-16-19
3433116-1925
331330-1925-844
So our multiplicative inverse is 25 mod 844 ≡ 25
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 ≡ 75 × 496-1 (mod 359) ≡ 75 × 76 (mod 359) ≡ 315 (mod 359)
x ≡ 184 × 753-1 (mod 83) ≡ 184 × 14 (mod 83) ≡ 3 (mod 83)
x ≡ 291 × 709-1 (mod 844) ≡ 291 × 25 (mod 844) ≡ 523 (mod 844)


Now the actual calculation

  1. Find the common modulus M
    M = m1 × m2 × ... × mk = 359 × 83 × 844 = 25148668
  2. We calculate the numbers M1 to M3
    M1=M/m1=25148668/359=70052,   M2=M/m2=25148668/83=302996,   M3=M/m3=25148668/844=29797
  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
    359700520359010
    7005235919547101
    3594773001-7
    47301171-78
    3017113-78-15
    1713148-1523
    13431-1523-84
    414023-84359
    So our multiplicative inverse is -84 mod 359 ≡ 275
    Source: ExtendedEuclideanAlgorithm.com

    nbqr t1t2t3
    83302996083010
    30299683365046101
    834613701-1
    4637191-12
    37941-12-9
    91902-983
    So our multiplicative inverse is -9 mod 83 ≡ 74
    Source: ExtendedEuclideanAlgorithm.com

    nbqr t1t2t3
    844297970844010
    2979784435257101
    84425737301-3
    257733381-310
    7338135-310-13
    38351310-1323
    353112-1323-266
    321123-266289
    2120-266289-844
    So our multiplicative inverse is 289 mod 844 ≡ 289
    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
    =  (315 × 70052 × 275 +
       3 × 302996 × 74 +
       523 × 29797 × 289)   mod 25148668
    = 1360207 (mod 25148668)


    So our answer is 1360207 (mod 25148668).


Verification

So we found that x ≡ 1360207
If this is correct, then the following statements (i.e. the original equations) are true:
496x (mod 359) ≡ 75 (mod 359)
753x (mod 83) ≡ 184 (mod 83)
709x (mod 844) ≡ 291 (mod 844)

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