KEVOS
ArticlesServicesCase studiesAboutContact
ArticlesServicesCase studiesAboutContact
← ArticlesChinese Remainder Theorem AlgorithmsEngineering · Engineering MathematicsLesson 717/884← PrevNext →
ArticlePublished 7 Aug 20262 min readBy Kevin JoginChinese remainder theoremCRTGarner algorithmmodular reconstruction
On this page

Ask about this page

KEVOS AIChinese Remainder Theorem Algorithms

KEVOS knowledge first · trusted web sources when needed

Euclidean Algorithms and Congruences

Chinese Remainder Theorem Algorithms

Reconstructing an integer from residues, Garner's incremental method, and CRT as a strategy for controlling coefficient growth.

Engineering / MathematicsEuclidean Algorithms and Congruences2 min readKV-MATH-0516

The Chinese remainder theorem is both a reconstruction tool and a computational strategy. As a strategy it is one of the two standard answers to coefficient explosion, the other being lattice reduction.

The statement

Given pairwise coprime moduli and a residue for each, there is a unique value modulo the product satisfying all the congruences simultaneously.

x = r_i (mod m_i) for each i, unique mod m_1 m_2 ... m_kThe moduli must be pairwise coprime.

Two reconstruction methods

Choosing a CRT reconstruction method
MethodApproachBest when
Direct (Lagrange-style)Build each term with a precomputed idempotent, then sumModuli fixed, many reconstructions
Garner's algorithmIncremental mixed-radix construction, one modulus at a timeModuli discovered progressively; early termination possible

Garner's incremental reconstruction

  1. Take residues in orderProcess moduli one at a time.
  2. Compute the correctionDifference between the target residue and the current partial value, times the inverse of the running product.
  3. AccumulateAdd the correction times the running product.
  4. Update the productMultiply the running product by the new modulus.

Key point

Garner's method allows termination as soon as the reconstructed value stops changing, which is what makes it usable when you do not know in advance how many primes are needed.

The modular strategy

Many computations produce a result far smaller than their intermediate values. Working modulo several small primes and reconstructing avoids the intermediates entirely.

Reduce mod p_1 ... p_k→Compute in each→Reconstruct by CRT→Verify

This is standard in polynomial GCD, determinant computation and linear system solving. See determinant computation and Hensel lifting, which is the prime-power analogue of the same idea.

Two things that can go wrong

Pitfall

First, unlucky primes: a prime dividing a leading coefficient or a resultant gives a wrong result modulo that prime. Detection usually relies on redundancy or a degree check. Second, insufficient primes: if the product does not exceed twice the absolute value of the true result, reconstruction is ambiguous for signed values.

Signed reconstruction

CRT naturally returns a representative in the range from zero to the product. When the true answer may be negative, map representatives above half the product to their negative counterparts — and ensure the bound accounts for this by using twice the expected magnitude.

Source. Henri Cohen, A Course in Computational Algebraic Number Theory, Springer GTM 138 — 1.3.4. Structural reference unverified: the source file was not available during authoring; chapter and section numbers are taken from the published edition and have not been checked against a physical copy.

Related pages

  • Hensel Lifting for Polynomial Factors
  • Prime Decomposition when p Does Not Divide the Index
  • The Extended Euclidean Algorithm and Bezout Coefficients
  • Continued Fraction Expansion of Real Numbers

Continue learning

The Extended Euclidean Algorithm and Bezout CoefficientsArticle · Engineering MathematicsNEXT LESSON →Continued Fraction Expansion of Real NumbersArticle · Engineering MathematicsLehmer's Accelerated GCD ComputationArticle · Engineering MathematicsStructure of the Unit Group Modulo nArticle · Engineering Mathematics
KEVOS · Engineering, manufacturing and project improvement
ArticlesServicesCase studiesAboutContact
© 2026 KEVOS®