Independent Congruence Conditions
The Chinese remainder theorem describes when several congruence conditions can be combined into one congruence. Its cleanest form occurs when the moduli are pairwise coprime.
Suppose
n1,n2,…,nrare positive integers satisfying
gcd(ni,nj)=1whenever
i=j.Then the congruences
x≡a1(modn1),x≡a2(modn2),⋯x≡ar(modnr)have a unique solution modulo
N=n1n2⋯nr.This means all integer solutions form exactly one residue class modulo N.
The Case of Two Moduli
First consider
x≡a(modm),x≡b(modn),where
gcd(m,n)=1.Write
x=a+mk.Substituting into the second congruence gives
a+mk≡b(modn).Thus
mk≡b−a(modn).Since
gcd(m,n)=1,the integer m has an inverse modulo n. Therefore this linear congruence has a unique solution modulo n. Once k is determined, x=a+mk gives a solution to the original system.
The solution is unique modulo mn.
Example
Solve
x≡2(mod3),x≡3(mod5).Write
x=2+3k.Then
2+3k≡3(mod5),so
3k≡1(mod5).Since
3−1≡2(mod5),we get
k≡2(mod5).Thus
k=2+5t.Hence
x=2+3(2+5t)=8+15t.Therefore
x≡8(mod15).Constructive Formula
The theorem also has an explicit constructive formula.
Let
N=n1n2⋯nr.For each i, define
Ni=niN.Since the moduli are pairwise coprime,
gcd(Ni,ni)=1.Therefore Ni has an inverse modulo ni. Choose yi such that
Niyi≡1(modni).Then a solution is
x≡i=1∑raiNiyi(modN).To see why, reduce this expression modulo nj. If i=j, then nj∣Ni, so
aiNiyi≡0(modnj).Only the j-th term remains:
x≡ajNjyj≡aj(modnj).Thus the formula satisfies every congruence.
Example with Three Moduli
Solve
x≡2(mod3),x≡3(mod5),x≡2(mod7).The moduli are pairwise coprime, and
N=3⋅5⋅7=105.Compute
N1=35,N2=21,N3=15.Now find inverses:
35≡2(mod3),and
2−1≡2(mod3),so
y1=2.Next,
21≡1(mod5),so
y2=1.Finally,
15≡1(mod7),so
y3=1.Therefore
x≡2⋅35⋅2+3⋅21⋅1+2⋅15⋅1(mod105).This gives
x≡140+63+30=233(mod105).Since
233≡23(mod105),the solution is
x≡23(mod105).Uniqueness
Suppose x and x′ both solve the same system. Then for every i,
x≡x′(modni).Thus
ni∣(x−x′)for each i.
Since the ni are pairwise coprime, their product divides x−x′:
N∣(x−x′).Therefore
x≡x′(modN).This proves uniqueness modulo N.
Ring Form
The Chinese remainder theorem can be expressed as an isomorphism of rings:
Z/NZ≅Z/n1Z×Z/n2Z×⋯×Z/nrZ,where
N=n1n2⋯nrand the moduli are pairwise coprime.
The map sends a residue class [x]N to
([x]n1,[x]n2,…,[x]nr).The theorem says this map is bijective and respects addition and multiplication.
General Compatibility
If the moduli are not pairwise coprime, a system may still have solutions, but compatibility conditions are required.
The system
x≡ai(modni)is solvable exactly when
ai≡aj(modgcd(ni,nj))for every pair i,j.
When solvable, the solution is unique modulo
lcm(n1,n2,…,nr).Thus the pairwise coprime case is the special case where all compatibility conditions are automatic.
Role in Number Theory
The Chinese remainder theorem shows that arithmetic modulo a product of coprime moduli decomposes into independent arithmetic modulo each factor.
This principle is fundamental in modular arithmetic, computation, cryptography, algebraic number theory, and local-global reasoning.
It lets one replace a difficult congruence modulo N by several simpler congruences modulo the prime-power factors of N. This is one of the main ways number theory breaks a global problem into local pieces.