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
3755690375010
5693751194101
375194118101-1
1941811131-12
181131312-12-27
1312112-2729
121120-2729-375
So our multiplicative inverse is 29 mod 375 ≡ 29
Source: ExtendedEuclideanAlgorithm.com

nbqr t1t2t3
839176413501-4
1761351411-45
13541312-45-19
4112355-1962
12522-1962-143
522162-143348
2120-143348-839
So our multiplicative inverse is 348 mod 839 ≡ 348
Source: ExtendedEuclideanAlgorithm.com

nbqr t1t2t3
2267110226010
711226333101
2263362801-6
3328151-67
28553-67-41
53127-4148
3211-4148-89
212048-89226
So our multiplicative inverse is -89 mod 226 ≡ 137
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 ≡ 460 × 569-1 (mod 375) ≡ 460 × 29 (mod 375) ≡ 215 (mod 375)
x ≡ 279 × 176-1 (mod 839) ≡ 279 × 348 (mod 839) ≡ 607 (mod 839)
x ≡ 377 × 711-1 (mod 226) ≡ 377 × 137 (mod 226) ≡ 121 (mod 226)


Now the actual calculation

  1. Find the common modulus M
    M = m1 × m2 × ... × mk = 375 × 839 × 226 = 71105250
  2. We calculate the numbers M1 to M3
    M1=M/m1=71105250/375=189614,   M2=M/m2=71105250/839=84750,   M3=M/m3=71105250/226=314625
  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
    3751896140375010
    189614375505239101
    375239113601-1
    23913611031-12
    136103133-12-3
    10333342-311
    33481-311-91
    414011-91375
    So our multiplicative inverse is -91 mod 375 ≡ 284
    Source: ExtendedEuclideanAlgorithm.com

    nbqr t1t2t3
    839847500839010
    8475083910111101
    8391176301-76
    113321-76229
    3211-76229-305
    2120229-305839
    So our multiplicative inverse is -305 mod 839 ≡ 534
    Source: ExtendedEuclideanAlgorithm.com

    nbqr t1t2t3
    2263146250226010
    314625226139233101
    2263362801-6
    3328151-67
    28553-67-41
    53127-4148
    3211-4148-89
    212048-89226
    So our multiplicative inverse is -89 mod 226 ≡ 137
    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
    =  (215 × 189614 × 284 +
       607 × 84750 × 534 +
       121 × 314625 × 137)   mod 71105250
    = 36599465 (mod 71105250)


    So our answer is 36599465 (mod 71105250).


Verification

So we found that x ≡ 36599465
If this is correct, then the following statements (i.e. the original equations) are true:
569x (mod 375) ≡ 460 (mod 375)
176x (mod 839) ≡ 279 (mod 839)
711x (mod 226) ≡ 377 (mod 226)

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