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
76975101901-10
75193181-1031
191811-1031-41
18118031-41769
So our multiplicative inverse is -41 mod 769 ≡ 728
Source: ExtendedEuclideanAlgorithm.com

nbqr t1t2t3
73524073010
52473713101
73135801-5
138151-56
8513-56-11
53126-1117
3211-1117-28
212017-2873
So our multiplicative inverse is -28 mod 73 ≡ 45
Source: ExtendedEuclideanAlgorithm.com

nbqr t1t2t3
1035250103010
525103510101
1031010301-10
103311-1031
3130-1031-103
So our multiplicative inverse is 31 mod 103 ≡ 31
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 ≡ 453 × 75-1 (mod 769) ≡ 453 × 728 (mod 769) ≡ 652 (mod 769)
x ≡ 516 × 524-1 (mod 73) ≡ 516 × 45 (mod 73) ≡ 6 (mod 73)
x ≡ 977 × 525-1 (mod 103) ≡ 977 × 31 (mod 103) ≡ 5 (mod 103)


Now the actual calculation

  1. Find the common modulus M
    M = m1 × m2 × ... × mk = 769 × 73 × 103 = 5782111
  2. We calculate the numbers M1 to M3
    M1=M/m1=5782111/769=7519,   M2=M/m2=5782111/73=79207,   M3=M/m3=5782111/103=56137
  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
    76975190769010
    75197699598101
    769598117101-1
    5981713851-14
    1718521-14-9
    8518504-9769
    So our multiplicative inverse is -9 mod 769 ≡ 760
    Source: ExtendedEuclideanAlgorithm.com

    nbqr t1t2t3
    7379207073010
    792077310852101
    73236101-36
    21201-3673
    So our multiplicative inverse is -36 mod 73 ≡ 37
    Source: ExtendedEuclideanAlgorithm.com

    nbqr t1t2t3
    103561370103010
    561371035452101
    103251101-51
    21201-51103
    So our multiplicative inverse is -51 mod 103 ≡ 52
    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
    =  (652 × 7519 × 760 +
       6 × 79207 × 37 +
       5 × 56137 × 52)   mod 5782111
    = 5404415 (mod 5782111)


    So our answer is 5404415 (mod 5782111).


Verification

So we found that x ≡ 5404415
If this is correct, then the following statements (i.e. the original equations) are true:
75x (mod 769) ≡ 453 (mod 769)
524x (mod 73) ≡ 516 (mod 73)
525x (mod 103) ≡ 977 (mod 103)

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