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
4338380433010
8384331405101
43340512801-1
4052814131-115
281322-115-31
1326115-31201
2120-31201-433
So our multiplicative inverse is 201 mod 433 ≡ 201
Source: ExtendedEuclideanAlgorithm.com

nbqr t1t2t3
47945212701-1
4522716201-117
272017-117-18
2072617-1853
7611-1853-71
616053-71479
So our multiplicative inverse is -71 mod 479 ≡ 408
Source: ExtendedEuclideanAlgorithm.com

nbqr t1t2t3
7299290729010
9297291200101
729200312901-3
2001291711-34
12971158-34-7
71581134-711
581346-711-51
1362111-51113
6160-51113-729
So our multiplicative inverse is 113 mod 729 ≡ 113
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 ≡ 315 × 838-1 (mod 433) ≡ 315 × 201 (mod 433) ≡ 97 (mod 433)
x ≡ 722 × 452-1 (mod 479) ≡ 722 × 408 (mod 479) ≡ 470 (mod 479)
x ≡ 381 × 929-1 (mod 729) ≡ 381 × 113 (mod 729) ≡ 42 (mod 729)


Now the actual calculation

  1. Find the common modulus M
    M = m1 × m2 × ... × mk = 433 × 479 × 729 = 151199703
  2. We calculate the numbers M1 to M3
    M1=M/m1=151199703/433=349191,   M2=M/m2=151199703/479=315657,   M3=M/m3=151199703/729=207407
  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
    4333491910433010
    349191433806193101
    43319324701-2
    19347451-29
    47592-29-83
    52219-83175
    2120-83175-433
    So our multiplicative inverse is 175 mod 433 ≡ 175
    Source: ExtendedEuclideanAlgorithm.com

    nbqr t1t2t3
    4793156570479010
    315657479658475101
    4794751401-1
    475411831-1119
    4311-1119-120
    3130119-120479
    So our multiplicative inverse is -120 mod 479 ≡ 359
    Source: ExtendedEuclideanAlgorithm.com

    nbqr t1t2t3
    7292074070729010
    207407729284371101
    729371135801-1
    3713581131-12
    35813277-12-55
    137162-5557
    7611-5557-112
    616057-112729
    So our multiplicative inverse is -112 mod 729 ≡ 617
    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
    =  (97 × 349191 × 175 +
       470 × 315657 × 359 +
       42 × 207407 × 617)   mod 151199703
    = 794652 (mod 151199703)


    So our answer is 794652 (mod 151199703).


Verification

So we found that x ≡ 794652
If this is correct, then the following statements (i.e. the original equations) are true:
838x (mod 433) ≡ 315 (mod 433)
452x (mod 479) ≡ 722 (mod 479)
929x (mod 729) ≡ 381 (mod 729)

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