The Chinese Remainder Theorem (CRT) is a fundamental theorem in number theory with applications in various fields such as cryptography, computer science, and pure mathematics. It provides a solution to simultaneous congruences.
Statement:
Let be positive integers that are pairwise coprime (i.e., for every , ), and let be any integers. Then the system of simultaneous congruences
has a unique solution modulo
Proof:
Existence of a Solution:
Let .For each , let . Since and are coprime, there exist integers such that . Now, let . We claim that is a solution to the system of congruences.
Indeed, for any , we have:
Thus, satisfies all the congruences.
Uniqueness of Solution:
Suppose and are two solutions to the system of congruences. Then for all . Hence, for all .
Since by the Chinese Remainder Theorem,
Thus, any two solutions are congruent modulo , and hence, the solution is unique modulo .
Example:
Let's solve the following system of simultaneous congruences:
Here, , , and are pairwise coprime.
- Compute .
- Compute , , and
- Compute the inverses , , and such that . $35b_1 \equiv 1 \pmod{3},21b_2 \equiv 1\pmod{5},15b_3 \equiv 1 \pmod{7}$
4.We get
,
, and
.
5.Calculate
Therefore, the unique solution to the given system of congruences modulo is .
Example: Suppose we have the following system of congruences:
$ \begin{align*} x &\equiv 1 \pmod{3} \\ x &\equiv 4 \pmod{5} \\ x &\equiv 6 \pmod{7} \end{align*} $
We follow the steps of the Chinese Remainder Theorem:
- Compute
- Compute , , and
- Compute the inverses , , and such that
For , we have , so .Solving this congruence, we find
For , we have , so . Solving this congruence, we find
For , we have so . Solving this congruence, we find
- Calculate
Therefore, the unique solution to the given system of congruences modulo is
The linear congruences in the Chinese Remainder Theorem are all of the form $x \equiv a_i \mod (n_i)$. If we are given a set of simultaneous linear congruences, with one (or more) of them in the more general form $ax \equiv b \: mod (n_i)$, then we will first need to use the earlier algorithm to solve this congruence, expressing its general solution as a congruence class modulo some divisor of $n_i$; it will then be possible to apply the techniques based on the Chinese Remainder Theorem to solve the resulting simultaneous congruences.
Example:Consider the congruences
$$7x \equiv 3 \pmod {12},\quad 10x \equiv 6 \pmod {14}$$
This can be reduced into
$$x \equiv 9 \pmod {12},\quad x \equiv 2 \pmod {7}$$
Now it is in standard form and can be solved with CRT
The solution is
We follow the steps of the Chinese Remainder Theorem:
- Compute
- Compute and
- Compute the inverses and such that
For , we have , so . Solving this congruence, we find
For , we have , so . Solving this congruence, we find
- Calculate
Therefore, the unique solution to the given system of congruences modulo is
The Chinese Remainder Theorem (CRT) can be used to convert a single congruence, with a large modulus into several simultaneous congruences with smaller moduli
Example:
Consider the congruence $13x \equiv 71 \pmod{380}$
Instead of solving this single linear congruence, we can use factorization $380=2^2 \times 5 \times 19$
So we can replace the original congruence with three simultaneous congruences.
$$13x \equiv 71 \pmod{4}, \quad 13x \equiv 71 \pmod{5} ,\quad 13x \equiv 71 \pmod{19} $$
These can be immediately reduced to
$$x \equiv 3 \pmod{4} ,\quad 3x \equiv 1 \pmod{5}, \quad 13x \equiv 14 \pmod{19} $$
We can further reduce this into
$$x \equiv 3 \pmod{4}, \quad x \equiv 2 \pmod{5}, \quad x \equiv 4 \pmod{19} $$
We follow the steps of the Chinese Remainder Theorem:Compute $N = n_1 \times n_2 \times n_3= 4 \times 5 \times 19 = 380$
Compute $N_1 = 380 / 4 = 95$ and $N_2=380/5=76$ and $N_3=380/19=20$
Compute the inverses $b_1,b_2$ and $b_3$ such that $N_ib_i≡1(mod \:n_i)$
For $n_1=4$, we have $N_1 b_1 \equiv 1 \pmod{4}$, so $95.b_1 \equiv 1 \pmod{4}$. Solving this congruence, we find $b_1 \equiv 3 \pmod{4}$
For $n_2 = 5$, we have $N_2 b_2 \equiv 1 \pmod{5}$, so $76.b_2 \equiv 1 \pmod{5}$. Solving this congruence, we find $b_2≡1 \pmod{5}$
For $n_3 = 19$, we have $N_3 b_3 \equiv 1 \pmod{19}$, so $20.b_3 \equiv 1 \pmod{19}$. Solving this congruence, we find $b_3≡1 \pmod{19}$
Calculate $x=a_1N_1b_1+a_2N_2b_2+a_3N_3b_3=3 \times 95 \times 3+2 \times 76 \times 1+4 \times 20 \times 1=1080=327 \pmod{380}$
Therefore, the unique solution to the given system of congruences modulo $N = 380$ is $x \equiv 327 \pmod{380}$. General solution is $327+380t$
Python code
$x≡2(mod\;3)x≡3(mod \; 5)x≡2(mod \; 7)$
from sympy.ntheory.modular import crt
print(crt([3, 5, 7], [2, 3, 2]))
Output:(23, 105)
Comments
Post a Comment