# Welcome to ChineseRemainderTheorem.com!

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?**

- Read about how to execute the Chinese Remainder Theorem
- Discover different ways to calculate multiplicative inverses

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:

n | b | q | r | t1 | t2 | t3 |
---|---|---|---|---|---|---|

448 | 895 | 0 | 448 | 0 | 1 | 0 |

895 | 448 | 1 | 447 | 1 | 0 | 1 |

448 | 447 | 1 | 1 | 0 | 1 | -1 |

447 | 1 | 447 | 0 | 1 | -1 | 448 |

*Source: ExtendedEuclideanAlgorithm.com*

n | b | q | r | t1 | t2 | t3 |
---|---|---|---|---|---|---|

425 | 907 | 0 | 425 | 0 | 1 | 0 |

907 | 425 | 2 | 57 | 1 | 0 | 1 |

425 | 57 | 7 | 26 | 0 | 1 | -7 |

57 | 26 | 2 | 5 | 1 | -7 | 15 |

26 | 5 | 5 | 1 | -7 | 15 | -82 |

5 | 1 | 5 | 0 | 15 | -82 | 425 |

*Source: ExtendedEuclideanAlgorithm.com*

n | b | q | r | t1 | t2 | t3 |
---|---|---|---|---|---|---|

467 | 681 | 0 | 467 | 0 | 1 | 0 |

681 | 467 | 1 | 214 | 1 | 0 | 1 |

467 | 214 | 2 | 39 | 0 | 1 | -2 |

214 | 39 | 5 | 19 | 1 | -2 | 11 |

39 | 19 | 2 | 1 | -2 | 11 | -24 |

19 | 1 | 19 | 0 | 11 | -24 | 467 |

*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 ≡ 183 × 895`

^{-1} (mod 448) ≡ 183 × 447 (mod 448) ≡ 265 (mod 448)`x ≡ 62 × 907`

^{-1} (mod 425) ≡ 62 × 343 (mod 425) ≡ 16 (mod 425)`x ≡ 527 × 681`

^{-1} (mod 467) ≡ 527 × 443 (mod 467) ≡ 428 (mod 467)

**New equations**

So now we have the following equations of the form x ≡ a (mod m):

x ≡ 265 (mod 448)

x ≡ 16 (mod 425)

x ≡ 428 (mod 467)

Now the actual calculation

**Find the common modulus M**

`M = m`

_{1}× m_{2}× ... × m_{k}= 448 × 425 × 467 = 88916800**We calculate the numbers M**_{1}to M_{3}

`M`

,_{1}=M/m_{1}=88916800/448=198475`M`

,_{2}=M/m_{2}=88916800/425=209216`M`

_{3}=M/m_{3}=88916800/467=190400**We now calculate the modular multiplicative inverses M**_{1}^{-1}to M_{3}^{-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:

n b q r t1 t2 t3 448 198475 0 448 0 1 0 198475 448 443 11 1 0 1 448 11 40 8 0 1 -40 11 8 1 3 1 -40 41 8 3 2 2 -40 41 -122 3 2 1 1 41 -122 163 2 1 2 0 -122 163 -448 *Source: ExtendedEuclideanAlgorithm.com*

n b q r t1 t2 t3 425 209216 0 425 0 1 0 209216 425 492 116 1 0 1 425 116 3 77 0 1 -3 116 77 1 39 1 -3 4 77 39 1 38 -3 4 -7 39 38 1 1 4 -7 11 38 1 38 0 -7 11 -425 *Source: ExtendedEuclideanAlgorithm.com*

n b q r t1 t2 t3 467 190400 0 467 0 1 0 190400 467 407 331 1 0 1 467 331 1 136 0 1 -1 331 136 2 59 1 -1 3 136 59 2 18 -1 3 -7 59 18 3 5 3 -7 24 18 5 3 3 -7 24 -79 5 3 1 2 24 -79 103 3 2 1 1 -79 103 -182 2 1 2 0 103 -182 467 *Source: ExtendedEuclideanAlgorithm.com*

**Now we can calculate x with the equation we saw earlier**

`x = (a`

_{1}× M_{1}× M_{1}^{-1}+ a_{2}× M_{2}× M_{2}^{-1}+ ... + a_{k}× M_{k}× M_{k}^{-1})**mod M**

`= (265 × 198475 × 163 +`

16 × 209216 × 11 +

428 × 190400 × 285)**mod 88916800**

= 2727241 (mod 88916800)

So our answer is 2727241 (mod 88916800).

Verification

So we found that `x ≡ 2727241`

If this is correct, then the following statements (i.e. the original equations) are true:

895x (mod 448) ≡ 183 (mod 448)

907x (mod 425) ≡ 62 (mod 425)

681x (mod 467) ≡ 527 (mod 467)

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