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
77553143301-14
53331201-1415
3320113-1415-29
20131715-2944
13716-2944-73
761144-73117
6160-73117-775
So our multiplicative inverse is 117 mod 775 ≡ 117
Source: ExtendedEuclideanAlgorithm.com

nbqr t1t2t3
2024470202010
447202243101
2024343001-4
43301131-45
301324-45-14
134315-1447
4140-1447-202
So our multiplicative inverse is 47 mod 202 ≡ 47
Source: ExtendedEuclideanAlgorithm.com

nbqr t1t2t3
74333128101-2
33181471-29
817114-29-101
74139-101110
4311-101110-211
3130110-211743
So our multiplicative inverse is -211 mod 743 ≡ 532
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 ≡ 617 × 53-1 (mod 775) ≡ 617 × 117 (mod 775) ≡ 114 (mod 775)
x ≡ 253 × 447-1 (mod 202) ≡ 253 × 47 (mod 202) ≡ 175 (mod 202)
x ≡ 256 × 331-1 (mod 743) ≡ 256 × 532 (mod 743) ≡ 223 (mod 743)


Now the actual calculation

  1. Find the common modulus M
    M = m1 × m2 × ... × mk = 775 × 202 × 743 = 116316650
  2. We calculate the numbers M1 to M3
    M1=M/m1=116316650/775=150086,   M2=M/m2=116316650/202=575825,   M3=M/m3=116316650/743=156550
  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
    7751500860775010
    150086775193511101
    775511126401-1
    51126412471-12
    264247117-12-3
    247171492-344
    17918-344-47
    981144-4791
    8180-4791-775
    So our multiplicative inverse is 91 mod 775 ≡ 91
    Source: ExtendedEuclideanAlgorithm.com

    nbqr t1t2t3
    2025758250202010
    5758252022850125101
    20212517701-1
    125771481-12
    7748129-12-3
    48291192-35
    2919110-35-8
    1910195-813
    10911-813-21
    919013-21202
    So our multiplicative inverse is -21 mod 202 ≡ 181
    Source: ExtendedEuclideanAlgorithm.com

    nbqr t1t2t3
    7431565500743010
    156550743210520101
    743520122301-1
    5202232741-13
    2237431-13-10
    7417403-10743
    So our multiplicative inverse is -10 mod 743 ≡ 733
    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
    =  (114 × 150086 × 91 +
       175 × 575825 × 181 +
       223 × 156550 × 733)   mod 116316650
    = 22261989 (mod 116316650)


    So our answer is 22261989 (mod 116316650).


Verification

So we found that x ≡ 22261989
If this is correct, then the following statements (i.e. the original equations) are true:
53x (mod 775) ≡ 617 (mod 775)
447x (mod 202) ≡ 253 (mod 202)
331x (mod 743) ≡ 256 (mod 743)

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