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
994675131901-1
6753192371-13
31937823-13-25
37231143-2528
231419-2528-53
1491528-5381
9514-5381-134
541181-134215
4140-134215-994
So our multiplicative inverse is 215 mod 994 ≡ 215
Source: ExtendedEuclideanAlgorithm.com

nbqr t1t2t3
443282116101-1
28216111211-12
161121140-12-3
12140312-311
401400-311-443
So our multiplicative inverse is 11 mod 443 ≡ 11
Source: ExtendedEuclideanAlgorithm.com

nbqr t1t2t3
461256120501-1
2562051511-12
2055141-12-9
5115102-9461
So our multiplicative inverse is -9 mod 461 ≡ 452
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 ≡ 148 × 675-1 (mod 994) ≡ 148 × 215 (mod 994) ≡ 12 (mod 994)
x ≡ 854 × 282-1 (mod 443) ≡ 854 × 11 (mod 443) ≡ 91 (mod 443)
x ≡ 293 × 256-1 (mod 461) ≡ 293 × 452 (mod 461) ≡ 129 (mod 461)


Now the actual calculation

  1. Find the common modulus M
    M = m1 × m2 × ... × mk = 994 × 443 × 461 = 202997662
  2. We calculate the numbers M1 to M3
    M1=M/m1=202997662/994=204223,   M2=M/m2=202997662/443=458234,   M3=M/m3=202997662/461=440342
  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
    9942042230994010
    204223994205453101
    99445328801-2
    453885131-211
    8813610-211-68
    13101311-6879
    10331-6879-305
    313079-305994
    So our multiplicative inverse is -305 mod 994 ≡ 689
    Source: ExtendedEuclideanAlgorithm.com

    nbqr t1t2t3
    4434582340443010
    4582344431034172101
    44317229901-2
    172991731-23
    9973126-23-5
    73262213-513
    262115-513-18
    2154113-1885
    5150-1885-443
    So our multiplicative inverse is 85 mod 443 ≡ 85
    Source: ExtendedEuclideanAlgorithm.com

    nbqr t1t2t3
    4614403420461010
    44034246195587101
    4618752601-5
    8726391-516
    26928-516-37
    981116-3753
    8180-3753-461
    So our multiplicative inverse is 53 mod 461 ≡ 53
    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
    =  (12 × 204223 × 689 +
       91 × 458234 × 85 +
       129 × 440342 × 53)   mod 202997662
    = 123667528 (mod 202997662)


    So our answer is 123667528 (mod 202997662).


Verification

So we found that x ≡ 123667528
If this is correct, then the following statements (i.e. the original equations) are true:
675x (mod 994) ≡ 148 (mod 994)
282x (mod 443) ≡ 854 (mod 443)
256x (mod 461) ≡ 293 (mod 461)

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