Table of Contents

Last modified on February 15th, 2024

The Chinese remainder theorem is used to get a unique solution for an arbitrary finite number of congruences with coprime moduli, which states that:

If M = m_{1}, m_{2}, â€¦, m_{r} is a set of pairwise relatively prime non-zero integers such that gcd(m_{i}, m_{j}) = 1 for i â‰ j, and a_{1}, a_{2}, â€¦, a_{r} Ð„ â„¤, then the system of congruences x â‰¡ a_{1} (mod m_{1}), x â‰¡ a_{2} (mod m_{2}), â€¦, x â‰¡ a_{r} (mod m_{r}) has a unique solution in modulo M for all 1â‰¤ i â‰¤ r.

It is applied in all areas of mathematics, especially in computer science, including internet cryptography, where it is used to encode numbers based on it.

Now, let us first verify if the theorem is true for a pair of congruences.

It states that if m and n are two coprime numbers, the pair of congruences x â‰¡ a (mod m) and x â‰¡ b (mod n) has a unique solution for x modulo mn, âˆ€ a, b Ð„ â„¤.

Here, we show that there is always a solution for x modulo mn, and then we verify that the solution is unique in modulo mn.

**Verifying the Existence of Solution **

The first congruence is written as

x â‰¡ a (mod m) â‡’ x = a + mp, for some p Ð„ â„¤ â€¦..(i)

Using (i), we get the second congruence as x â‰¡ b (mod n)

â‡’ a + mp â‰¡ b (mod n)

On subtracting a from both sides, we get

â‡’ mp â‰¡ b – a (mod n) â€¦..(ii)

Since m and n are coprime numbers, gcd(m, n) = 1

Also, we know m (mod n) is invertible. Let mâ€™ be the inverse of m (mod n), which means mmâ€™ â‰¡ 1 (mod n)

On multiplying (ii) by mâ€™, we get

mmâ€™p â‰¡ mâ€™(b – a) (mod n) â‡’ p = mâ€™(b – a) + nq, for some q Ð„ â„¤

â‡’ x = a + mp = a + mmâ€™(b – a) + mnq

Thus, if x satisfies the given pair of congruences, it must hold the above form.

Now, let us verify this expression for every q Ð„ â„¤, which satisfies the given pair of congruences a + mmâ€™(b – a) + mnq â‰¡ a + 0 + 0 â‰¡ a (mod m) and a + mmâ€™(b – a) + mnq â‰¡ a + 1(b – a) + 0 â‰¡ b (mod n)

**Verifying the Uniqueness of Solution**

Assuming the solution is not unique, if x = c and x = câ€™ both satisfy x â‰¡ a (mod m) and x â‰¡ b (mod n), then we have c â‰¡ câ€™ (mod m) and c â‰¡ câ€™ (mod n).

Thus, m | (c âˆ’ câ€™) and n | (c âˆ’ câ€™).

Since gcd(m, n) = 1, the product mn divides (c âˆ’ câ€™), which means c â‰¡ câ€™ (mod mn).

This shows that all solutions to the given pair of congruences are the same in modulo mn, and thus, the solution is unique.

Now, let us verify the Chinese remainder theorem for a system of congruences.

To prove the theorem, first, we verify that there is always a solution for x modulo m_{i}, and then, if the solution is unique in modulo m_{i} for all 1â‰¤ i â‰¤ r.

Here, we prove the existence of the solution using the mathematical induction.

We have already proved the base step for r = 2

Now, let us assume all simultaneous congruences with r pairwise relatively prime moduli in the inductive part for which the statement is true.

Considering a system of simultaneous congruences with r + 1 pairwise relatively prime moduli, we get:

x â‰¡ a_{1} (mod m_{1}), â€¦, x â‰¡ a_{r} (mod m_{r}), x â‰¡ a_{r+1} (mod m_{r+1}), where (m_{i}, m_{j}) = 1 for all i â‰ j, and all the a_{i}â€™s are arbitrary.

By the inductive hypothesis, there is a solution b to the first r congruences, say b â‰¡ a_{1} (mod m_{1}), b â‰¡ a_{2} (mod m_{2}), â€¦, b â‰¡ a_{r} (mod m_{r}).

Now, from the system of two congruences, we get

x â‰¡ b (mod m_{1}m_{2} â€¦ m_{r}) and x â‰¡ a_{r + 1} (mod m_{r + 1})

â‡’ x â‰¡ b (mod M) and x â‰¡ a_{r + 1} (mod m_{r + 1}) â€¦..(iii)

