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
61576061010
57661927101
61272701-2
277361-27
7611-27-9
61607-961
So our multiplicative inverse is -9 mod 61 ≡ 52
Source: ExtendedEuclideanAlgorithm.com

nbqr t1t2t3
711449126201-1
44926211871-12
262187175-12-3
187752372-38
753721-38-19
3713708-19711
So our multiplicative inverse is -19 mod 711 ≡ 692
Source: ExtendedEuclideanAlgorithm.com

nbqr t1t2t3
88179718401-1
797849411-110
844122-110-21
41220110-21430
2120-21430-881
So our multiplicative inverse is 430 mod 881 ≡ 430
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 ≡ 560 × 576-1 (mod 61) ≡ 560 × 52 (mod 61) ≡ 23 (mod 61)
x ≡ 645 × 449-1 (mod 711) ≡ 645 × 692 (mod 711) ≡ 543 (mod 711)
x ≡ 714 × 797-1 (mod 881) ≡ 714 × 430 (mod 881) ≡ 432 (mod 881)


Now the actual calculation

  1. Find the common modulus M
    M = m1 × m2 × ... × mk = 61 × 711 × 881 = 38209851
  2. We calculate the numbers M1 to M3
    M1=M/m1=38209851/61=626391,   M2=M/m2=38209851/711=53741,   M3=M/m3=38209851/881=43371
  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
    61626391061010
    626391611026843101
    614311801-1
    4318271-13
    18724-13-7
    74133-710
    4311-710-17
    313010-1761
    So our multiplicative inverse is -17 mod 61 ≡ 44
    Source: ExtendedEuclideanAlgorithm.com

    nbqr t1t2t3
    711537410711010
    5374171175416101
    711416129501-1
    41629511211-12
    295121253-12-5
    121532152-512
    531538-512-41
    1581712-4153
    8711-4153-94
    717053-94711
    So our multiplicative inverse is -94 mod 711 ≡ 617
    Source: ExtendedEuclideanAlgorithm.com

    nbqr t1t2t3
    881433710881010
    4337188149202101
    88120247301-4
    202732561-49
    7356117-49-13
    5617359-1348
    17532-1348-157
    522148-157362
    2120-157362-881
    So our multiplicative inverse is 362 mod 881 ≡ 362
    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
    =  (23 × 626391 × 44 +
       543 × 53741 × 617 +
       432 × 43371 × 362)   mod 38209851
    = 11788212 (mod 38209851)


    So our answer is 11788212 (mod 38209851).


Verification

So we found that x ≡ 11788212
If this is correct, then the following statements (i.e. the original equations) are true:
576x (mod 61) ≡ 560 (mod 61)
449x (mod 711) ≡ 645 (mod 711)
797x (mod 881) ≡ 714 (mod 881)

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