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
7098682101-8
8621421-833
212101-833-338
212033-338709
So our multiplicative inverse is -338 mod 709 ≡ 371
Source: ExtendedEuclideanAlgorithm.com

nbqr t1t2t3
919160511901-5
1601191411-56
11941237-56-17
4137146-1723
37491-1723-224
414023-224919
So our multiplicative inverse is -224 mod 919 ≡ 695
Source: ExtendedEuclideanAlgorithm.com

nbqr t1t2t3
6079730607010
9736071366101
607366124101-1
36624111251-12
2411251116-12-3
125116192-35
1169128-35-63
98115-6368
8180-6368-607
So our multiplicative inverse is 68 mod 607 ≡ 68
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 ≡ 28 × 86-1 (mod 709) ≡ 28 × 371 (mod 709) ≡ 462 (mod 709)
x ≡ 757 × 160-1 (mod 919) ≡ 757 × 695 (mod 919) ≡ 447 (mod 919)
x ≡ 201 × 973-1 (mod 607) ≡ 201 × 68 (mod 607) ≡ 314 (mod 607)


Now the actual calculation

  1. Find the common modulus M
    M = m1 × m2 × ... × mk = 709 × 919 × 607 = 395503597
  2. We calculate the numbers M1 to M3
    M1=M/m1=395503597/709=557833,   M2=M/m2=395503597/919=430363,   M3=M/m3=395503597/607=651571
  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
    7095578330709010
    557833709786559101
    709559115001-1
    55915031091-14
    150109141-14-5
    109412274-514
    4127114-514-19
    271411314-1933
    141311-1933-52
    13113033-52709
    So our multiplicative inverse is -52 mod 709 ≡ 657
    Source: ExtendedEuclideanAlgorithm.com

    nbqr t1t2t3
    9194303630919010
    430363919468271101
    919271310601-3
    2711062591-37
    10659147-37-10
    59471127-1017
    4712311-1017-61
    12111117-6178
    111110-6178-919
    So our multiplicative inverse is 78 mod 919 ≡ 78
    Source: ExtendedEuclideanAlgorithm.com

    nbqr t1t2t3
    6076515710607010
    6515716071073260101
    60726028701-2
    260872861-25
    878611-25-7
    8618605-7607
    So our multiplicative inverse is -7 mod 607 ≡ 600
    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
    =  (462 × 557833 × 657 +
       447 × 430363 × 78 +
       314 × 651571 × 600)   mod 395503597
    = 171503308 (mod 395503597)


    So our answer is 171503308 (mod 395503597).


Verification

So we found that x ≡ 171503308
If this is correct, then the following statements (i.e. the original equations) are true:
86x (mod 709) ≡ 28 (mod 709)
160x (mod 919) ≡ 757 (mod 919)
973x (mod 607) ≡ 201 (mod 607)

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