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
2273550227010
3552271128101
22712819901-1
128991291-12
9929312-12-7
2912252-716
12522-716-39
522116-3994
2120-3994-227
So our multiplicative inverse is 94 mod 227 ≡ 94
Source: ExtendedEuclideanAlgorithm.com

nbqr t1t2t3
50503050010
50350103101
50316201-16
32111-1617
2120-1617-50
So our multiplicative inverse is 17 mod 50 ≡ 17
Source: ExtendedEuclideanAlgorithm.com

nbqr t1t2t3
889531135801-1
53135811731-12
358173212-12-5
173121452-572
12522-572-149
522172-149370
2120-149370-889
So our multiplicative inverse is 370 mod 889 ≡ 370
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 ≡ 573 × 355-1 (mod 227) ≡ 573 × 94 (mod 227) ≡ 63 (mod 227)
x ≡ 816 × 503-1 (mod 50) ≡ 816 × 17 (mod 50) ≡ 22 (mod 50)
x ≡ 425 × 531-1 (mod 889) ≡ 425 × 370 (mod 889) ≡ 786 (mod 889)


Now the actual calculation

  1. Find the common modulus M
    M = m1 × m2 × ... × mk = 227 × 50 × 889 = 10090150
  2. We calculate the numbers M1 to M3
    M1=M/m1=10090150/227=44450,   M2=M/m2=10090150/50=201803,   M3=M/m3=10090150/889=11350
  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
    227444500227010
    44450227195185101
    22718514201-1
    185424171-15
    421728-15-11
    178215-1127
    8180-1127-227
    So our multiplicative inverse is 27 mod 227 ≡ 27
    Source: ExtendedEuclideanAlgorithm.com

    nbqr t1t2t3
    50201803050010
    2018035040363101
    50316201-16
    32111-1617
    2120-1617-50
    So our multiplicative inverse is 17 mod 50 ≡ 17
    Source: ExtendedEuclideanAlgorithm.com

    nbqr t1t2t3
    889113500889010
    1135088912682101
    889682120701-1
    6822073611-14
    20761324-14-13
    61242134-1330
    2413111-1330-43
    13111230-4373
    11251-4373-408
    212073-408889
    So our multiplicative inverse is -408 mod 889 ≡ 481
    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
    =  (63 × 44450 × 27 +
       22 × 201803 × 17 +
       786 × 11350 × 481)   mod 10090150
    = 2466872 (mod 10090150)


    So our answer is 2466872 (mod 10090150).


Verification

So we found that x ≡ 2466872
If this is correct, then the following statements (i.e. the original equations) are true:
355x (mod 227) ≡ 573 (mod 227)
503x (mod 50) ≡ 816 (mod 50)
531x (mod 889) ≡ 425 (mod 889)

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