Sign in to save

Bookmark this page so you can find it later.

Sign in to save

Bookmark this page so you can find it later.

The Chinese Remainder Theorem is a powerful method for solving systems of congruences with different moduli. This cheat sheet helps students organize the conditions, notation, and construction steps needed to solve CRT problems accurately. It is especially useful in number theory, contest math, cryptography, and modular arithmetic applications.

Key Facts

  • A congruence xa(modm)x \equiv a \pmod{m} means that mm divides xax-a, or mxam \mid x-a.
  • The Chinese Remainder Theorem applies directly when the moduli m1,m2,,mkm_1,m_2,\ldots,m_k are pairwise coprime, meaning gcd(mi,mj)=1\gcd(m_i,m_j)=1 for iji \ne j.
  • If the moduli are pairwise coprime, the system xai(modmi)x \equiv a_i \pmod{m_i} has one unique solution modulo M=m1m2mkM=m_1m_2\cdots m_k.
  • For each congruence, define Mi=MmiM_i=\frac{M}{m_i}, where M=m1m2mkM=m_1m_2\cdots m_k.
  • The modular inverse yiy_i is chosen so that Miyi1(modmi)M_i y_i \equiv 1 \pmod{m_i}.
  • A CRT solution is xi=1kaiMiyi(modM)x \equiv \sum_{i=1}^{k} a_i M_i y_i \pmod{M}.
  • For two congruences xa(modm)x \equiv a \pmod{m} and xb(modn)x \equiv b \pmod{n} with gcd(m,n)=1\gcd(m,n)=1, the solution is unique modulo mnmn.
  • If moduli are not coprime, a solution exists only when aiaj(modgcd(mi,mj))a_i \equiv a_j \pmod{\gcd(m_i,m_j)} for every pair of congruences.

Vocabulary

Congruence
A statement such as xa(modm)x \equiv a \pmod{m} saying that xx and aa have the same remainder when divided by mm.
Modulus
The positive integer mm in xa(modm)x \equiv a \pmod{m} that determines the remainder system being used.
Pairwise coprime
A set of integers is pairwise coprime when every two different integers in the set have greatest common divisor 11.
Modular inverse
The modular inverse of aa modulo mm is a number a1a^{-1} such that aa11(modm)aa^{-1} \equiv 1 \pmod{m}.
Residue class
A residue class modulo mm is the set of all integers congruent to the same remainder modulo mm.
Unique modulo MM
A solution is unique modulo MM when all solutions differ from it by a multiple of MM.

Common Mistakes to Avoid

  • Forgetting to check that the moduli are pairwise coprime is wrong because the standard CRT formula requires gcd(mi,mj)=1\gcd(m_i,m_j)=1 for every pair.
  • Using Mi=miM_i=m_i instead of Mi=MmiM_i=\frac{M}{m_i} is wrong because each MiM_i must include all moduli except the one for its own congruence.
  • Finding the inverse of the wrong number is wrong because yiy_i must satisfy Miyi1(modmi)M_i y_i \equiv 1 \pmod{m_i}, not miyi1(modMi)m_i y_i \equiv 1 \pmod{M_i}.
  • Stopping before reducing the final answer is wrong because the solution should be written as xr(modM)x \equiv r \pmod{M} with 0r<M0 \le r < M when possible.
  • Assuming non-coprime systems never have solutions is wrong because they can be consistent when aiaj(modgcd(mi,mj))a_i \equiv a_j \pmod{\gcd(m_i,m_j)}.

Practice Questions

  1. 1 Solve the system x2(mod3)x \equiv 2 \pmod{3}, x3(mod5)x \equiv 3 \pmod{5}, and x2(mod7)x \equiv 2 \pmod{7}.
  2. 2 Solve the system x1(mod4)x \equiv 1 \pmod{4} and x4(mod9)x \equiv 4 \pmod{9}, and write the answer modulo 3636.
  3. 3 Find the modular inverse of 1010 modulo 1717, then use it to solve 10x6(mod17)10x \equiv 6 \pmod{17}.
  4. 4 Explain why the system x2(mod6)x \equiv 2 \pmod{6} and x5(mod9)x \equiv 5 \pmod{9} has no solution, using the greatest common divisor condition.

Understanding Chinese Remainder Theorem Reference

A useful way to picture a congruence is as a position on a repeating cycle. On a clock with twelve positions, numbers separated by twelve land in the same place. A system of congruences asks for one number that lands at specified positions on several cycles at once.

Each condition removes many possible numbers. When the cycle lengths have no shared factors, their patterns combine cleanly.

The full pattern does not repeat until every cycle has returned to its starting point together. This explains why the final repeating interval is much larger than any one modulus.

The construction method works because each built term is designed to affect one condition while becoming invisible to the others. Start with the product of all moduli, then remove one modulus from that product. The remaining factor contains every other modulus, so it is a multiple of each of them.

It therefore leaves a remainder of zero for all the other conditions. It only needs adjustment for the condition left out. A modular inverse provides that adjustment.

Multiplying by the inverse turns the remaining factor into a remainder of one for its selected modulus. Multiplying once more by the required remainder creates a term that contributes exactly the needed value in one place and zero everywhere else.

Finding inverses is often the part that needs the most care. Students can use trial multiplication for small moduli, but the extended Euclidean algorithm is more reliable for larger values. That algorithm works backward from the greatest common divisor and expresses one as a combination of two numbers.

When the greatest common divisor is one, the coefficient of one number gives an inverse of the other after reducing it to the correct cycle. A negative inverse is not a problem. It can be replaced by adding the modulus until a positive representative appears.

This is one reason modular arithmetic feels different from ordinary arithmetic. Many different integers can represent the same residue.

When moduli share a factor, the restrictions may disagree before any calculation begins. Think of two bus schedules that repeat at different intervals but must meet at the same time. If one condition requires an odd number and another requires an even number, no number can satisfy both.

If they agree on the shared pattern, the system can often be simplified before solving it. The final repeat length is then based on the least common multiple rather than simply multiplying every modulus.

In school problems, check compatibility early, keep each intermediate remainder reduced, and verify the final answer in every original condition. In computing, the same ideas support calendar cycles, data reconstruction, and parts of public key cryptography.