2.5.10 · D5Number Theory (Intermediate)

Question bank — Chinese Remainder Theorem (intro)

2,088 words9 min readBack to topic

Before you start, keep three plain-word anchors in mind:

  • A congruence just says " and leave the same remainder when divided by " — equivalently, divides .
  • Coprime () means two numbers share no prime factor.
  • "Unique modulo " means there is exactly one solution in the window , and every other solution is that one plus a whole number of 's.

The picture behind CRT — one screen so the symbols are earned

Every question below leans on three symbols: , and . Let us fix them with a picture before they appear in a trap, using the concrete system .

The next figure shows why each of these three numbers exists: each modulus draws a repeating "remainder colouring" of the number line, and CRT asks for the one point where all three colourings agree inside .

Figure — Chinese Remainder Theorem (intro)

Now watch a single term do its job. is already in every slot but the -th; multiplying by makes it in its own slot; multiplying by makes it there. The three terms are like three spotlights, each lighting exactly one congruence and staying dark on the others.

Figure — Chinese Remainder Theorem (intro)

True or false — justify

CRT with coprime moduli always has at least one solution.
True. Coprimality guarantees the needed inverses exist, so the constructive formula produces a concrete — existence is never in doubt when moduli are pairwise coprime.
If the moduli are pairwise coprime, the solution is unique over all integers.
False. It is unique only modulo ; there are infinitely many integer solutions, all differing by multiples of . Uniqueness means one per length- window.
"Pairwise coprime" and "the whole product is coprime to each modulus" say the same thing.
Roughly yes for the pairwise part, but the real requirement is that each pair shares no factor. have of all three yet are not pairwise coprime (), so CRT's basic form does not apply.
A system with non-coprime moduli can still have a solution.
True — sometimes. If the overlapping constraints happen to agree (e.g. ), a solution exists; it just isn't guaranteed and the modulus of uniqueness becomes , not the product.
The number of solutions in is always exactly one when moduli are coprime.
True. That is the whole content of "unique solution modulo ": precisely one residue class works.
If and the constraints agree, the solution is unique modulo .
False. It is unique modulo , which is smaller than the product. The overlap collapses the effective range.
Swapping the order of the congruences changes the answer.
False. The solution set is a property of the constraints, not their listing order. Reordering only reshuffles the terms in the sum ; the total is the same modulo .
Every integer is a valid right-hand side, even a huge or negative one.
True. CRT places no limit on the ; they are just residues. A negative is fine — reduce it mod if you like, but you needn't.

Spot the error

"The inverse of modulo is ."
Wrong — there is no fraction here. A modular inverse is an integer with ; that's since . Ordinary division doesn't exist in modular arithmetic.
" is times ."
Wrong — it's , the product of all moduli except (in our worked case , not ). This makes divisible by every other modulus (so contributing there) while staying coprime to .
"I'll apply CRT to using the standard formula."
Wrong — , so the basic formula fails: doesn't exist. Also the constraints conflict ( even vs odd), so there's no solution at all.
"Since each term satisfies the -th congruence, the sum satisfies all of them."
Correct reasoning, actually — no error. Each other term is , so only the -th term survives mod , giving . The trap is doubting a true statement.
", so the term equals ."
Wrong — the inverse relation holds only , not . is mod but mod the other moduli; it is not mod the whole .
" needs to be checked separately each time."
Unnecessary — it's automatic. Because the are pairwise coprime to , their product shares no factor with , so for free.
"If one congruence is , CRT can't handle it."
Wrong — is a perfectly ordinary residue. The term just vanishes; the other congruences still pin down . Nothing breaks.

Why questions

