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
3619780361010
9783612256101
361256110501-1
2561052461-13
10546213-13-7
4613373-724
13716-724-31
761124-3155
6160-3155-361
So our multiplicative inverse is 55 mod 361 ≡ 55
Source: ExtendedEuclideanAlgorithm.com

nbqr t1t2t3
82936929101-2
36991451-29
915181-29-164
51509-164829
So our multiplicative inverse is -164 mod 829 ≡ 665
Source: ExtendedEuclideanAlgorithm.com

nbqr t1t2t3
49557049010
557491118101
491821301-2
1813151-23
13523-23-8
53123-811
3211-811-19
212011-1949
So our multiplicative inverse is -19 mod 49 ≡ 30
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 ≡ 819 × 978-1 (mod 361) ≡ 819 × 55 (mod 361) ≡ 281 (mod 361)
x ≡ 784 × 369-1 (mod 829) ≡ 784 × 665 (mod 829) ≡ 748 (mod 829)
x ≡ 419 × 557-1 (mod 49) ≡ 419 × 30 (mod 49) ≡ 26 (mod 49)


Now the actual calculation

  1. Find the common modulus M
    M = m1 × m2 × ... × mk = 361 × 829 × 49 = 14664181
  2. We calculate the numbers M1 to M3
    M1=M/m1=14664181/361=40621,   M2=M/m2=14664181/829=17689,   M3=M/m3=14664181/49=299269
  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
    361406210361010
    40621361112189101
    361189117201-1
    1891721171-12
    17217102-12-21
    172812-21170
    2120-21170-361
    So our multiplicative inverse is 170 mod 361 ≡ 170
    Source: ExtendedEuclideanAlgorithm.com

    nbqr t1t2t3
    829176890829010
    1768982921280101
    829280226901-2
    2802691111-23
    26911245-23-74
    115213-74151
    5150-74151-829
    So our multiplicative inverse is 151 mod 829 ≡ 151
    Source: ExtendedEuclideanAlgorithm.com

    nbqr t1t2t3
    49299269049010
    29926949610726101
    492612301-1
    2623131-12
    23372-12-15
    32112-1517
    2120-1517-49
    So our multiplicative inverse is 17 mod 49 ≡ 17
    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
    =  (281 × 40621 × 170 +
       748 × 17689 × 151 +
       26 × 299269 × 17)   mod 14664181
    = 8701103 (mod 14664181)


    So our answer is 8701103 (mod 14664181).


Verification

So we found that x ≡ 8701103
If this is correct, then the following statements (i.e. the original equations) are true:
978x (mod 361) ≡ 819 (mod 361)
369x (mod 829) ≡ 784 (mod 829)
557x (mod 49) ≡ 419 (mod 49)

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