Chinese Remainder Theorem
Chinese Remainder Theorem is a mathematical principle that solves systems of modular equations by finding a unique solution from the remainder of the division. It is used in cryptography and computer science for efficient computation.
According to the Theorem, if in a given set of equations, each equation has a different number (say, n1, n2, ..., nk), and these numbers are all relatively prime to each other, and also have some numbers (say, a1, a2,..., ak), then there is a unique solution (let's call it x) that satisfies all the equations at once.
This solution is found modulo the product of all the numbers (N = n1 · n2 ·...· nk). Therefore, x satisfies each equation by leaving the same remainder when divided by its corresponding number (ni) as the given number (ai).
In simpler terms, the theorem states:
"If a number is divided by several other numbers that have no common factors, one can find the remainder when dividing by the product of those numbers."
The solution is unique modulo N, meaning any other solution is congruent to the original one modulo N.
History of the Chinese Remainder Theorem
The Chinese Remainder Theorem (CRT) is an ancient result in number theory and modular arithmetic, first documented in the 3rd to 5th century AD in the "Sunzi Suanjing" (Sunzi's Mathematical Manual). The theorem was used by the Chinese mathematician Sunzi (or Sun Tzu), who is credited with its earliest known use. It was later expanded by Qin Jiushao. Sunzi, renowned for his military strategies, was one of the first to apply practical thinking to mathematical problems.
Statement of Chinese Remainder Theorem
The Chinese Remainder Theorem states that a system of simultaneous congruences, defined by pairwise coprime positive integers (n1, n2,...., nk ) and arbitrary integers (a1, a2,...., ak ) such as:
x ≡ a1 (mod n1)
x ≡ a2 (mod n2)
⦙
x ≡ ak (mod nk)
there exists a unique solution x modulo (N = n1 n2 .... nk) that satisfies all the congrunces simultaneously.
Chinese Remainder Theorem Proof
To prove Chinese remainder theorem, let us find an integer (x) that satisfies: x ≡ ai (mod ni) for each (i = 1, 2,...., k).
We define (Ni = N/ni).
Since (ni) and (Ni) are coprime, according to Bézout's identity, there are integers (si) and (ti) such that:
si·ni + ti·Ni = 1
We set (yi = ti·Ni)
Now, let's construct (x) as follows,
x =
This solution satisfies all the congruences, i.e., x ≡ ai (mod ni) for each (i). To see this, observe:
x ≡ ai·yi ≡ ai·ti·Ni ≡ ai·1 ≡ ai
Thus, (x) is a solution to the system of congruences.
Uniqueness:
Suppose (x) and (x') are two solutions to the system of congruences. We aim to show that (x ≡ x' (mod N).
Let (m = x' - x). Since both (x) and (x') satisfy all the congruences, (m) must also satisfy them. Therefore, (m) is divisible by each of the moduli (n1, n2,...., nk).
By definition, (N = n1 · n2 ·....· nk). As (m) is divisible by each (ni), it is also divisible by (N), i.e., m ≡ 0 (mod N).
Hence, x ≡ x' (mod N, establishing uniqueness).
Necessary Condition for Chinese Remainder Theorem
For the Chinese Remainder Theorem to work, the numbers we are dividing by must not have any common factors. So, if there are two numbers that are being divided by, say (mi) and (mj), then they can not common factors other than 1. That means their biggest shared factor, called the greatest common divisor is 1.
GCD(mi, mj) = 1
This condition ensures that the system of congruences is consistent and that the solution provided by the Chinese Remainder Theorem is unique modulo the product of the moduli. If the moduli are not pairwise coprime, then the theorem may not yield a solution, or the solution may not be unique. Therefore, pairwise coprimality is a fundamental requirement for the application of the Chinese Remainder Theorem.
Chinese Remainder Theorem Solution for Two Moduli
Chinese Remainder Theorem provides a solution for systems of congruences involving two moduli. Given two pairwise coprime moduli (m1) and (m2), and their respective residues (a1) and (a2), the theorem states that there exists a unique solution modulo (m1 × m2) for the system of congruences:
x ≠ a1 mod m1
x ≠ a2 mod m2
The solution can be found using the formula:
Where (m1-1) denotes the modular multiplicative inverse of (m1) modulo (m2). This inverse can be found using methods such as the Extended Euclidean Algorithm.
Chinese Remainder Theorem Solution for General Case
Chinese Remainder Theorem (CRT) provides a solution for a system of congruences with arbitrary moduli. Suppose we have a system of congruences:
⁞
Where (m1, m2, ..., mn) are pairwise coprime moduli and (a1, a2, ..., an) are the corresponding residues.
CRT states that there exists a unique solution modulo (M = m1 × m2 × ... × mn) for this system of congruences. The solution can be found using the formula:
Where (Mi = M / mi) and (yi) is the modular multiplicative inverse of (Mi) modulo (mi).
Suppose we have the following system of congruences:
x ≡ 2 mod 3
x ≡ 3 mod 5
x ≡ 2 mod 7
Calculate M = 3 × 5 × 7 = 105
Then, we calculate (M1 = 105 / 3 = 35), (M2 = 105 / 5 = 21), and (M3 = 105 / 7 = 15).
find the modular multiplicative inverses (y1), (y2), and (y3) for (M1), (M2), and (M3) modulo (m1), (m2), and (m3), respectively
y1 is the modular multiplicative inverse of 35 modulo 3, which is 2
y2 is the modular multiplicative inverse of 21 modulo 5, which is 1
y3 is the modular multiplicative inverse of 15 modulo 7, which is 1
Now, using the formula:
x ≡ 2 × 35 × 2 + 3 × 21 × 1 + 2 × 15 × 1 (mod 105)
x ≡ 140 + 63 + 30 mod 105)
x ≡ 233 mod 105)
So, the solution for the system of congruences is x ≡ 233 (mod 105)
Chinese Remainder Theorem Solution for Not Coprime Moduli
Chinese Remainder Theorem helps in solving systems of equations where the remainders are congruent, even if the numbers that are divisible by are not relatively prime. But when the divisors are not relatively prime, there might be more than one solution to the problem.
Suppose we have the following system of congruences:
x ≡ 2 (mod 4)
x ≡ 3 (mod 6)
Here, the moduli 4 and 6 are not coprime because their greatest common divisor (GCD) is 2
To find the solution using the Chinese Remainder Theorem, we proceed as follows:
1. Find the moduli product: Calculate (m = 4 × 6 = 24).
2. Find the residues: Divide each modulus by the product of the other moduli to find the residue:
4 × k ≡ 1 (mod 6)
6 × k' ≡ 1 (mod 4)
In this case, (k = 1) and (k' = 1) satisfy the congruences, so the residues are both 1
3. Calculate the solution: The solution (x) is given by:
x = a1 × m2 × k + a2 × m1 × k' (mod m)
Plugging in the values:
x = 2 × 6 × 1 + 3 × 4 × 1...(mod 24)
x = 12 + 12...(mod 24)
x = 24...(mod 24)
x = 0
So, the solution for this system of congruences is x ≡ 0 (mod 24).
Application of Chinese Remainder Theorem
Applications of the Chinese remainder theorem are as follows:
- Simplifies modular arithmetic calculations by breaking them into smaller parts.
- Used in error detection and correction algorithms, enhancing data reliability in digital communication and storage.
- Integral to cryptographic algorithms like RSA for secure data transmission and protection.
- Employed in computer graphics for efficient image rendering and visual effects.
- Provides insights into number theory, aiding research in prime numbers and Diophantine equations.
- Coding theory helps create error-correcting codes, ensuring that data can be sent reliably without mistakes.
- It makes parallel computing easier by dividing tasks effectively among many processors.
- Public key cryptography depends on it to calculate private keys from public ones, adding extra security measures.
Solved Example on Chinese Remainder Theorem
Suppose a certain number leaves a remainder of 2 when divided by 3, a remainder of 3 when divided by 5, and a remainder of 2 when divided by 7. Find the smallest positive integer that satisfies these conditions using the Chinese Remainder Theorem.
Solution:
Let x be the number that satisfies all the given conditions:
- Remainder of 2 when divided by 3
- Remainder of 3 when divided by 5
- Remainder of 2 when divided by 7
Now, as per the Chinese Remainder Theorem, since the moduli (3, 5, and 7) are pairwise coprime, a unique solution modulo is lcm(3,5,7)=105
- x ≡ 2(mod 3)
- x ≡ 3(mod 5)
- x ≡ 2(mod 7)
The modular inverses for each modulus will be:
- For 3, the modular inverse of 3 modulo 5 is 2 as 3⋅2 ≡ 1(mod 5)
- For 5, the modular inverse of 5 modulo 7 is 3 as 5⋅3 ≡ 1(mod 7)
- For 7, the modular inverse of 7 modulo 3 is 1 as 7⋅1 ≡ 1(mod 3)
Now calculate for x:
x ≡ (2⋅3⋅5⋅2)⋅(2⋅3) + (3⋅5⋅7⋅3)⋅(3⋅7) + (2⋅3⋅5⋅2)⋅(1⋅1)...(mod 105)
On solving each term we get,
x ≡ 60+315+60(mod105)
x ≡ 435(mod105)
x ≡ 15(mod105)
∴ Smallest positive integer that satisfies the given conditions is x=15.
Practice Questions on Chinese Remainder Theorem
Question 1: Solve the system of congruences:
x ≡ 2 (mod 3)
x ≡ 3 (mod 5)
x ≡ 2 (mod 7)
Question 2: Solve the system of congruences:
x ≡ 1 (mod 2)
x ≡ 2 (mod 4)
x ≡ 3 (mod 5)
Answer Key
- x = 23 (modulo 105).
- There is no solution for this system of congruences, because x ≡ 1 (mod2) (odd) and x ≡ 2 (mod4) (even) are contradictory.