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
68358619701-1
58697641-17
974241-17-169
41407-169683
So our multiplicative inverse is -169 mod 683 ≡ 514
Source: ExtendedEuclideanAlgorithm.com

nbqr t1t2t3
7178560717010
8567171139101
71713952201-5
13922671-531
22731-531-98
717031-98717
So our multiplicative inverse is -98 mod 717 ≡ 619
Source: ExtendedEuclideanAlgorithm.com

nbqr t1t2t3
19983019010
983195114101
19141501-1
145241-13
5411-13-4
41403-419
So our multiplicative inverse is -4 mod 19 ≡ 15
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 ≡ 813 × 586-1 (mod 683) ≡ 813 × 514 (mod 683) ≡ 569 (mod 683)
x ≡ 134 × 856-1 (mod 717) ≡ 134 × 619 (mod 717) ≡ 491 (mod 717)
x ≡ 626 × 983-1 (mod 19) ≡ 626 × 15 (mod 19) ≡ 4 (mod 19)


Now the actual calculation

  1. Find the common modulus M
    M = m1 × m2 × ... × mk = 683 × 717 × 19 = 9304509
  2. We calculate the numbers M1 to M3
    M1=M/m1=9304509/683=13623,   M2=M/m2=9304509/717=12977,   M3=M/m3=9304509/19=489711
  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
    683136230683010
    1362368319646101
    68364613701-1
    6463717171-118
    371723-118-37
    1735218-37203
    3211-37203-240
    2120203-240683
    So our multiplicative inverse is -240 mod 683 ≡ 443
    Source: ExtendedEuclideanAlgorithm.com

    nbqr t1t2t3
    717129770717010
    129777171871101
    7177110701-10
    7171011-10101
    7170-10101-717
    So our multiplicative inverse is 101 mod 717 ≡ 101
    Source: ExtendedEuclideanAlgorithm.com

    nbqr t1t2t3
    19489711019010
    48971119257745101
    1953401-3
    54111-34
    4140-34-19
    So our multiplicative inverse is 4 mod 19 ≡ 4
    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
    =  (569 × 13623 × 443 +
       491 × 12977 × 101 +
       4 × 489711 × 4)   mod 9304509
    = 607073 (mod 9304509)


    So our answer is 607073 (mod 9304509).


Verification

So we found that x ≡ 607073
If this is correct, then the following statements (i.e. the original equations) are true:
586x (mod 683) ≡ 813 (mod 683)
856x (mod 717) ≡ 134 (mod 717)
983x (mod 19) ≡ 626 (mod 19)

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