Chinese remainder theorem
In mathematics, the Chinese remainder theorem states that if one knows the remainders of the Euclidean division of an integer n by several integers, then one can determine uniquely the remainder of the division of n by the product of these integers, under the condition that the divisors are pairwise coprime (no two divisors share a common factor other than 1).<ref>{{#invoke:citation/CS1|citation |CitationClass=web }}</ref>
The theorem is sometimes called Sunzi's theorem. Both names of the theorem refer to its earliest known statement that appeared in Sunzi Suanjing, a Chinese manuscript written during the 3rd to 5th century CE. This first statement was restricted to the following example:
If one knows that the remainder of n divided by 3 is 2, the remainder of n divided by 5 is 3, and the remainder of n divided by 7 is 2, then with no other information, one can determine the remainder of n divided by 105 (the product of 3, 5, and 7) without knowing the value of n. In this example, the remainder is 23. Moreover, this remainder is the only possible positive value of n that is less than 105.
The Chinese remainder theorem is widely used for computing with large integers, as it allows replacing a computation for which one knows a bound on the size of the result by several similar computations on small integers.
The Chinese remainder theorem (expressed in terms of congruences) is true over every principal ideal domain. It has been generalized to any ring, with a formulation involving two-sided ideals.
HistoryEdit
The earliest known statement of the problem appears in the 5th-century book Sunzi Suanjing by the Chinese mathematician Sunzi:<ref name=Katz>Template:Harvnb</ref>
<templatestyles src="Template:Blockquote/styles.css" />
There are certain things whose number is unknown. If we count them by threes, we have two left over; by fives, we have three left over; and by sevens, two are left over. How many things are there?<ref>Template:Harvnb</ref>{{#if:|{{#if:|}}
— {{#if:|, in }}Template:Comma separated entries}}
{{#invoke:Check for unknown parameters|check|unknown=Template:Main other|preview=Page using Template:Blockquote with unknown parameter "_VALUE_"|ignoreblank=y| 1 | 2 | 3 | 4 | 5 | author | by | char | character | cite | class | content | multiline | personquoted | publication | quote | quotesource | quotetext | sign | source | style | text | title | ts }}
Sunzi's work would not be considered a theorem by modern standards; it only gives one particular problem, without showing how to solve it, much less any proof about the general case or a general algorithm for solving it.<ref>Template:Harvnb</ref> An algorithm for solving this problem was described by Aryabhata (6th century).<ref>Template:Harvnb</ref> Special cases of the Chinese remainder theorem were also known to Brahmagupta (7th century) and appear in Fibonacci's Liber Abaci (1202).<ref>Template:Harvnb</ref> The result was later generalized with a complete solution called Da-yan-shu ({{#invoke:Lang|lang}}) in Qin Jiushao's 1247 Mathematical Treatise in Nine Sections <ref>Template:Harvnb</ref> which was translated into English in early 19th century by British missionary Alexander Wylie.<ref>Template:Harvnb</ref>
The notion of congruences was first introduced and used by Carl Friedrich Gauss in his Disquisitiones Arithmeticae of 1801.<ref>Template:Harvnb</ref> Gauss illustrates the Chinese remainder theorem on a problem involving calendars, namely, "to find the years that have a certain period number with respect to the solar and lunar cycle and the Roman indiction."<ref>Template:Harvnb</ref> Gauss introduces a procedure for solving the problem that had already been used by Leonhard Euler but was in fact an ancient method that had appeared several times.<ref>Template:Harvnb</ref>
StatementEdit
Let n1, ..., nk be integers greater than 1, which are often called moduli or divisors. Let us denote by N the product of the ni.
The Chinese remainder theorem asserts that if the ni are pairwise coprime, and if a1, ..., ak are integers such that 0 ≤ ai < ni for every i, then there is one and only one integer x, such that 0 ≤ x < N and the remainder of the Euclidean division of x by ni is ai for every i.
This may be restated as follows in terms of congruences: If the <math>n_i</math> are pairwise coprime, and if a1, ..., ak are any integers, then the system
- <math>\begin{align}
x &\equiv a_1 \pmod{n_1} \\ &\,\,\,\vdots \\ x &\equiv a_k \pmod{n_k},
\end{align}</math> has a solution, and any two solutions, say x1 and x2, are congruent modulo N, that is, Template:Math.<ref>Template:Harvnb</ref>
In abstract algebra, the theorem is often restated as: if the ni are pairwise coprime, the map
- <math>x \bmod N \;\mapsto\;(x \bmod n_1,\, \ldots,\, x \bmod n_k)</math>
defines a ring isomorphism<ref>Template:Harvnb</ref>
- <math>\mathbb{Z}/N\mathbb{Z} \cong \mathbb{Z}/n_1\mathbb{Z} \times \cdots \times \mathbb{Z}/n_k\mathbb{Z}</math>
between the ring of integers modulo N and the direct product of the rings of integers modulo the ni. This means that for doing a sequence of arithmetic operations in <math>\mathbb{Z}/N\mathbb{Z},</math> one may do the same computation independently in each <math>\mathbb{Z}/n_i\mathbb{Z}</math> and then get the result by applying the isomorphism (from the right to the left). This may be much faster than the direct computation if N and the number of operations are large. This is widely used, under the name multi-modular computation, for linear algebra over the integers or the rational numbers.
The theorem can also be restated in the language of combinatorics as the fact that the infinite arithmetic progressions of integers form a Helly family.<ref>Template:Harvnb</ref>
ProofEdit
The existence and the uniqueness of the solution may be proven independently. However, the first proof of existence, given below, uses this uniqueness.
UniquenessEdit
Suppose that Template:Mvar and Template:Mvar are both solutions to all the congruences. As Template:Mvar and Template:Mvar give the same remainder, when divided by Template:Math, their difference Template:Math is a multiple of each Template:Math. As the Template:Math are pairwise coprime, their product Template:Math also divides Template:Math, and thus Template:Mvar and Template:Mvar are congruent modulo Template:Math. If Template:Mvar and Template:Mvar are supposed to be non-negative and less than Template:Math (as in the first statement of the theorem), then their difference may be a multiple of Template:Math only if Template:Math.
Existence (first proof)Edit
The map
- <math>x \bmod N \mapsto (x \bmod n_1, \ldots, x\bmod n_k)</math>
maps congruence classes modulo Template:Math to sequences of congruence classes modulo Template:Math. The proof of uniqueness shows that this map is injective. As the domain and the codomain of this map have the same number of elements, the map is also surjective, which proves the existence of the solution.
This proof is very simple but does not provide any direct way for computing a solution. Moreover, it cannot be generalized to other situations where the following proof can.
Existence (constructive proof)Edit
Existence may be established by an explicit construction of Template:Mvar.<ref>Template:Harvnb</ref> This construction may be split into two steps, first solving the problem in the case of two moduli, and then extending this solution to the general case by induction on the number of moduli.
Case of two moduliEdit
We want to solve the system:
- <math>
\begin{align}
x &\equiv a_1 \pmod {n_1}\\ x &\equiv a_2 \pmod {n_2},
\end{align} </math> where <math>n_1</math> and <math>n_2</math> are coprime.
Bézout's identity asserts the existence of two integers <math>m_1</math> and <math>m_2</math> such that
- <math>m_1n_1+m_2n_2=1.</math>
The integers <math>m_1</math> and <math>m_2</math> may be computed by the extended Euclidean algorithm.
A solution is given by
- <math>x = a_1m_2n_2+a_2m_1n_1.</math>
Indeed,
- <math>\begin{align}
x&=a_1m_2n_2+a_2m_1n_1\\ &=a_1(1 - m_1n_1) + a_2m_1n_1 \\ &=a_1 + (a_2 - a_1)m_1n_1, \end{align}</math> implying that <math>x \equiv a_1 \pmod {n_1}.</math> The second congruence is proved similarly, by exchanging the subscripts 1 and 2.
General caseEdit
Consider a sequence of congruence equations:
- <math>
\begin{align}
x &\equiv a_1 \pmod{n_1} \\ &\vdots \\ x &\equiv a_k \pmod{n_k},
\end{align} </math> where the <math>n_i</math> are pairwise coprime. The two first equations have a solution <math>a_{1,2}</math> provided by the method of the previous section. The set of the solutions of these two first equations is the set of all solutions of the equation
- <math>x \equiv a_{1,2} \pmod{n_1n_2}.</math>
As the other <math>n_i</math> are coprime with <math>n_1n_2,</math> this reduces solving the initial problem of Template:Mvar equations to a similar problem with <math>k-1</math> equations. Iterating the process, one gets eventually the solutions of the initial problem.
Existence (direct construction)Edit
For constructing a solution, it is not necessary to make an induction on the number of moduli. However, such a direct construction involves more computation with large numbers, which makes it less efficient and less used. Nevertheless, Lagrange interpolation is a special case of this construction, applied to polynomials instead of integers.
Let <math>N_i = N/n_i</math> be the product of all moduli but one. As the <math>n_i</math> are pairwise coprime, <math>N_i</math> and <math>n_i</math> are coprime. Thus Bézout's identity applies, and there exist integers <math>M_i</math> and <math>m_i</math> such that
- <math>M_iN_i + m_in_i=1.</math>
A solution of the system of congruences is
- <math>x=\sum_{i=1}^k a_iM_iN_i.</math>
In fact, as <math>N_j</math> is a multiple of <math>n_i</math> for <math>i\neq j,</math> we have
- <math>x \equiv a_iM_iN_i \equiv a_i(1-m_in_i) \equiv a_i \pmod{n_i}, </math>
for every <math>i.</math>
ComputationEdit
Consider a system of congruences:
- <math>\begin{align}
x &\equiv a_1 \pmod{n_1} \\ &\vdots \\ x &\equiv a_k \pmod{n_k}, \\
\end{align}</math> where the <math>n_i</math> are pairwise coprime, and let <math>N=n_1 n_2\cdots n_k.</math> In this section several methods are described for computing the unique solution for <math>x</math>, such that <math>0\le x<N,</math> and these methods are applied on the example
- <math>
\begin{align}
x &\equiv 0 \pmod 3 \\ x &\equiv 3 \pmod 4 \\ x &\equiv 4 \pmod 5.
\end{align} </math>
Several methods of computation are presented. The two first ones are useful for small examples, but become very inefficient when the product <math>n_1\cdots n_k</math> is large. The third one uses the existence proof given in Template:Slink. It is the most convenient when the product <math>n_1\cdots n_k</math> is large, or for computer computation.
Systematic searchEdit
It is easy to check whether a value of Template:Mvar is a solution: it suffices to compute the remainder of the Euclidean division of Template:Mvar by each Template:Math. Thus, to find the solution, it suffices to check successively the integers from Template:Math to Template:Mvar until finding the solution.
Although very simple, this method is very inefficient. For the simple example considered here, Template:Math integers (including Template:Math) have to be checked for finding the solution, which is Template:Math. This is an exponential time algorithm, as the size of the input is, up to a constant factor, the number of digits of Template:Mvar, and the average number of operations is of the order of Template:Mvar.
Therefore, this method is rarely used, neither for hand-written computation nor on computers.
Search by sievingEdit
The search of the solution may be made dramatically faster by sieving. For this method, we suppose, without loss of generality, that <math>0\le a_i <n_i</math> (if it were not the case, it would suffice to replace each <math>a_i</math> by the remainder of its division by <math>n_i</math>). This implies that the solution belongs to the arithmetic progression
- <math>a_1, a_1 + n_1, a_1+2n_1, \ldots</math>
By testing the values of these numbers modulo <math>n_2,</math> one eventually finds a solution <math>x_2</math> of the two first congruences. Then the solution belongs to the arithmetic progression
- <math>x_2, x_2 + n_1n_2, x_2+2n_1n_2, \ldots</math>
Testing the values of these numbers modulo <math>n_3,</math> and continuing until every modulus has been tested eventually yields the solution.
This method is faster if the moduli have been ordered by decreasing value, that is if <math>n_1>n_2> \cdots > n_k.</math> For the example, this gives the following computation. We consider first the numbers that are congruent to 4 modulo 5 (the largest modulus), which are 4, Template:Nowrap, Template:Nowrap, ... For each of them, compute the remainder by 4 (the second largest modulus) until getting a number congruent to 3 modulo 4. Then one can proceed by adding Template:Nowrap at each step, and computing only the remainders by 3. This gives
- 4 mod 4 → 0. Continue
- 4 + 5 = 9 mod 4 →1. Continue
- 9 + 5 = 14 mod 4 → 2. Continue
- 14 + 5 = 19 mod 4 → 3. OK, continue by considering remainders modulo 3 and adding 5 × 4 = 20 each time
- 19 mod 3 → 1. Continue
- 19 + 20 = 39 mod 3 → 0. OK, this is the result.
This method works well for hand-written computation with a product of moduli that is not too big. However, it is much slower than other methods, for very large products of moduli. Although dramatically faster than the systematic search, this method also has an exponential time complexity and is therefore not used on computers.
Using the existence constructionEdit
The constructive existence proof shows that, in the case of two moduli, the solution may be obtained by the computation of the Bézout coefficients of the moduli, followed by a few multiplications, additions and reductions modulo <math>n_1n_2</math> (for getting a result in the interval <math>(0, n_1n_2-1)</math>). As the Bézout's coefficients may be computed with the extended Euclidean algorithm, the whole computation, at most, has a quadratic time complexity of <math>O((s_1+s_2)^2),</math> where <math>s_i</math> denotes the number of digits of <math>n_i.</math>
For more than two moduli, the method for two moduli allows the replacement of any two congruences by a single congruence modulo the product of the moduli. Iterating this process provides eventually the solution with a complexity, which is quadratic in the number of digits of the product of all moduli. This quadratic time complexity does not depend on the order in which the moduli are regrouped. One may regroup the two first moduli, then regroup the resulting modulus with the next one, and so on. This strategy is the easiest to implement, but it also requires more computation involving large numbers.
Another strategy consists in partitioning the moduli in pairs whose product have comparable sizes (as much as possible), applying, in parallel, the method of two moduli to each pair, and iterating with a number of moduli approximatively divided by two. This method allows an easy parallelization of the algorithm. Also, if fast algorithms (that is, algorithms working in quasilinear time) are used for the basic operations, this method provides an algorithm for the whole computation that works in quasilinear time.
On the current example (which has only three moduli), both strategies are identical and work as follows.
Bézout's identity for 3 and 4 is
- <math>1\times 4 + (-1)\times 3 = 1.</math>
Putting this in the formula given for proving the existence gives
- <math>0\times 1\times 4 + 3\times (-1)\times 3 =-9</math>
for a solution of the two first congruences, the other solutions being obtained by adding to −9 any multiple of Template:Nowrap. One may continue with any of these solutions, but the solution Template:Nowrap is smaller (in absolute value) and thus leads probably to an easier computation
Bézout identity for 5 and 3 × 4 = 12 is
- <math>5\times 5 +(-2)\times 12 =1.</math>
Applying the same formula again, we get a solution of the problem:
- <math>5\times 5 \times 3 + 12\times (-2)\times 4 = -21.</math>
The other solutions are obtained by adding any multiple of Template:Nowrap, and the smallest positive solution is Template:Nowrap.
As a linear Diophantine systemEdit
The system of congruences solved by the Chinese remainder theorem may be rewritten as a system of linear Diophantine equations:
- <math>\begin{align}
x &= a_1 +x_1n_1\\ &\vdots \\ x &=a_k+x_kn_k,
\end{align}</math> where the unknown integers are <math>x</math> and the <math>x_i.</math> Therefore, every general method for solving such systems may be used for finding the solution of Chinese remainder theorem, such as the reduction of the matrix of the system to Smith normal form or Hermite normal form. However, as usual when using a general algorithm for a more specific problem, this approach is less efficient than the method of the preceding section, based on a direct use of Bézout's identity.
Over principal ideal domainsEdit
In Template:Section link, the Chinese remainder theorem has been stated in three different ways: in terms of remainders, of congruences, and of a ring isomorphism. The statement in terms of remainders does not apply, in general, to principal ideal domains, as remainders are not defined in such rings. However, the two other versions make sense over a principal ideal domain Template:Math: it suffices to replace "integer" by "element of the domain" and <math>\mathbb Z</math> by Template:Math. These two versions of the theorem are true in this context, because the proofs (except for the first existence proof), are based on Euclid's lemma and Bézout's identity, which are true over every principal domain.
However, in general, the theorem is only an existence theorem and does not provide any way for computing the solution, unless one has an algorithm for computing the coefficients of Bézout's identity.
Over univariate polynomial rings and Euclidean domainsEdit
The statement in terms of remainders given in Template:Slink cannot be generalized to any principal ideal domain, but its generalization to Euclidean domains is straightforward. The univariate polynomials over a field is the typical example of a Euclidean domain which is not the integers. Therefore, we state the theorem for the case of the ring <math>R=K[X]</math> for a field <math>K.</math> For getting the theorem for a general Euclidean domain, it suffices to replace the degree by the Euclidean function of the Euclidean domain.
The Chinese remainder theorem for polynomials is thus: Let <math>P_i(X)</math> (the moduli) be, for <math>i = 1, \dots, k</math>, pairwise coprime polynomials in <math>R=K[X]</math>. Let <math>d_i =\deg P_i</math> be the degree of <math>P_i(X)</math>, and <math>D</math> be the sum of the <math>d_i.</math> If <math>A_i(X), \ldots,A_k(X)</math> are polynomials such that <math>A_i(X)=0</math> or <math>\deg A_i<d_i</math> for every Template:Math, then, there is one and only one polynomial <math>P(X)</math>, such that <math>\deg P<D</math> and the remainder of the Euclidean division of <math>P(X)</math> by <math>P_i(X)</math> is <math>A_i(X)</math> for every Template:Math.
The construction of the solution may be done as in Template:Slink or Template:Slink. However, the latter construction may be simplified by using, as follows, partial fraction decomposition instead of the extended Euclidean algorithm.
Thus, we want to find a polynomial <math>P(X)</math>, which satisfies the congruences
- <math>P(X)\equiv A_i(X) \pmod {P_i(X)},</math>
for <math>i=1,\ldots,k.</math>
Consider the polynomials
- <math>\begin{align}
Q(X) &= \prod_{i=1}^{k}P_i(X) \\ Q_i(X) &= \frac{Q(X)}{P_i(X)}.
\end{align}</math>
The partial fraction decomposition of <math>1/Q(X)</math> gives Template:Mvar polynomials <math>S_i(X)</math> with degrees <math>\deg S_i(X) < d_i,</math> such that
- <math>\frac{1}{Q(X)} = \sum_{i=1}^k \frac{S_i(X)}{P_i(X)},</math>
and thus
- <math>1 = \sum_{i=1}^{k}S_i(X) Q_i(X).</math>
Then a solution of the simultaneous congruence system is given by the polynomial
- <math>\sum_{i=1}^k A_i(X) S_i(X) Q_i(X).</math>
In fact, we have
- <math>\sum_{i=1}^k A_i(X) S_i(X) Q_i(X)= A_i(X)+ \sum_{j=1}^{k}(A_j(X) - A_i(X)) S_j(X) Q_j(X) \equiv A_i(X)\pmod{P_i(X)},</math>
for <math>1 \leq i \leq k.</math>
This solution may have a degree larger than <math>D=\sum_{i=1}^k d_i.</math> The unique solution of degree less than <math>D</math> may be deduced by considering the remainder <math>B_i(X)</math> of the Euclidean division of <math>A_i(X)S_i(X)</math> by <math>P_i(X).</math> This solution is
- <math>P(X)=\sum_{i=1}^k B_i(X) Q_i(X).</math>
Lagrange interpolationEdit
A special case of Chinese remainder theorem for polynomials is Lagrange interpolation. For this, consider Template:Mvar monic polynomials of degree one:
- <math>P_i(X)=X-x_i.</math>
They are pairwise coprime if the <math>x_i</math> are all different. The remainder of the division by <math>P_i(X)</math> of a polynomial <math>P(X)</math> is <math>P(x_i)</math>, by the polynomial remainder theorem.
Now, let <math>A_1, \ldots, A_k</math> be constants (polynomials of degree 0) in <math>K.</math> Both Lagrange interpolation and Chinese remainder theorem assert the existence of a unique polynomial <math>P(X),</math> of degree less than <math>k</math> such that
- <math>P(x_i)=A_i,</math>
for every <math>i.</math>
Lagrange interpolation formula is exactly the result, in this case, of the above construction of the solution. More precisely, let
- <math>\begin{align}
Q(X) &= \prod_{i=1}^{k}(X-x_i) \\[6pt] Q_i(X) &= \frac{Q(X)}{X-x_i}.
\end{align}</math>
The partial fraction decomposition of <math>\frac{1}{Q(X)}</math> is
- <math>\frac{1}{Q(X)} = \sum_{i=1}^k \frac{1}{Q_i(x_i)(X-x_i)}.</math>
In fact, reducing the right-hand side to a common denominator one gets
- <math> \sum_{i=1}^k \frac{1}{Q_i(x_i)(X-x_i)}= \frac{1}{Q(X)} \sum_{i=1}^k \frac{Q_i(X)}{Q_i(x_i)},</math>
and the numerator is equal to one, as being a polynomial of degree less than <math>k,</math> which takes the value one for <math>k</math> different values of <math>X.</math>
Using the above general formula, we get the Lagrange interpolation formula:
- <math>P(X)=\sum_{i=1}^k A_i\frac{Q_i(X)}{Q_i(x_i)}.</math>
Hermite interpolationEdit
Hermite interpolation is an application of the Chinese remainder theorem for univariate polynomials, which may involve moduli of arbitrary degrees (Lagrange interpolation involves only moduli of degree one).
The problem consists of finding a polynomial of the least possible degree, such that the polynomial and its first derivatives take given values at some fixed points.
More precisely, let <math>x_1, \ldots, x_k</math> be <math>k</math> elements of the ground field <math>K,</math> and, for <math>i=1,\ldots, k,</math> let <math>a_{i,0}, a_{i,1}, \ldots, a_{i,r_i-1}</math> be the values of the first <math>r_i</math> derivatives of the sought polynomial at <math>x_i</math> (including the 0th derivative, which is the value of the polynomial itself). The problem is to find a polynomial <math>P(X)</math> such that its jTemplate:Hairspth derivative takes the value <math>a_{i,j} </math> at <math>x_i,</math> for <math>i=1,\ldots,k</math> and <math>j=0,\ldots,r_j.</math>
Consider the polynomial
- <math>P_i(X) = \sum_{j=0}^{r_i - 1}\frac{a_{i,j}}{j!}(X - x_i)^j.</math>
This is the Taylor polynomial of order <math>r_i-1</math> at <math>x_i</math>, of the unknown polynomial <math>P(X).</math> Therefore, we must have
- <math>P(X)\equiv P_i(X) \pmod {(X-x_i)^{r_i}}.</math>
Conversely, any polynomial <math>P(X) </math> that satisfies these <math>k</math> congruences, in particular verifies, for any <math>i=1, \ldots, k</math>
- <math>P(X)= P_i(X) +o(X-x_i)^{r_i-1} </math>
therefore <math>P_i(X)</math> is its Taylor polynomial of order <math> r_i - 1</math> at <math>x_i</math>, that is, <math>P(X)</math> solves the initial Hermite interpolation problem. The Chinese remainder theorem asserts that there exists exactly one polynomial of degree less than the sum of the <math>r_i,</math> which satisfies these <math>k</math> congruences.
There are several ways for computing the solution <math>P(X).</math> One may use the method described at the beginning of Template:Slink. One may also use the constructions given in Template:Slink or Template:Slink.
Generalization to non-coprime moduliEdit
The Chinese remainder theorem can be generalized to non-coprime moduli. Let <math>m, n, a, b</math> be any integers, let <math>g = \gcd(m,n)</math>; <math>M = \operatorname{lcm}(m,n)</math>, and consider the system of congruences:
- <math>
\begin{align} x &\equiv a \pmod m \\ x &\equiv b \pmod n, \end{align} </math> If <math>a \equiv b \pmod g</math>, then this system has a unique solution modulo <math>M = mn/g</math>. Otherwise, it has no solutions.
If one uses Bézout's identity to write <math>g = um + vn</math>, then the solution is given by
- <math> x = \frac{avn+bum}{g}.</math>
This defines an integer, as Template:Mvar divides both Template:Mvar and Template:Mvar. Otherwise, the proof is very similar to that for coprime moduli.Template:Sfn
Generalization to arbitrary ringsEdit
The Chinese remainder theorem can be generalized to any ring, by using coprime ideals (also called comaximal ideals). Two ideals Template:Mvar and Template:Mvar are coprime if there are elements <math>i\in I</math> and <math>j\in J</math> such that <math>i+j=1.</math> This relation plays the role of Bézout's identity in the proofs related to this generalization, which otherwise are very similar. The generalization may be stated as follows.<ref>Template:Harvnb</ref><ref name=Sengupta>Template:Harvnb</ref>
Let Template:Math be two-sided ideals of a ring <math>R</math> and let Template:Math be their intersection. If the ideals are pairwise coprime, we have the isomorphism:
- <math>\begin{align}
R/I &\to (R/I_1) \times \cdots \times (R/I_k) \\ x \bmod I &\mapsto (x \bmod I_1,\, \ldots,\, x \bmod I_k),
\end{align}</math> between the quotient ring <math>R/I</math> and the direct product of the <math>R/I_i,</math> where "<math>x \bmod I</math>" denotes the image of the element <math>x</math> in the quotient ring defined by the ideal <math>I.</math> Moreover, if <math>R</math> is commutative, then the ideal intersection of pairwise coprime ideals is equal to their product; that is
- <math>
I= I_1\cap I_2 \cap\cdots\cap I_k= I_1I_2\cdots I_k, </math> if Template:Mvar and Template:Mvar are coprime for all Template:Math.
Interpretation in terms of idempotentsEdit
Let <math>I_1, I_2, \dots, I_k</math> be pairwise coprime two-sided ideals with <math> \bigcap_{i = 1}^k I_i = 0,</math> and
- <math>\varphi:R\to (R/I_1) \times \cdots \times (R/I_k)</math>
be the isomorphism defined above. Let <math>f_i=(0,\ldots,1,\ldots, 0)</math> be the element of <math>(R/I_1) \times \cdots \times (R/I_k)</math> whose components are all Template:Math except the Template:MvarTemplate:Hairspth which is Template:Math, and <math>e_i=\varphi^{-1}(f_i).</math>
The <math>e_i</math> are central idempotents that are pairwise orthogonal; this means, in particular, that <math>e_i^2=e_i</math> and <math>e_ie_j=e_je_i=0</math> for every Template:Mvar and Template:Mvar. Moreover, one has <math display=inline>e_1+\cdots+e_n=1,</math> and <math>I_i=R(1-e_i).</math>
In summary, this generalized Chinese remainder theorem is the equivalence between giving pairwise coprime two-sided ideals with a zero intersection, and giving central and pairwise orthogonal idempotents that sum to Template:Math.<ref>Template:Harvnb</ref>
ApplicationsEdit
Sequence numberingEdit
The Chinese remainder theorem has been used to construct a Gödel numbering for sequences, which is involved in the proof of Gödel's incompleteness theorems.
Fast Fourier transformEdit
The prime-factor FFT algorithm (also called Good-Thomas algorithm) uses the Chinese remainder theorem for reducing the computation of a fast Fourier transform of size <math>n_1n_2</math> to the computation of two fast Fourier transforms of smaller sizes <math>n_1</math> and <math>n_2</math> (providing that <math>n_1</math> and <math>n_2</math> are coprime).
EncryptionEdit
Most implementations of RSA use the Chinese remainder theorem during signing of HTTPS certificates and during decryption.
The Chinese remainder theorem can also be used in secret sharing, which consists of distributing a set of shares among a group of people who, all together (but no one alone), can recover a certain secret from the given set of shares. Each of the shares is represented in a congruence, and the solution of the system of congruences using the Chinese remainder theorem is the secret to be recovered. Secret sharing using the Chinese remainder theorem uses, along with the Chinese remainder theorem, special sequences of integers that guarantee the impossibility of recovering the secret from a set of shares with less than a certain cardinality.
Range ambiguity resolutionEdit
The range ambiguity resolution techniques used with medium pulse repetition frequency radar can be seen as a special case of the Chinese remainder theorem.
Decomposition of surjections of finite abelian groupsEdit
Given a surjection <math>\mathbb{Z}/n \to \mathbb{Z}/m</math> of finite abelian groups, we can use the Chinese remainder theorem to give a complete description of any such map. First of all, the theorem gives isomorphisms
- <math>\begin{align}
\mathbb{Z}/n &\cong \mathbb{Z}/p_{n_1}^{a_1} \times \cdots \times \mathbb{Z}/p_{n_i}^{a_i} \\ \mathbb{Z}/m &\cong \mathbb{Z}/p_{m_1}^{b_1} \times \cdots \times \mathbb{Z}/p_{m_j}^{b_j} \end{align}</math> where <math>\{p_{m_1},\ldots,p_{m_j} \} \subseteq \{ p_{n_1},\ldots, p_{n_i} \}</math>. In addition, for any induced map
- <math>\mathbb{Z}/p_{n_k}^{a_k} \to \mathbb{Z}/p_{m_l}^{b_l}</math>
from the original surjection, we have <math>a_k \geq b_l</math> and <math>p_{n_k} = p_{m_l},</math> since for a pair of primes <math>p,q</math>, the only non-zero surjections
- <math>\mathbb{Z}/p^a \to \mathbb{Z}/q^b</math>
can be defined if <math>p = q</math> and <math>a \geq b</math>.
These observations are pivotal for constructing the ring of profinite integers, which is given as an inverse limit of all such maps.
Dedekind's theoremEdit
Dedekind's theorem on the linear independence of characters. Let Template:Mvar be a monoid and Template:Mvar an integral domain, viewed as a monoid by considering the multiplication on Template:Mvar. Then any finite family Template:Math of distinct monoid homomorphisms Template:Math is linearly independent. In other words, every family Template:Math of elements Template:Math satisfying
- <math>\sum_{i \in I}\alpha_i f_i = 0</math>
must be equal to the family Template:Math.
Proof. First assume that Template:Mvar is a field, otherwise, replace the integral domain Template:Mvar by its quotient field, and nothing will change. We can linearly extend the monoid homomorphisms Template:Math to Template:Mvar-algebra homomorphisms Template:Math, where Template:Math is the monoid ring of Template:Mvar over Template:Mvar. Then, by linearity, the condition
- <math>\sum_{i\in I}\alpha_i f_i = 0,</math>
yields
- <math>\sum_{i \in I}\alpha_i F_i = 0.</math>
Next, for Template:Math the two Template:Mvar-linear maps Template:Math and Template:Math are not proportional to each other. Otherwise Template:Math and Template:Math would also be proportional, and thus equal since as monoid homomorphisms they satisfy: Template:Math, which contradicts the assumption that they are distinct.
Therefore, the kernels Template:Math and Template:Math are distinct. Since Template:Math is a field, Template:Math is a maximal ideal of Template:Math for every Template:Mvar in Template:Mvar. Because they are distinct and maximal the ideals Template:Math and Template:Math are coprime whenever Template:Math. The Chinese Remainder Theorem (for general rings) yields an isomorphism:
- <math>\begin{align}
\phi: k[M] / K &\to \prod_{i \in I}k[M] / \mathrm{Ker} F_i \\ \phi(x + K) &= \left(x + \mathrm{Ker} F_i\right)_{i \in I}
\end{align}</math>
where
- <math>K = \prod_{i \in I}\mathrm{Ker} F_i = \bigcap_{i \in I}\mathrm{Ker} F_i.</math>
Consequently, the map
- <math>\begin{align}
\Phi: k[M] &\to \prod_{i \in I}k[M]/ \mathrm{Ker} F_i \\ \Phi(x) &= \left(x + \mathrm{Ker} F_i\right)_{i \in I}
\end{align}</math>
is surjective. Under the isomorphisms Template:Math the map Template:Math corresponds to:
- <math>\begin{align}
\psi: k[M] &\to \prod_{i \in I}k \\ \psi(x) &= \left[F_i(x)\right]_{i \in I}
\end{align}</math>
Now,
- <math>\sum_{i \in I}\alpha_i F_i = 0</math>
yields
- <math>\sum_{i \in I}\alpha_i u_i = 0</math>
for every vector Template:Math in the image of the map Template:Mvar. Since Template:Mvar is surjective, this means that
- <math>\sum_{i \in I}\alpha_i u_i = 0</math>
for every vector
- <math>\left(u_i\right)_{i \in I} \in \prod_{i \in I}k.</math>
Consequently, Template:Math. QED.
See alsoEdit
NotesEdit
ReferencesEdit
- Template:Citation
- Template:Citation
- Template:Citation. See in particular Section 2.5, "Helly Property", pp. 393–394.
- Template:Citation
- Template:Citation
- Template:Citation
- Template:Citation
- Template:Citation
- Template:Citation
- Template:Citation
- Template:Citation
- Template:Citation
- Template:Citation
- Template:Citation
Further readingEdit
- Template:Citation. See Section 31.5: The Chinese remainder theorem, pp. 873–876.
- Template:Citation
- Template:Citation
- Template:Citation. See Section 4.3.2 (pp. 286–291), exercise 4.6.2–3 (page 456).
External linksEdit
- Template:Springer
- {{#invoke:Template wrapper|{{#if:|list|wrap}}|_template=cite web
|_exclude=urlname, _debug, id |url = https://mathworld.wolfram.com/{{#if:ChineseRemainderTheorem%7CChineseRemainderTheorem.html}} |title = Chinese Remainder Theorem |author = Weisstein, Eric W. |website = MathWorld |access-date = |ref = Template:SfnRef }}