This article needs more work.
Please help by expanding it!
The Chinese remainder theorem (CRT) is a theorem concerning the solution of simultaneous congruences formulated by Sun Tzu. Qín Jiǔsháo in his Mathematical Treatise in Nine Sections[1] and Fibonacci, in his famous book Liber abaci, had a section on the theorem. Today the theorem has applications in number theory and cryptography.
Theorem. (Sun Tzu) Given the
remainders
for the
coprime moduli
there is a unique solution
satisfying each
for
.
Proof. Just for the moment, let's forget about all the congruences except the first one. For
there is a trivial solution
. Remembering now the second congruence,
, form the arithmetic progression
. Each number in the sequence
satisfies the first congruence. The sequence was formed with the function
applied for
from 0 to
, and since
and
are coprime, this means that
over the range specified forms a complete residue class modulo
, that is, the
constitute a permutation of the numbers from 0 to
. If
and
shared even just one prime factor,
would contain at least two instances of 0, and possibly not the number we need. But since they are coprime and we have the complete residue class,[2] this means that in
there is precisely one number
that satisfies both the first and the second congruence: setting
to that
, we then have not only
and
but also
. For
we can just repeat this process, using
in the place of
and
in the place of
, and so on and so forth, until finding
which satisfied each congruence
for
from 1 to
and is therefore precisely the number
specified by the theorem. □
For example, given the remainders 1, 3, 5 and the moduli 2, 7, 15, the unique solution
is 185: we verify that indeed
,
and
. All solutions are thus of the form
.
The method described in the proof above is admittedly somewhat laborious. A somewhat more efficient way to solve a system of congruences requires first finding the product of the moduli
, then finding numbers
such that
. The solution is then

The
operation may be performed just once, after adding up the various
, or iteratively after each addend; either way, this will give the solution.
Returning to our example of
, we find that the product of the moduli is 210, and that the
are 1, 4, 14. Then, 1 × 1 × 105 = 105, 3 × 4 × 30 = 360, 5 × 14 × 14 = 980. and that 105 + 360 + 980 = 1445, which is 185 mod 210.
The astute reader previously unfamiliar with this theorem should by now have realized that
is not the only possible solution to the system of simultaneous congruences, just the smallest possible (here we are concerned only with nonnegative integers). There are infinitely many other solutions of the form
, where
(and of course the original
corresponds to
). Thus, 1235, 95525 and 197585 are randomly chosen alternative solutions to the example problem above.
The importance of the moduli being coprime is that if they are not, then some of the congruences may be at best redundant and at worst contradictory. As an example of the former, we give
and
(the congruence with the smaller modulo may be dispensed with, since it will be satisfied by a number that satisfies the congruence with the larger modulo), and as an example of the latter,
and
(these two congruences can't be satisfied simultaneously).
Sequences
A053664 gives the smallest number
such that
for
, where
is the
th prime number.
- {1, 5, 23, 53, 1523, 29243, 299513, 4383593, 188677703, 5765999453, 5765999453, 2211931390883, 165468170356703, 8075975022064163, 361310530977154973, ...}
A182433 gives the smallest number such that the next
integers each have the square of one of the first
primes as a factor in order. The terms of this sequence are found by applying the Chinese remainder theorem.
- {7, 547, 29347, 1308247, 652312447, 180110691547, 65335225716547, 38733853511213647, ... }
Notes
- ↑ Lǐ Yan & Dù Shíràn, Chinese Mathematics: A Concise History transl. John Crosby & Anthony Lun. Oxford: Clarendon Press (1987): 161—166
- ↑ In a book, this would be either a lemma or a previously proven theorem, but here we take it axiomatically.