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
88327137001-3
271703611-310
706119-310-13
6196710-1388
9712-1388-101
723188-101391
2120-101391-883
So our multiplicative inverse is 391 mod 883 ≡ 391
Source: ExtendedEuclideanAlgorithm.com

nbqr t1t2t3
743454128901-1
45428911651-12
2891651124-12-3
1651241412-35
1244131-35-18
4114105-18743
So our multiplicative inverse is -18 mod 743 ≡ 725
Source: ExtendedEuclideanAlgorithm.com

nbqr t1t2t3
1139740113010
974113870101
1137014301-1
70431271-12
4327116-12-3
27161112-35
161115-35-8
115215-821
5150-821-113
So our multiplicative inverse is 21 mod 113 ≡ 21
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 ≡ 518 × 271-1 (mod 883) ≡ 518 × 391 (mod 883) ≡ 331 (mod 883)
x ≡ 887 × 454-1 (mod 743) ≡ 887 × 725 (mod 743) ≡ 380 (mod 743)
x ≡ 140 × 974-1 (mod 113) ≡ 140 × 21 (mod 113) ≡ 2 (mod 113)


Now the actual calculation

  1. Find the common modulus M
    M = m1 × m2 × ... × mk = 883 × 743 × 113 = 74135797
  2. We calculate the numbers M1 to M3
    M1=M/m1=74135797/883=83959,   M2=M/m2=74135797/743=99779,   M3=M/m3=74135797/113=656069
  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
    883839590883010
    839598839574101
    88374116901-11
    7469151-1112
    695134-1112-167
    541112-167179
    4140-167179-883
    So our multiplicative inverse is 179 mod 883 ≡ 179
    Source: ExtendedEuclideanAlgorithm.com

    nbqr t1t2t3
    743997790743010
    99779743134217101
    74321739201-3
    217922331-37
    9233226-37-17
    3326177-1724
    26735-1724-89
    751224-89113
    5221-89113-315
    2120113-315743
    So our multiplicative inverse is -315 mod 743 ≡ 428
    Source: ExtendedEuclideanAlgorithm.com

    nbqr t1t2t3
    1136560690113010
    6560691135805104101
    1131041901-1
    10491151-112
    9514-112-13
    541112-1325
    4140-1325-113
    So our multiplicative inverse is 25 mod 113 ≡ 25
    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
    =  (331 × 83959 × 179 +
       380 × 99779 × 428 +
       2 × 656069 × 25)   mod 74135797
    = 32508859 (mod 74135797)


    So our answer is 32508859 (mod 74135797).


Verification

So we found that x ≡ 32508859
If this is correct, then the following statements (i.e. the original equations) are true:
271x (mod 883) ≡ 518 (mod 883)
454x (mod 743) ≡ 887 (mod 743)
974x (mod 113) ≡ 140 (mod 113)

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