ArticleslgStudy

mathematics

Chinese remainder theorem

Chinese remainder theorem is a mathematics topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Chinese remainder theorem rather than just read about it. In short: 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). The theorem is sometimes called Sunzi's theorem.

Chinese remainder theorem — main illustration
Chinese remainder theorem — illustration

Key takeaways

  • Chinese remainder theorem belongs to mathematics; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Chinese remainder theorem to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Chinese remainder theorem from memory before moving on to harder problems.

Reference excerpt

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).

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: 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.

History The earliest known statement of the problem appears in the 5th-century book Sunzi Suanjing by the Chinese mathematician Sunzi:

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? 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. An algorithm for solving this problem was described by Aryabhata (6th century). Special cases of the Chinese remainder theorem were also known to Brahmagupta (7th century) and appear in Fibonacci's Liber Abaci (1202). The result was later generalized with a complete solution called Da-yan-shu (大衍術) in Qin Jiushao's 1247 Mathematical Treatise in Nine Sections which was translated into English in early 19th century by British missionary Alexander Wylie.

The notion of congruences was first introduced and used by Carl Friedrich Gauss in his Disquisitiones Arithmeticae of 1801. 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." 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.

Statement 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 ni are pairwise coprime, and if a1, ..., ak are any integers, then the system

x≡a1(modn1)⋮x≡ak(modnk), has a solution, and any two solutions, say x1 and x2, are congruent modulo N, that is, x1 ≡ x2 (mod N ). In abstract algebra, the theorem is often restated as: If the ni are pairwise coprime, the map

xmodN↦(xmodn1,…,xmodnk) defines a ring isomorphism

ℤ/Nℤ≅ℤ/n1ℤ×⋯×ℤ/nkℤ 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 ℤ/Nℤ, one may do the same computation independently in each ℤ/niℤ 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.

Proof The existence and the uniqueness of the solution may be proven independently. However, the first proof of existence, given below, uses this uniqueness.

Uniqueness Suppose that x and y are both solutions to all the congruences. As x and y give the same remainder, when divided by ni, their difference x − y is a multiple of each ni. As the ni are pairwise coprime, their product N also divides x − y, and thus x and y are congruent modulo N. If x and y are supposed to be non-negative and less than N (as in the first statement of the theorem), then their difference may be a multiple of N only if x = y.

Existence (first proof) The map

xmodN↦(xmodn1,…,xmodnk) maps congruence classes modulo N to sequences of congruence classes modulo ni. 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) Existence may be established by an explicit construction of x. 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 moduli We want to solve the system:

x≡a1(modn1)x≡a2(modn2), where n1 and n2 are coprime. Bézout's identity asserts the existence of two integers m1 and m2 such that

m1n1+m2n2=1. The integers m1 and m2 may be computed by the extended Euclidean algorithm. A solution is given by

x=a1m2n2+a2m1n1. Indeed,

x=a1m2n2+a2m1n1=a1(1−m1n1)+a2m1n1=a1+(a2−a1)m1n1, implying that x≡a1(modn1). The second congruence is proved similarly, by exchanging the subscripts 1 and 2.

General case Consider a sequence of congruence equations:

x≡a1(modn1)⋮x≡ak(modnk), where the ni are pairwise coprime. The two first equations have a solution a1,2 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

… excerpt ends here. Continue reading the full article.

Illustrations

Chinese remainder theorem: Sunzi's original formulation: x ≡ 2 (mod 3) ≡ 3 (mod 5) ≡ 2 (mod 7) with the solution x = 23 + 105k, with k an integer
Sunzi's original formulation: x ≡ 2 (mod 3) ≡ 3 (mod 5) ≡ 2 (mod 7) with the solution x = 23 + 105k, with k an integer
Chinese remainder theorem: The Chinese remainder theorem appears in Gauss's 1801 book Disquisitiones Arithmeticae.[9]
The Chinese remainder theorem appears in Gauss's 1801 book Disquisitiones Arithmeticae.[9]
Chinese remainder theorem: Using a sieve to find the two smallest solutions of the original formulation of the Chinese remainder theorem problem, 23 and 128
Using a sieve to find the two smallest solutions of the original formulation of the Chinese remainder theorem problem, 23 and 128

Worked examples

Example 1 — a first encounter with Chinese remainder theorem

Start with the simplest possible case. Write down what Chinese remainder theorem claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In mathematics, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Chinese remainder theorem before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Chinese remainder theorem ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Chinese remainder theorem

In research
Chinese remainder theorem appears in mathematics research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Chinese remainder theorem in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Chinese remainder theorem is common in secondary-school and first-year university syllabi. It links to neighbouring topics Chinese mathematical discoveries, Commutative algebra, Modular arithmetic, so understanding it makes those chapters shorter.
In everyday life
Look for Chinese remainder theorem outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Chinese remainder theorem” →

How to study Chinese remainder theorem in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Chinese remainder theorem means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Chinese remainder theorem out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Chinese remainder theorem in simple terms?

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 pairwis…

Why does Chinese remainder theorem matter?

Because it connects several mathematics ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Chinese remainder theorem?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Chinese remainder theorem.

Tags

  • Chinese mathematical discoveries
  • Commutative algebra
  • Modular arithmetic
  • Theorems in number theory

Keep exploring