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
58352415901-1
524598521-19
595217-19-10
527739-1079
7321-1079-168
313079-168583
So our multiplicative inverse is -168 mod 583 ≡ 415
Source: ExtendedEuclideanAlgorithm.com

nbqr t1t2t3
4638280463010
8284631365101
46336519801-1
365983711-14
9871127-14-5
71272174-514
2717110-514-19
17101714-1933
10713-1933-52
732133-52137
3130-52137-463
So our multiplicative inverse is 137 mod 463 ≡ 137
Source: ExtendedEuclideanAlgorithm.com

nbqr t1t2t3
971562140901-1
56240911531-12
4091532103-12-5
1531031502-57
1035023-57-19
5031627-19311
3211-19311-330
2120311-330971
So our multiplicative inverse is -330 mod 971 ≡ 641
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 ≡ 983 × 524-1 (mod 583) ≡ 983 × 415 (mod 583) ≡ 428 (mod 583)
x ≡ 769 × 828-1 (mod 463) ≡ 769 × 137 (mod 463) ≡ 252 (mod 463)
x ≡ 405 × 562-1 (mod 971) ≡ 405 × 641 (mod 971) ≡ 348 (mod 971)


Now the actual calculation

  1. Find the common modulus M
    M = m1 × m2 × ... × mk = 583 × 463 × 971 = 262101059
  2. We calculate the numbers M1 to M3
    M1=M/m1=262101059/583=449573,   M2=M/m2=262101059/463=566093,   M3=M/m3=262101059/971=269929
  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
    5834495730583010
    44957358377180101
    5838072301-7
    80233111-722
    231121-722-51
    11111022-51583
    So our multiplicative inverse is -51 mod 583 ≡ 532
    Source: ExtendedEuclideanAlgorithm.com

    nbqr t1t2t3
    4635660930463010
    5660934631222307101
    463307115601-1
    30715611511-12
    15615115-12-3
    15153012-392
    5150-392-463
    So our multiplicative inverse is 92 mod 463 ≡ 92
    Source: ExtendedEuclideanAlgorithm.com

    nbqr t1t2t3
    9712699290971010
    269929971277962101
    9719621901-1
    962910681-1107
    9811-1107-108
    8180107-108971
    So our multiplicative inverse is -108 mod 971 ≡ 863
    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
    =  (428 × 449573 × 532 +
       252 × 566093 × 92 +
       348 × 269929 × 863)   mod 262101059
    = 242737725 (mod 262101059)


    So our answer is 242737725 (mod 262101059).


Verification

So we found that x ≡ 242737725
If this is correct, then the following statements (i.e. the original equations) are true:
524x (mod 583) ≡ 983 (mod 583)
828x (mod 463) ≡ 769 (mod 463)
562x (mod 971) ≡ 405 (mod 971)

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