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
49598049010
598491210101
49104901-4
109111-45
9190-45-49
So our multiplicative inverse is 5 mod 49 ≡ 5
Source: ExtendedEuclideanAlgorithm.com

nbqr t1t2t3
61127226701-2
27267441-29
674163-29-146
43119-146155
3130-146155-611
So our multiplicative inverse is 155 mod 611 ≡ 155
Source: ExtendedEuclideanAlgorithm.com

nbqr t1t2t3
2294180229010
4182291189101
22918914001-1
189404291-15
4029111-15-6
2911275-617
11714-617-23
741317-2340
4311-2340-63
313040-63229
So our multiplicative inverse is -63 mod 229 ≡ 166
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 ≡ 881 × 598-1 (mod 49) ≡ 881 × 5 (mod 49) ≡ 44 (mod 49)
x ≡ 787 × 272-1 (mod 611) ≡ 787 × 155 (mod 611) ≡ 396 (mod 611)
x ≡ 710 × 418-1 (mod 229) ≡ 710 × 166 (mod 229) ≡ 154 (mod 229)


Now the actual calculation

  1. Find the common modulus M
    M = m1 × m2 × ... × mk = 49 × 611 × 229 = 6856031
  2. We calculate the numbers M1 to M3
    M1=M/m1=6856031/49=139919,   M2=M/m2=6856031/611=11221,   M3=M/m3=6856031/229=29939
  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
    49139919049010
    13991949285524101
    49242101-2
    2412401-249
    So our multiplicative inverse is -2 mod 49 ≡ 47
    Source: ExtendedEuclideanAlgorithm.com

    nbqr t1t2t3
    611112210611010
    1122161118223101
    611223216501-2
    2231651581-23
    16558249-23-8
    5849193-811
    49954-811-63
    942111-63137
    4140-63137-611
    So our multiplicative inverse is 137 mod 611 ≡ 137
    Source: ExtendedEuclideanAlgorithm.com

    nbqr t1t2t3
    229299390229010
    29939229130169101
    22916916001-1
    169602491-13
    6049111-13-4
    4911453-419
    11521-419-42
    515019-42229
    So our multiplicative inverse is -42 mod 229 ≡ 187
    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
    =  (44 × 139919 × 47 +
       396 × 11221 × 137 +
       154 × 29939 × 187)   mod 6856031
    = 5153570 (mod 6856031)


    So our answer is 5153570 (mod 6856031).


Verification

So we found that x ≡ 5153570
If this is correct, then the following statements (i.e. the original equations) are true:
598x (mod 49) ≡ 881 (mod 49)
272x (mod 611) ≡ 787 (mod 611)
418x (mod 229) ≡ 710 (mod 229)

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