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
907746116101-1
74616141021-15
161102159-15-6
102591435-611
5943116-611-17
431621111-1745
161115-1745-62
1152145-62169
5150-62169-907
So our multiplicative inverse is 169 mod 907 ≡ 169
Source: ExtendedEuclideanAlgorithm.com

nbqr t1t2t3
5836200583010
620583137101
58337152801-15
3728191-1516
28931-1516-63
919016-63583
So our multiplicative inverse is -63 mod 583 ≡ 520
Source: ExtendedEuclideanAlgorithm.com

nbqr t1t2t3
18911017901-1
110791311-12
7931217-12-5
31171142-57
171413-57-12
143427-1255
3211-1255-67
212055-67189
So our multiplicative inverse is -67 mod 189 ≡ 122
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 ≡ 359 × 746-1 (mod 907) ≡ 359 × 169 (mod 907) ≡ 809 (mod 907)
x ≡ 293 × 620-1 (mod 583) ≡ 293 × 520 (mod 583) ≡ 197 (mod 583)
x ≡ 444 × 110-1 (mod 189) ≡ 444 × 122 (mod 189) ≡ 114 (mod 189)


Now the actual calculation

  1. Find the common modulus M
    M = m1 × m2 × ... × mk = 907 × 583 × 189 = 99939609
  2. We calculate the numbers M1 to M3
    M1=M/m1=99939609/907=110187,   M2=M/m2=99939609/583=171423,   M3=M/m3=99939609/189=528781
  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
    9071101870907010
    110187907121440101
    90744022701-2
    440271681-233
    27833-233-101
    832233-101235
    3211-101235-336
    2120235-336907
    So our multiplicative inverse is -336 mod 907 ≡ 571
    Source: ExtendedEuclideanAlgorithm.com

    nbqr t1t2t3
    5831714230583010
    17142358329421101
    58321271601-27
    2116151-2728
    16531-2728-111
    515028-111583
    So our multiplicative inverse is -111 mod 583 ≡ 472
    Source: ExtendedEuclideanAlgorithm.com

    nbqr t1t2t3
    1895287810189010
    5287811892797148101
    18914814101-1
    148413251-14
    4125116-14-5
    2516194-59
    16917-59-14
    97129-1423
    7231-1423-83
    212023-83189
    So our multiplicative inverse is -83 mod 189 ≡ 106
    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
    =  (809 × 110187 × 571 +
       197 × 171423 × 472 +
       114 × 528781 × 106)   mod 99939609
    = 73264641 (mod 99939609)


    So our answer is 73264641 (mod 99939609).


Verification

So we found that x ≡ 73264641
If this is correct, then the following statements (i.e. the original equations) are true:
746x (mod 907) ≡ 359 (mod 907)
620x (mod 583) ≡ 293 (mod 583)
110x (mod 189) ≡ 444 (mod 189)

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