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
71165915201-1
6595212351-113
5235117-113-14
35172113-1441
171170-1441-711
So our multiplicative inverse is 41 mod 711 ≡ 41
Source: ExtendedEuclideanAlgorithm.com

nbqr t1t2t3
535668701-8
667931-873
7321-873-154
313073-154535
So our multiplicative inverse is -154 mod 535 ≡ 381
Source: ExtendedEuclideanAlgorithm.com

nbqr t1t2t3
961729123201-1
7292323331-14
2323371-14-29
3313304-29961
So our multiplicative inverse is -29 mod 961 ≡ 932
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 ≡ 533 × 659-1 (mod 711) ≡ 533 × 41 (mod 711) ≡ 523 (mod 711)
x ≡ 130 × 66-1 (mod 535) ≡ 130 × 381 (mod 535) ≡ 310 (mod 535)
x ≡ 762 × 729-1 (mod 961) ≡ 762 × 932 (mod 961) ≡ 5 (mod 961)


Now the actual calculation

  1. Find the common modulus M
    M = m1 × m2 × ... × mk = 711 × 535 × 961 = 365549985
  2. We calculate the numbers M1 to M3
    M1=M/m1=365549985/711=514135,   M2=M/m2=365549985/535=683271,   M3=M/m3=365549985/961=380385
  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
    7115141350711010
    51413571172382101
    7118285501-8
    82551271-89
    552721-89-26
    2712709-26711
    So our multiplicative inverse is -26 mod 711 ≡ 685
    Source: ExtendedEuclideanAlgorithm.com

    nbqr t1t2t3
    5356832710535010
    683271535127776101
    535767301-7
    7632511-7176
    3130-7176-535
    So our multiplicative inverse is 176 mod 535 ≡ 176
    Source: ExtendedEuclideanAlgorithm.com

    nbqr t1t2t3
    9613803850961010
    380385961395790101
    961790117101-1
    79017141061-15
    171106165-15-6
    106651415-611
    6541124-611-17
    412411711-1728
    241717-1728-45
    1772328-45118
    7321-45118-281
    3130118-281961
    So our multiplicative inverse is -281 mod 961 ≡ 680
    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
    =  (523 × 514135 × 685 +
       310 × 683271 × 176 +
       5 × 380385 × 680)   mod 365549985
    = 144068320 (mod 365549985)


    So our answer is 144068320 (mod 365549985).


Verification

So we found that x ≡ 144068320
If this is correct, then the following statements (i.e. the original equations) are true:
659x (mod 711) ≡ 533 (mod 711)
66x (mod 535) ≡ 130 (mod 535)
729x (mod 961) ≡ 762 (mod 961)

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