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
5016475301-7
64531111-78
531149-78-39
119128-3947
9241-3947-227
212047-227501
So our multiplicative inverse is -227 mod 501 ≡ 274
Source: ExtendedEuclideanAlgorithm.com

nbqr t1t2t3
707598110901-1
5981095531-16
1095323-16-13
5331726-13227
3211-13227-240
2120227-240707
So our multiplicative inverse is -240 mod 707 ≡ 467
Source: ExtendedEuclideanAlgorithm.com

nbqr t1t2t3
75169016101-1
6906111191-112
611934-112-37
1944312-37160
4311-37160-197
3130160-197751
So our multiplicative inverse is -197 mod 751 ≡ 554
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 ≡ 382 × 64-1 (mod 501) ≡ 382 × 274 (mod 501) ≡ 460 (mod 501)
x ≡ 316 × 598-1 (mod 707) ≡ 316 × 467 (mod 707) ≡ 516 (mod 707)
x ≡ 495 × 690-1 (mod 751) ≡ 495 × 554 (mod 751) ≡ 115 (mod 751)


Now the actual calculation

  1. Find the common modulus M
    M = m1 × m2 × ... × mk = 501 × 707 × 751 = 266009457
  2. We calculate the numbers M1 to M3
    M1=M/m1=266009457/501=530957,   M2=M/m2=266009457/707=376251,   M3=M/m3=266009457/751=354207
  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
    5015309570501010
    5309575011059398101
    501398110301-1
    3981033891-14
    10389114-14-5
    8914654-534
    14524-534-73
    541134-73107
    4140-73107-501
    So our multiplicative inverse is 107 mod 501 ≡ 107
    Source: ExtendedEuclideanAlgorithm.com

    nbqr t1t2t3
    7073762510707010
    376251707532127101
    70712757201-5
    127721551-56
    7255117-56-11
    5517346-1139
    17441-1139-167
    414039-167707
    So our multiplicative inverse is -167 mod 707 ≡ 540
    Source: ExtendedEuclideanAlgorithm.com

    nbqr t1t2t3
    7513542070751010
    354207751471486101
    751486126501-1
    48626512211-12
    265221144-12-3
    22144512-317
    441440-317-751
    So our multiplicative inverse is 17 mod 751 ≡ 17
    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
    =  (460 × 530957 × 107 +
       516 × 376251 × 540 +
       115 × 354207 × 17)   mod 266009457
    = 256085107 (mod 266009457)


    So our answer is 256085107 (mod 266009457).


Verification

So we found that x ≡ 256085107
If this is correct, then the following statements (i.e. the original equations) are true:
64x (mod 501) ≡ 382 (mod 501)
598x (mod 707) ≡ 316 (mod 707)
690x (mod 751) ≡ 495 (mod 751)

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