The Chinese Remainder Theorem is a tool for solving systems of linear congruences of the following form: .
Theorem 1(Chinese remainder theorem).
Let m, … , m be positive integers different from 1 and pairwise relatively prime. Then for any nonzero integers a, … , a the system of linear congruences has integer solutions, with any one of the solutions being congruent modulo (since they are relatively prime, this will simply evaluate to their product).
Proof
Let there exist a solution for the system of modular congruences
such that , , and .
-
Proof
- to prove→the system of congruences has a unique solution modulo
- here goes
- let
- let
- assertion 1→
- assertion 2→if gcd(a, b) = 1 for , there must exist which satisfy the equation
- using assertion 2, we can say that for
- the above expression is equivalent to saying *
- assertion 3→ for
- now, consider a solution for X
- if we take , all terms except will evaluate to 0 (assertion 3)
- thus,
- using *,
- thus, is the solution of the system of congruences, congruent modulo
-
Method to solve simultaneous congruences using the Chinese Remainder Theorem
- example:
- note: all variable references are taken from the proof
- first make sure that 4, 5 and 7 are relatively co-prime. Sure enough, there are. If not, try to break up the congruences.
- let’s define
- then, the solution will reduce to
- compute
- now, take on both sides to get three equations which you can use to solve for and
- on both sides:
- similarly, and
- these values for are not set in stone, different values will just result in a different solution for X
- finally, use the obtained values to solve for X
- the general solution will be , where 140 is and
- usually, the solution is presented with the lowest natural number solution as the first term. so, the finial answer for X is
- note→if you encounter something like , remember that needs to be an integer. In this case, add 7 to the LHS repeatedly until the LHS becomes divisible by the coefficient of , which is 2 here. thus,