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
44919426101-2
194613111-27
611156-27-37
116157-3744
6511-3744-81
515044-81449
So our multiplicative inverse is -81 mod 449 ≡ 368
Source: ExtendedEuclideanAlgorithm.com

nbqr t1t2t3
1786730178010
6731783139101
17813913901-1
139393221-14
3922117-14-5
2217154-59
17532-59-32
52219-3273
2120-3273-178
So our multiplicative inverse is 73 mod 178 ≡ 73
Source: ExtendedEuclideanAlgorithm.com

nbqr t1t2t3
4198100419010
8104191391101
41939112801-1
3912813271-114
282711-114-15
27127014-15419
So our multiplicative inverse is -15 mod 419 ≡ 404
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 ≡ 210 × 194-1 (mod 449) ≡ 210 × 368 (mod 449) ≡ 52 (mod 449)
x ≡ 364 × 673-1 (mod 178) ≡ 364 × 73 (mod 178) ≡ 50 (mod 178)
x ≡ 546 × 810-1 (mod 419) ≡ 546 × 404 (mod 419) ≡ 190 (mod 419)


Now the actual calculation

  1. Find the common modulus M
    M = m1 × m2 × ... × mk = 449 × 178 × 419 = 33487318
  2. We calculate the numbers M1 to M3
    M1=M/m1=33487318/449=74582,   M2=M/m2=33487318/178=188131,   M3=M/m3=33487318/419=79922
  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
    449745820449010
    7458244916648101
    4494891701-9
    48172141-919
    171413-919-28
    1434219-28131
    3211-28131-159
    2120131-159449
    So our multiplicative inverse is -159 mod 449 ≡ 290
    Source: ExtendedEuclideanAlgorithm.com

    nbqr t1t2t3
    1781881310178010
    1881311781056163101
    17816311501-1
    1631510131-111
    151312-111-12
    1326111-1283
    2120-1283-178
    So our multiplicative inverse is 83 mod 178 ≡ 83
    Source: ExtendedEuclideanAlgorithm.com

    nbqr t1t2t3
    419799220419010
    79922419190312101
    419312110701-1
    3121072981-13
    1079819-13-4
    9891083-443
    9811-443-47
    818043-47419
    So our multiplicative inverse is -47 mod 419 ≡ 372
    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
    =  (52 × 74582 × 290 +
       50 × 188131 × 83 +
       190 × 79922 × 372)   mod 33487318
    = 19680620 (mod 33487318)


    So our answer is 19680620 (mod 33487318).


Verification

So we found that x ≡ 19680620
If this is correct, then the following statements (i.e. the original equations) are true:
194x (mod 449) ≡ 210 (mod 449)
673x (mod 178) ≡ 364 (mod 178)
810x (mod 419) ≡ 546 (mod 419)

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