Why does coprimality make the constraints "independent"?
Because two coprime moduli share no prime, no single prime power is constrained twice. Their remainder conditions carve the number line along disjoint axes, so no two conditions can ever contradict (see the non-overlapping colourings in figure s01).
Why must be coprime to for the construction to work?
Only a number coprime to has an inverse mod . Without that inverse , we couldn't scale to be , and the term wouldn't deliver to the -th slot (this is the "turn the spotlight to " step in figure s02).
Why does the term contribute to every other congruence?
Because is a multiple of every with . Any multiple of is , so those terms silently disappear when you reduce mod — the dark cells in figure s02.
Why is the modulus of uniqueness the product and not something smaller?
When moduli are pairwise coprime there is no shared structure to collapse, so the combined "period" is the full product. The combined constraint repeats only every steps.
Why can a single congruence be seen as CRT with ?
Trivially: with one modulus, , , , and the formula returns . CRT is the multi-constraint generalisation of this base case.
Why does CRT underpin RSA speed-ups?
RSA works modulo with distinct primes (hence coprime). CRT lets you compute mod and mod separately — much cheaper — then reassemble, exploiting that mod is determined by its pair of residues.
Why does Fermat's Little Theorem pair naturally with CRT in these applications?
Fermat gives cheap exponent reductions mod each prime (), and CRT is the machine that glues the per-prime results back into one answer mod the product. They divide and conquer together.
Why doesn't reducing each modulo first change the answer?
Because a congruence only cares about the remainder. Replacing by gives the identical constraint, so the solution set is untouched — it just keeps the numbers small.

The general-gcd case — when moduli are not coprime

The basic theorem demands coprime moduli, but the world often hands you moduli that share factors. There is a repaired version, and these items make it precise.

Two congruences with are solvable exactly when what condition holds?
When — the two right-hand sides must already agree on the shared part . Otherwise one demands (say) even and the other odd, and no can satisfy both.
When that solvability condition holds, over what modulus is the solution unique?
Modulo , not the product. The shared factor is counted once, not twice, so the combined period shrinks.
How can you reduce a non-coprime system to a coprime one?
Split each modulus into prime powers, keep one copy of each prime power (the strongest constraint), and check the overlaps agree. What remains is a set of prime-power moduli that are pairwise coprime, so basic CRT applies.
Why does gluing prime-power pieces recover the answer?
Because coprime prime powers multiply to the original modulus, and CRT says residues mod coprime factors determine the residue mod their product. Splitting and re-gluing is loss-free precisely when the factors are coprime.
Is solvable, and if so mod what?
Yes: and (both odd), so it's solvable, unique modulo . The solution is .

Edge cases

What if two moduli are equal, say both ?
Then , violating coprimality. Either the two agree mod (redundant — drop one) or they clash (no solution). Basic CRT does not apply.
What if a modulus is ?
is always true (everything is ), so it adds no information. It's harmlessly coprime to everything and can be ignored; is unchanged.
What is the solution to the empty system (no congruences at all)?
Every integer works — (empty product) and the unique solution mod is the single class containing all integers. It's the vacuous base case.
What happens if ?
The unique solution is — that is, is a multiple of . Each constraint just demands divisibility, and coprimality makes divisibility by all of them equal to divisibility by their product.
Can the CRT solution ever be inside ?
Yes, precisely when every . Then the smallest non-negative representative is ; all other solutions are the positive multiples of .
What if the constraints force larger than ?
They can't in the range sense — the representative is always taken in . Any larger valid is that representative plus a multiple of , so "larger than " just means a different member of the same class.
If moduli are coprime but you mistakenly use instead of the product, what happens?
Nothing goes wrong — for coprime numbers equals the product . The two formulas coincide exactly here; they diverge only when moduli share factors.
Recall Quick self-test

The single fact that decides whether basic CRT applies ::: Whether the moduli are pairwise coprime ( for every pair). The modulus over which the CRT solution is unique ::: , the product of all the moduli. The one true "division" in modular arithmetic ::: multiplication by a modular inverse, which exists exactly when the number is coprime to the modulus. For non-coprime the solution (if any) is unique modulo ::: .