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
514283123101-1
2832311521-12
23152423-12-9
5223262-920
23635-920-69
651120-6989
5150-6989-514
So our multiplicative inverse is 89 mod 514 ≡ 89
Source: ExtendedEuclideanAlgorithm.com

nbqr t1t2t3
7438830743010
8837431140101
74314054301-5
140433111-516
4311310-516-53
11101116-5369
101100-5369-743
So our multiplicative inverse is 69 mod 743 ≡ 69
Source: ExtendedEuclideanAlgorithm.com

nbqr t1t2t3
47521923701-2
219375341-211
373413-211-13
34311111-13154
3130-13154-475
So our multiplicative inverse is 154 mod 475 ≡ 154
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 ≡ 86 × 283-1 (mod 514) ≡ 86 × 89 (mod 514) ≡ 458 (mod 514)
x ≡ 13 × 883-1 (mod 743) ≡ 13 × 69 (mod 743) ≡ 154 (mod 743)
x ≡ 369 × 219-1 (mod 475) ≡ 369 × 154 (mod 475) ≡ 301 (mod 475)


Now the actual calculation

  1. Find the common modulus M
    M = m1 × m2 × ... × mk = 514 × 743 × 475 = 181403450
  2. We calculate the numbers M1 to M3
    M1=M/m1=181403450/514=352925,   M2=M/m2=181403450/743=244150,   M3=M/m3=181403450/475=381902
  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
    5143529250514010
    352925514686321101
    514321119301-1
    32119311281-12
    193128165-12-3
    128651632-35
    656312-35-8
    6323115-8253
    2120-8253-514
    So our multiplicative inverse is 253 mod 514 ≡ 253
    Source: ExtendedEuclideanAlgorithm.com

    nbqr t1t2t3
    7432441500743010
    244150743328446101
    743446129701-1
    44629711491-12
    2971491148-12-3
    149148112-35
    14811480-35-743
    So our multiplicative inverse is 5 mod 743 ≡ 5
    Source: ExtendedEuclideanAlgorithm.com

    nbqr t1t2t3
    4753819020475010
    3819024758042101
    4752237101-237
    21201-237475
    So our multiplicative inverse is -237 mod 475 ≡ 238
    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
    =  (458 × 352925 × 253 +
       154 × 244150 × 5 +
       301 × 381902 × 238)   mod 181403450
    = 52421776 (mod 181403450)


    So our answer is 52421776 (mod 181403450).


Verification

So we found that x ≡ 52421776
If this is correct, then the following statements (i.e. the original equations) are true:
283x (mod 514) ≡ 86 (mod 514)
883x (mod 743) ≡ 13 (mod 743)
219x (mod 475) ≡ 369 (mod 475)

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