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
7167110601-10
7161151-10111
6511-10111-121
5150111-121716
So our multiplicative inverse is -121 mod 716 ≡ 595
Source: ExtendedEuclideanAlgorithm.com

nbqr t1t2t3
821535128601-1
53528612491-12
286249137-12-3
249376272-320
3727110-320-23
27102720-2366
10713-2366-89
732166-89244
3130-89244-821
So our multiplicative inverse is 244 mod 821 ≡ 244
Source: ExtendedEuclideanAlgorithm.com

nbqr t1t2t3
1492410149010
241149192101
1499215701-1
92571351-12
5735122-12-3
35221132-35
221319-35-8
139145-813
9421-813-34
414013-34149
So our multiplicative inverse is -34 mod 149 ≡ 115
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 ≡ 515 × 71-1 (mod 716) ≡ 515 × 595 (mod 716) ≡ 693 (mod 716)
x ≡ 687 × 535-1 (mod 821) ≡ 687 × 244 (mod 821) ≡ 144 (mod 821)
x ≡ 681 × 241-1 (mod 149) ≡ 681 × 115 (mod 149) ≡ 90 (mod 149)


Now the actual calculation

  1. Find the common modulus M
    M = m1 × m2 × ... × mk = 716 × 821 × 149 = 87587564
  2. We calculate the numbers M1 to M3
    M1=M/m1=87587564/716=122329,   M2=M/m2=87587564/821=106684,   M3=M/m3=87587564/149=587836
  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
    7161223290716010
    122329716170609101
    716609110701-1
    6091075741-16
    10774133-16-7
    7433286-720
    33841-720-87
    818020-87716
    So our multiplicative inverse is -87 mod 716 ≡ 629
    Source: ExtendedEuclideanAlgorithm.com

    nbqr t1t2t3
    8211066840821010
    106684821129775101
    82177514601-1
    7754616391-117
    463917-117-18
    3975417-18107
    7413-18107-125
    4311107-125232
    3130-125232-821
    So our multiplicative inverse is 232 mod 821 ≡ 232
    Source: ExtendedEuclideanAlgorithm.com

    nbqr t1t2t3
    1495878360149010
    587836149394531101
    1493142501-4
    3125161-45
    25641-45-24
    61605-24149
    So our multiplicative inverse is -24 mod 149 ≡ 125
    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
    =  (693 × 122329 × 629 +
       144 × 106684 × 232 +
       90 × 587836 × 125)   mod 87587564
    = 86701849 (mod 87587564)


    So our answer is 86701849 (mod 87587564).


Verification

So we found that x ≡ 86701849
If this is correct, then the following statements (i.e. the original equations) are true:
71x (mod 716) ≡ 515 (mod 716)
535x (mod 821) ≡ 687 (mod 821)
241x (mod 149) ≡ 681 (mod 149)

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