# Chinese remainder theorem

Suppose we have a set of $n$ congruences of the form

 $\begin{array}[]{ccc}x&\equiv&a_{1}\pmod{p_{1}}\\ x&\equiv&a_{2}\pmod{p_{2}}\\ &\vdots&\\ x&\equiv&a_{n}\pmod{p_{n}}\\ \end{array}$

where $p_{1},p_{2},\dots,p_{n}$ are relatively prime. Let

 $P=\prod_{i=1}^{n}p_{i}$

and, for all $i\in\mathbb{N}$ ($1\leq i\leq n$), let $y_{i}$ be an integer that satisfies

 $y_{i}\cdot\frac{P}{p_{i}}\equiv 1\pmod{p_{i}}$

Then one solution of these congruences is

 $x_{0}=\sum_{i=1}^{n}a_{i}y_{i}\cdot\frac{P}{p_{i}}$

Any $x\in\mathbb{Z}$ satisfies the set of congruences if and only if it satisfies

 $x\equiv x_{0}\pmod{P}$

The Chinese remainder theorem originated in the book “Sun Zi Suan Jing”, or Sun Tzu’s Arithmetic Classic, by the Chinese mathematician Sun Zi, or Sun Tzu, who also wrote “Sun Zi Bing Fa”, or Sun Tzu’s The Art of War. The theorem is said to have been used to count the size of the ancient Chinese armies (i.e., the soldiers would split into groups of 3, then 5, then 7, etc, and the “leftover” soldiers from each grouping would be counted).

Title Chinese remainder theorem ChineseRemainderTheorem 2013-03-22 11:58:58 2013-03-22 11:58:58 CWoo (3771) CWoo (3771) 13 CWoo (3771) Theorem msc 11D79 ChineseRemainderTheoremInTermsOfDivisorTheory GodelsBetaFunction