Fiveable

๐ŸงฎAdditive Combinatorics Unit 2 Review

QR code for Additive Combinatorics practice questions

2.4 The Chinese Remainder Theorem

2.4 The Chinese Remainder Theorem

Written by the Fiveable Content Team โ€ข Last updated August 2025
Written by the Fiveable Content Team โ€ข Last updated August 2025
๐ŸงฎAdditive Combinatorics
Unit & Topic Study Guides

The Chinese Remainder Theorem is a powerful tool in number theory, allowing us to solve systems of congruences with coprime moduli. It's like a mathematical puzzle solver, finding unique solutions to complex equations by breaking them into simpler parts.

This theorem connects to the broader study of additive number theory by providing a way to work with modular arithmetic efficiently. It's essential for various applications, from cryptography to computer science, showcasing how fundamental number theory concepts can solve real-world problems.

Chinese Remainder Theorem

Statement and Proof

  • States if n1,n2,...,nkn_1, n_2, ..., n_k are pairwise coprime positive integers and a1,a2,...,aka_1, a_2, ..., a_k are any integers, then the system of simultaneous congruences xโ‰กa1(modn1),xโ‰กa2(modn2),...,xโ‰กak(modnk)x \equiv a_1 \pmod {n_1}, x \equiv a_2 \pmod {n_2}, ..., x \equiv a_k \pmod {n_k} has a unique solution modulo N=n1ร—n2ร—...ร—nkN = n_1 \times n_2 \times ... \times n_k
  • Proves the theorem by constructing a solution using the following steps:
    • Let N=n1ร—n2ร—...ร—nkN = n_1 \times n_2 \times ... \times n_k and Ni=N/niN_i = N / n_i for each ii
    • Find integers yiy_i such that Niร—yiโ‰ก1(modni)N_i \times y_i \equiv 1 \pmod {n_i} using the extended Euclidean algorithm
    • The solution is given by x=a1ร—N1ร—y1+a2ร—N2ร—y2+...+akร—Nkร—ykx = a_1 \times N_1 \times y_1 + a_2 \times N_2 \times y_2 + ... + a_k \times N_k \times y_k
  • Proves the uniqueness of the solution by assuming two solutions x1x_1 and x2x_2 and showing that x1โ‰กx2(modN)x_1 \equiv x_2 \pmod N

Ring Isomorphisms

  • Establishes an isomorphism between the ring Z/NZ\mathbb{Z}/N\mathbb{Z} and the product of rings Z/n1Zร—Z/n2Zร—...ร—Z/nkZ\mathbb{Z}/n_1\mathbb{Z} \times \mathbb{Z}/n_2\mathbb{Z} \times ... \times \mathbb{Z}/n_k\mathbb{Z}, where N=n1ร—n2ร—...ร—nkN = n_1 \times n_2 \times ... \times n_k and n1,n2,...,nkn_1, n_2, ..., n_k are pairwise coprime
  • The isomorphism is given by the map ฯ•:Z/NZโ†’Z/n1Zร—Z/n2Zร—...ร—Z/nkZ\phi: \mathbb{Z}/N\mathbb{Z} \to \mathbb{Z}/n_1\mathbb{Z} \times \mathbb{Z}/n_2\mathbb{Z} \times ... \times \mathbb{Z}/n_k\mathbb{Z} defined by ฯ•(xโ€Šmodโ€ŠN)=(xโ€Šmodโ€Šn1,xโ€Šmodโ€Šn2,...,xโ€Šmodโ€Šnk)\phi(x \bmod N) = (x \bmod n_1, x \bmod n_2, ..., x \bmod n_k)
  • The inverse map ฯ•โˆ’1:Z/n1Zร—Z/n2Zร—...ร—Z/nkZโ†’Z/NZ\phi^{-1}: \mathbb{Z}/n_1\mathbb{Z} \times \mathbb{Z}/n_2\mathbb{Z} \times ... \times \mathbb{Z}/n_k\mathbb{Z} \to \mathbb{Z}/N\mathbb{Z} is given by the Chinese Remainder Theorem, which constructs a unique element xโˆˆZ/NZx \in \mathbb{Z}/N\mathbb{Z} from its residues (a1,a2,...,ak)(a_1, a_2, ..., a_k) modulo n1,n2,...,nkn_1, n_2, ..., n_k
  • Allows for the reduction of computations in Z/NZ\mathbb{Z}/N\mathbb{Z} to computations in the smaller rings Z/n1Z,Z/n2Z,...,Z/nkZ\mathbb{Z}/n_1\mathbb{Z}, \mathbb{Z}/n_2\mathbb{Z}, ..., \mathbb{Z}/n_k\mathbb{Z}, simplifying calculations and improving efficiency
Statement and Proof, elementary number theory - Extended Euclidean Algorithm and Chinese Remainder Theorem ...

Solving Linear Congruences

