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
88738231301-23
38132121-2347
131211-2347-70
12112047-70887
So our multiplicative inverse is -70 mod 887 ≡ 817
Source: ExtendedEuclideanAlgorithm.com

nbqr t1t2t3
5635640563010
56456311101
5631563001-563
So our multiplicative inverse is 1 mod 563 ≡ 1
Source: ExtendedEuclideanAlgorithm.com

nbqr t1t2t3
823169414701-4
1691471221-45
14722615-45-34
2215175-3439
15721-3439-112
717039-112823
So our multiplicative inverse is -112 mod 823 ≡ 711
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 ≡ 506 × 38-1 (mod 887) ≡ 506 × 817 (mod 887) ≡ 60 (mod 887)
x ≡ 424 × 564-1 (mod 563) ≡ 424 × 1 (mod 563) ≡ 424 (mod 563)
x ≡ 765 × 169-1 (mod 823) ≡ 765 × 711 (mod 823) ≡ 735 (mod 823)


Now the actual calculation

  1. Find the common modulus M
    M = m1 × m2 × ... × mk = 887 × 563 × 823 = 410990563
  2. We calculate the numbers M1 to M3
    M1=M/m1=410990563/887=463349,   M2=M/m2=410990563/563=730001,   M3=M/m3=410990563/823=499381
  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
    8874633490887010
    463349887522335101
    887335221701-2
    33521711181-23
    217118199-23-5
    118991193-58
    991954-58-45
    194438-45188
    4311-45188-233
    3130188-233887
    So our multiplicative inverse is -233 mod 887 ≡ 654
    Source: ExtendedEuclideanAlgorithm.com

    nbqr t1t2t3
    5637300010563010
    7300015631296353101
    563353121001-1
    35321011431-12
    210143167-12-3
    14367292-38
    67974-38-59
    94218-59126
    4140-59126-563
    So our multiplicative inverse is 126 mod 563 ≡ 126
    Source: ExtendedEuclideanAlgorithm.com

    nbqr t1t2t3
    8234993810823010
    499381823606643101
    823643118001-1
    64318031031-14
    180103177-14-5
    103771264-59
    7726225-59-23
    2625119-2332
    251250-2332-823
    So our multiplicative inverse is 32 mod 823 ≡ 32
    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
    =  (60 × 463349 × 654 +
       424 × 730001 × 126 +
       735 × 499381 × 32)   mod 410990563
    = 291405283 (mod 410990563)


    So our answer is 291405283 (mod 410990563).


Verification

So we found that x ≡ 291405283
If this is correct, then the following statements (i.e. the original equations) are true:
38x (mod 887) ≡ 506 (mod 887)
564x (mod 563) ≡ 424 (mod 563)
169x (mod 823) ≡ 765 (mod 823)

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