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
4397200439010
7204391281101
439281115801-1
28115811231-12
158123135-12-3
123353182-311
3518117-311-14
18171111-1425
171170-1425-439
So our multiplicative inverse is 25 mod 439 ≡ 25
Source: ExtendedEuclideanAlgorithm.com

nbqr t1t2t3
289368101-8
3613601-8289
So our multiplicative inverse is -8 mod 289 ≡ 281
Source: ExtendedEuclideanAlgorithm.com

nbqr t1t2t3
2743670274010
367274193101
2749328801-2
9388151-23
885173-23-53
53123-5356
3211-5356-109
212056-109274
So our multiplicative inverse is -109 mod 274 ≡ 165
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 ≡ 815 × 720-1 (mod 439) ≡ 815 × 25 (mod 439) ≡ 181 (mod 439)
x ≡ 55 × 36-1 (mod 289) ≡ 55 × 281 (mod 289) ≡ 138 (mod 289)
x ≡ 470 × 367-1 (mod 274) ≡ 470 × 165 (mod 274) ≡ 8 (mod 274)


Now the actual calculation

  1. Find the common modulus M
    M = m1 × m2 × ... × mk = 439 × 289 × 274 = 34762654
  2. We calculate the numbers M1 to M3
    M1=M/m1=34762654/439=79186,   M2=M/m2=34762654/289=120286,   M3=M/m3=34762654/274=126871
  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
    439791860439010
    79186439180166101
    439166210701-2
    1661071591-23
    10759148-23-5
    59481113-58
    481144-58-37
    114238-3782
    4311-3782-119
    313082-119439
    So our multiplicative inverse is -119 mod 439 ≡ 320
    Source: ExtendedEuclideanAlgorithm.com

    nbqr t1t2t3
    2891202860289010
    12028628941662101
    2896244101-4
    62411211-45
    4121120-45-9
    2120115-914
    201200-914-289
    So our multiplicative inverse is 14 mod 289 ≡ 14
    Source: ExtendedEuclideanAlgorithm.com

    nbqr t1t2t3
    2741268710274010
    1268712744639101
    274930401-30
    94211-3061
    4140-3061-274
    So our multiplicative inverse is 61 mod 274 ≡ 61
    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
    =  (181 × 79186 × 320 +
       138 × 120286 × 14 +
       8 × 126871 × 61)   mod 34762654
    = 13987160 (mod 34762654)


    So our answer is 13987160 (mod 34762654).


Verification

So we found that x ≡ 13987160
If this is correct, then the following statements (i.e. the original equations) are true:
720x (mod 439) ≡ 815 (mod 439)
36x (mod 289) ≡ 55 (mod 289)
367x (mod 274) ≡ 470 (mod 274)

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