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
4615482901-8
54291251-89
292514-89-17
254619-17111
4140-17111-461
So our multiplicative inverse is 111 mod 461 ≡ 111
Source: ExtendedEuclideanAlgorithm.com

nbqr t1t2t3
82339024301-2
39043931-219
433141-219-268
313019-268823
So our multiplicative inverse is -268 mod 823 ≡ 555
Source: ExtendedEuclideanAlgorithm.com

nbqr t1t2t3
75735212201-21
35221131-2122
221319-2122-43
1391422-4365
9421-4365-173
414065-173757
So our multiplicative inverse is -173 mod 757 ≡ 584
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 ≡ 185 × 54-1 (mod 461) ≡ 185 × 111 (mod 461) ≡ 251 (mod 461)
x ≡ 334 × 390-1 (mod 823) ≡ 334 × 555 (mod 823) ≡ 195 (mod 823)
x ≡ 587 × 35-1 (mod 757) ≡ 587 × 584 (mod 757) ≡ 644 (mod 757)


Now the actual calculation

  1. Find the common modulus M
    M = m1 × m2 × ... × mk = 461 × 823 × 757 = 287208071
  2. We calculate the numbers M1 to M3
    M1=M/m1=287208071/461=623011,   M2=M/m2=287208071/823=348977,   M3=M/m3=287208071/757=379403
  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
    4616230110461010
    6230114611351200101
    46120026101-2
    200613171-27
    6117310-27-23
    1710177-2330
    10713-2330-53
    732130-53136
    3130-53136-461
    So our multiplicative inverse is 136 mod 461 ≡ 136
    Source: ExtendedEuclideanAlgorithm.com

    nbqr t1t2t3
    8233489770823010
    34897782342425101
    82325322301-32
    2523121-3233
    232111-3233-395
    212033-395823
    So our multiplicative inverse is -395 mod 823 ≡ 428
    Source: ExtendedEuclideanAlgorithm.com

    nbqr t1t2t3
    7573794030757010
    379403757501146101
    75714652701-5
    146275111-526
    271125-526-57
    1152126-57140
    5150-57140-757
    So our multiplicative inverse is 140 mod 757 ≡ 140
    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
    =  (251 × 623011 × 136 +
       195 × 348977 × 428 +
       644 × 379403 × 140)   mod 287208071
    = 160525522 (mod 287208071)


    So our answer is 160525522 (mod 287208071).


Verification

So we found that x ≡ 160525522
If this is correct, then the following statements (i.e. the original equations) are true:
54x (mod 461) ≡ 185 (mod 461)
390x (mod 823) ≡ 334 (mod 823)
35x (mod 757) ≡ 587 (mod 757)

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