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
53316533801-3
165384131-313
3813212-313-29
13121113-2942
121120-2942-533
So our multiplicative inverse is 42 mod 533 ≡ 42
Source: ExtendedEuclideanAlgorithm.com

nbqr t1t2t3
3314550331010
4553311124101
33112428301-2
124831411-23
834121-23-8
4114103-8331
So our multiplicative inverse is -8 mod 331 ≡ 323
Source: ExtendedEuclideanAlgorithm.com

nbqr t1t2t3
73741174001-17
4140111-1718
401400-1718-737
So our multiplicative inverse is 18 mod 737 ≡ 18
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 ≡ 969 × 165-1 (mod 533) ≡ 969 × 42 (mod 533) ≡ 190 (mod 533)
x ≡ 211 × 455-1 (mod 331) ≡ 211 × 323 (mod 331) ≡ 298 (mod 331)
x ≡ 303 × 41-1 (mod 737) ≡ 303 × 18 (mod 737) ≡ 295 (mod 737)


Now the actual calculation

  1. Find the common modulus M
    M = m1 × m2 × ... × mk = 533 × 331 × 737 = 130023751
  2. We calculate the numbers M1 to M3
    M1=M/m1=130023751/533=243947,   M2=M/m2=130023751/331=392821,   M3=M/m3=130023751/737=176423
  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
    5332439470533010
    243947533457366101
    533366116701-1
    3661672321-13
    1673257-13-16
    327443-1667
    7413-1667-83
    431167-83150
    3130-83150-533
    So our multiplicative inverse is 150 mod 533 ≡ 150
    Source: ExtendedEuclideanAlgorithm.com

    nbqr t1t2t3
    3313928210331010
    3928213311186255101
    33125517601-1
    255763271-14
    7627222-14-9
    2722154-913
    22542-913-61
    522113-61135
    2120-61135-331
    So our multiplicative inverse is 135 mod 331 ≡ 135
    Source: ExtendedEuclideanAlgorithm.com

    nbqr t1t2t3
    7371764230737010
    176423737239280101
    737280217701-2
    28017711031-23
    177103174-23-5
    103741293-58
    7429216-58-21
    29161138-2129
    161313-2129-50
    1334129-50229
    3130-50229-737
    So our multiplicative inverse is 229 mod 737 ≡ 229
    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
    =  (190 × 243947 × 150 +
       298 × 392821 × 135 +
       295 × 176423 × 229)   mod 130023751
    = 87616329 (mod 130023751)


    So our answer is 87616329 (mod 130023751).


Verification

So we found that x ≡ 87616329
If this is correct, then the following statements (i.e. the original equations) are true:
165x (mod 533) ≡ 969 (mod 533)
455x (mod 331) ≡ 211 (mod 331)
41x (mod 737) ≡ 303 (mod 737)

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