Since (m_{r}, m_{r + 1}) = 1 for i = 1, 2, â€¦, r, we have gcd(m_{1}m_{2} â€¦ m_{r}, m_{r + 1}) = 1, and the two moduli in (iii) are relatively prime.

As we know, in the case of two congruences, there is always a solution to (iii), say c.

Since c â‰¡ b (mod m_{1}m_{2} â€¦ m_{r}), we have c â‰¡ b (mod M) for i = 1, 2, . . . , r.

For any value of b, we have b â‰¡ a_{i} (mod M) for i = 1, 2, â€¦, r.

Thus, c â‰¡ a_{i} (mod M) for i = 1, 2, â€¦, r. Also, c â‰¡ a_{r + 1} (mod m_{r + 1}).

For any value of c, we observe that c satisfies r + 1 given congruences. This concludes the inductive step, which indicates a solution exists for x modulo m_{i} (1â‰¤ i â‰¤ r).

Assuming the solution is not unique, if x = c and x = câ€™ both satisfy x â‰¡ a_{1} (mod m_{1}), x â‰¡ a_{2} (mod m_{2}), â€¦, x â‰¡ a_{r} (mod m_{r}), then we have c â‰¡ câ€™ (mod m_{i}) for i = 1, 2, â€¦, r

Thus, m_{i} | (c âˆ’ câ€™) for i = 1, 2, â€¦, r

Since all the m_{i}â€™s are pairwise relatively prime, their product m_{1}m_{2} â€¦m_{r} divides (c âˆ’ câ€™), which means c â‰¡ câ€™ (mod m_{1}m_{2} â€¦m_{r}) â‡’ c â‰¡ câ€™ (mod M).

This shows all solutions to the given system of congruences are the same when determined by modulo m_{1}m_{2} â€¦m_{r }(that is, modulo M).

Thus, the Chinese remainder theorem is verified.

The solution to a system of congruences using the Chinese remainder theorem is found by the formula:

x â‰¡ ${\sum ^{r}_{i=1}a_{i}M_{i}x_{i}\left( modM\right)}$

Here,

- ${M_{i}=\dfrac{M}{m_{i}}}$
- x
_{i}is the modular inverse of M_{i}, modulo m_{i}

**Find the set of solutions for x â‰¡ 2 (mod 6) and x â‰¡ 1 (mod 7).**

Solution:

Here, the given pair of congruences are x â‰¡ 2 (mod 6) and x â‰¡ 1 (mod 7).

Simplifying the given pair of congruences, we get x = 2 +6p = 1 + 7q, where p, q Ð„ â„¤.

It provides a clear solution of p and q, that is, p = 1 and q = 1.Â

Thus, one solution to the system is x = 8

Â â‡’ x â‰¡ 8 (mod 42) is the set of all solutions.

**Use the Chinese Remainder Theorem to find the value of x such that:Â ****x â‰¡ 3 (mod 5)Â ****x â‰¡ 2 (mod 7)Â ****x â‰¡ 5 (mod 9)**

Solution:

Calculating M = 5 Ã— 7 Ã— 9 = 315

Calculating all the M_{i}, we getÂ

M_{1} = ${\dfrac{315}{5}}$ = 63Â

M_{2} = ${\dfrac{315}{7}}$ = 45

M_{3} = ${\dfrac{315}{9}}$ = 35

Now, we find modular inverses, as shown:

x_{1} â‰¡ 63^{-1} (mod 5)Â

Since 63 â‰¡ 3 (mod 5), thus, 3x_{1} â‰¡ 1 (mod 5) â‡’ x_{1} â‰¡ 2 (mod 5)

x_{2} â‰¡ 45^{-1} (mod 7)Â

Since 45 â‰¡ 3 (mod 7), thus 3x_{2} â‰¡ 1 (mod 7) â‡’ x_{2} â‰¡ 5 (mod 7)

x_{3} â‰¡ 35^{-1} (mod 9)

Since 35 â‰¡ 8 (mod 9), thus 8x_{3} â‰¡ 1 (mod 9) â‡’ x_{3} â‰¡ 8 (mod 9)

Now, substituting the values in the formula:

x â‰¡ (3 Ã— 63 Ã— 2 + 2 Ã— 45 Ã— 5 + 5 Ã— 35 Ã— 8) (mod 315)

â‡’ x â‰¡ (378 + 450 + 1400) (mod 315)

â‡’ x â‰¡ 2228 (mod 315)

To find the smallest positive solution, we consider x â‰¡ 2228 â‰¡ 23 (mod 315)

Thus, the solution to the system of congruences is x â‰¡ 23 (mod 315).