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
5298270529010
8275291298101
529298123101-1
2982311671-12
23167330-12-7
6730272-716
30742-716-71
723116-71229
2120-71229-529
So our multiplicative inverse is 229 mod 529 ≡ 229
Source: ExtendedEuclideanAlgorithm.com

nbqr t1t2t3
5518680551010
8685511317101
551317123401-1
3172341831-12
23483268-12-5
83681152-57
681548-57-33
158177-3340
8711-3340-73
717040-73551
So our multiplicative inverse is -73 mod 551 ≡ 478
Source: ExtendedEuclideanAlgorithm.com

nbqr t1t2t3
4637260463010
7264631263101
463263120001-1
2632001631-12
20063311-12-7
6311582-737
11813-737-44
832237-44125
3211-44125-169
2120125-169463
So our multiplicative inverse is -169 mod 463 ≡ 294
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 ≡ 757 × 827-1 (mod 529) ≡ 757 × 229 (mod 529) ≡ 370 (mod 529)
x ≡ 901 × 868-1 (mod 551) ≡ 901 × 478 (mod 551) ≡ 347 (mod 551)
x ≡ 21 × 726-1 (mod 463) ≡ 21 × 294 (mod 463) ≡ 155 (mod 463)


Now the actual calculation

  1. Find the common modulus M
    M = m1 × m2 × ... × mk = 529 × 551 × 463 = 134954777
  2. We calculate the numbers M1 to M3
    M1=M/m1=134954777/529=255113,   M2=M/m2=134954777/551=244927,   M3=M/m3=134954777/463=291479
  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
    5292551130529010
    255113529482135101
    529135312401-3
    1351241111-34
    12411113-34-47
    113324-47145
    3211-47145-192
    2120145-192529
    So our multiplicative inverse is -192 mod 529 ≡ 337
    Source: ExtendedEuclideanAlgorithm.com

    nbqr t1t2t3
    5512449270551010
    244927551444283101
    551283126801-1
    2832681151-12
    268151713-12-35
    1513122-3537
    13261-3537-257
    212037-257551
    So our multiplicative inverse is -257 mod 551 ≡ 294
    Source: ExtendedEuclideanAlgorithm.com

    nbqr t1t2t3
    4632914790463010
    291479463629252101
    463252121101-1
    2522111411-12
    2114156-12-11
    416652-1168
    6511-1168-79
    515068-79463
    So our multiplicative inverse is -79 mod 463 ≡ 384
    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
    =  (370 × 255113 × 337 +
       347 × 244927 × 294 +
       155 × 291479 × 384)   mod 134954777
    = 55660163 (mod 134954777)


    So our answer is 55660163 (mod 134954777).


Verification

So we found that x ≡ 55660163
If this is correct, then the following statements (i.e. the original equations) are true:
827x (mod 529) ≡ 757 (mod 529)
868x (mod 551) ≡ 901 (mod 551)
726x (mod 463) ≡ 21 (mod 463)

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