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
7517890751010
789751138101
75138192901-19
3829191-1920
29932-1920-79
924120-79336
2120-79336-751
So our multiplicative inverse is 336 mod 751 ≡ 336
Source: ExtendedEuclideanAlgorithm.com

nbqr t1t2t3
71788071010
78871117101
71710101-10
71701-1071
So our multiplicative inverse is -10 mod 71 ≡ 61
Source: ExtendedEuclideanAlgorithm.com

nbqr t1t2t3
4846175701-7
6157141-78
574141-78-119
41408-119484
So our multiplicative inverse is -119 mod 484 ≡ 365
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 ≡ 224 × 789-1 (mod 751) ≡ 224 × 336 (mod 751) ≡ 164 (mod 751)
x ≡ 165 × 788-1 (mod 71) ≡ 165 × 61 (mod 71) ≡ 54 (mod 71)
x ≡ 759 × 61-1 (mod 484) ≡ 759 × 365 (mod 484) ≡ 187 (mod 484)


Now the actual calculation

  1. Find the common modulus M
    M = m1 × m2 × ... × mk = 751 × 71 × 484 = 25807364
  2. We calculate the numbers M1 to M3
    M1=M/m1=25807364/751=34364,   M2=M/m2=25807364/71=363484,   M3=M/m3=25807364/484=53321
  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
    751343640751010
    3436475145569101
    751569118201-1
    5691823231-14
    18223721-14-29
    2321124-2933
    212101-2933-359
    212033-359751
    So our multiplicative inverse is -359 mod 751 ≡ 392
    Source: ExtendedEuclideanAlgorithm.com

    nbqr t1t2t3
    71363484071010
    36348471511935101
    71352101-2
    3513501-271
    So our multiplicative inverse is -2 mod 71 ≡ 69
    Source: ExtendedEuclideanAlgorithm.com

    nbqr t1t2t3
    484533210484010
    5332148411081101
    4848157901-5
    8179121-56
    792391-56-239
    21206-239484
    So our multiplicative inverse is -239 mod 484 ≡ 245
    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
    =  (164 × 34364 × 392 +
       54 × 363484 × 69 +
       187 × 53321 × 245)   mod 25807364
    = 19127383 (mod 25807364)


    So our answer is 19127383 (mod 25807364).


Verification

So we found that x ≡ 19127383
If this is correct, then the following statements (i.e. the original equations) are true:
789x (mod 751) ≡ 224 (mod 751)
788x (mod 71) ≡ 165 (mod 71)
61x (mod 484) ≡ 759 (mod 484)

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