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
71928071010
92871135101
71514101-14
51501-1471
So our multiplicative inverse is -14 mod 71 ≡ 57
Source: ExtendedEuclideanAlgorithm.com

nbqr t1t2t3
53925053010
925531724101
53242501-2
245441-29
5411-29-11
41409-1153
So our multiplicative inverse is -11 mod 53 ≡ 42
Source: ExtendedEuclideanAlgorithm.com

nbqr t1t2t3
947753119401-1
75319431711-14
194171123-14-5
171237104-539
231023-539-83
1033139-83288
3130-83288-947
So our multiplicative inverse is 288 mod 947 ≡ 288
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 ≡ 975 × 928-1 (mod 71) ≡ 975 × 57 (mod 71) ≡ 53 (mod 71)
x ≡ 736 × 925-1 (mod 53) ≡ 736 × 42 (mod 53) ≡ 13 (mod 53)
x ≡ 162 × 753-1 (mod 947) ≡ 162 × 288 (mod 947) ≡ 253 (mod 947)


Now the actual calculation

  1. Find the common modulus M
    M = m1 × m2 × ... × mk = 71 × 53 × 947 = 3563561
  2. We calculate the numbers M1 to M3
    M1=M/m1=3563561/71=50191,   M2=M/m2=3563561/53=67237,   M3=M/m3=3563561/947=3763
  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
    7150191071010
    501917170665101
    71651601-1
    6561051-111
    6511-111-12
    515011-1271
    So our multiplicative inverse is -12 mod 71 ≡ 59
    Source: ExtendedEuclideanAlgorithm.com

    nbqr t1t2t3
    5367237053010
    6723753126833101
    533312001-1
    33201131-12
    201317-12-3
    137162-35
    7611-35-8
    61605-853
    So our multiplicative inverse is -8 mod 53 ≡ 45
    Source: ExtendedEuclideanAlgorithm.com

    nbqr t1t2t3
    94737630947010
    37639473922101
    94792212501-1
    9222536221-137
    252213-137-38
    2237137-38303
    3130-38303-947
    So our multiplicative inverse is 303 mod 947 ≡ 303
    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
    =  (53 × 50191 × 59 +
       13 × 67237 × 45 +
       253 × 3763 × 303)   mod 3563561
    = 104423 (mod 3563561)


    So our answer is 104423 (mod 3563561).


Verification

So we found that x ≡ 104423
If this is correct, then the following statements (i.e. the original equations) are true:
928x (mod 71) ≡ 975 (mod 71)
925x (mod 53) ≡ 736 (mod 53)
753x (mod 947) ≡ 162 (mod 947)

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