Application of the Chinese Remainder Theorem

  • Used to solve systems of linear congruences of the form xโ‰กa1(modn1),xโ‰กa2(modn2),...,xโ‰กak(modnk)x \equiv a_1 \pmod {n_1}, x \equiv a_2 \pmod {n_2}, ..., x \equiv a_k \pmod {n_k}, where n1,n2,...,nkn_1, n_2, ..., n_k are pairwise coprime
  • To apply the theorem, follow these steps:
    • Check that the moduli n1,n2,...,nkn_1, n_2, ..., n_k are pairwise coprime
    • Calculate N=n1ร—n2ร—...ร—nkN = n_1 \times n_2 \times ... \times n_k and Ni=N/niN_i = N / n_i for each ii
    • Find integers yiy_i such that Niร—yiโ‰ก1(modni)N_i \times y_i \equiv 1 \pmod {n_i} using the extended Euclidean algorithm
    • Compute the solution x=a1ร—N1ร—y1+a2ร—N2ร—y2+...+akร—Nkร—ykx = a_1 \times N_1 \times y_1 + a_2 \times N_2 \times y_2 + ... + a_k \times N_k \times y_k
  • The solution xx obtained is unique modulo NN, ensuring a single solution to the system of congruences
Statement and Proof, RSA Encryption using Chinese Remainder Theorem and Fermat's Little Theorem - Mathematics Stack ...

Examples

  • Solve the system of congruences: xโ‰ก2(mod3),xโ‰ก3(mod5),xโ‰ก2(mod7)x \equiv 2 \pmod 3, x \equiv 3 \pmod 5, x \equiv 2 \pmod 7
    • Check that 3,5,73, 5, 7 are pairwise coprime
    • Calculate N=3ร—5ร—7=105N = 3 \times 5 \times 7 = 105, N1=35N_1 = 35, N2=21N_2 = 21, N3=15N_3 = 15
    • Find y1=2y_1 = 2, y2=1y_2 = 1, y3=1y_3 = 1 using the extended Euclidean algorithm
    • Compute the solution x=2ร—35ร—2+3ร—21ร—1+2ร—15ร—1=233x = 2 \times 35 \times 2 + 3 \times 21 \times 1 + 2 \times 15 \times 1 = 233
    • The unique solution modulo 105105 is 2323
  • Solve the system of congruences: xโ‰ก1(mod4),xโ‰ก2(mod9),xโ‰ก5(mod11)x \equiv 1 \pmod 4, x \equiv 2 \pmod 9, x \equiv 5 \pmod {11}
    • Check that 4,9,114, 9, 11 are pairwise coprime
    • Calculate N=4ร—9ร—11=396N = 4 \times 9 \times 11 = 396, N1=99N_1 = 99, N2=44N_2 = 44, N3=36N_3 = 36
    • Find y1=3y_1 = 3, y2=5y_2 = 5, y3=4y_3 = 4 using the extended Euclidean algorithm
    • Compute the solution x=1ร—99ร—3+2ร—44ร—5+5ร—36ร—4=1417x = 1 \times 99 \times 3 + 2 \times 44 \times 5 + 5 \times 36 \times 4 = 1417
    • The unique solution modulo 396396 is 229229

Cryptographic Applications

RSA Cryptosystem

  • The Chinese Remainder Theorem is used to speed up the decryption process in the RSA cryptosystem
  • The modulus NN is the product of two large primes pp and qq
  • The decryption exponent dd is computed modulo ฯ•(N)=(pโˆ’1)(qโˆ’1)\phi(N) = (p-1)(q-1)
  • To decrypt a ciphertext cc, compute m1=cdโ€Šmodโ€Špm_1 = c^d \bmod p and m2=cdโ€Šmodโ€Šqm_2 = c^d \bmod q, then use the Chinese Remainder Theorem to find the unique message mm modulo NN
  • This method is more efficient than directly computing m=cdโ€Šmodโ€ŠNm = c^d \bmod N, as it involves smaller modular exponentiations and the Chinese Remainder Theorem reconstruction

Paillier Cryptosystem

  • The Chinese Remainder Theorem is used in the key generation process of the Paillier cryptosystem
  • The public key is N=pqN = pq, where pp and qq are large primes
  • The private key is (ฮป,ฮผ)(\lambda, \mu), where ฮป=lcm(pโˆ’1,qโˆ’1)\lambda = \text{lcm}(p-1, q-1) and ฮผ=(L(gฮปโ€Šmodโ€ŠN2))โˆ’1โ€Šmodโ€ŠN\mu = (L(g^\lambda \bmod N^2))^{-1} \bmod N, with L(x)=(xโˆ’1)/NL(x) = (x-1)/N and gg chosen such that gcdโก(L(gฮปโ€Šmodโ€ŠN2),N)=1\gcd(L(g^\lambda \bmod N^2), N) = 1
  • The Chinese Remainder Theorem is used to compute ฮผ\mu efficiently by working modulo pp and qq separately, reducing the complexity of the calculations
  • This application of the Chinese Remainder Theorem enables the efficient generation of the private key in the Paillier cryptosystem