Skip to content
← All questions

How does the remainder sequence trick avoid calculating large numbers when solving a congruence in the Chinese Remainder Theorem?

Instead of computing large terms in the arithmetic progression, the trick computes the sequence of remainders modulo the new target modulus. It starts with the current solution's remainder and repeatedly adds the step size's remainder modulo the target, stopping when the target remainder is reached. The number of steps gives the multiplier for the solution.

Conditions

  • You have an arithmetic progression of candidates satisfying previous congruences.
  • You need to find the first term satisfying a new congruence x ≡ r (mod m).

Reasoning, step by step

  1. Take the current starting solution modulo the new target modulus m.
  2. Take the current step size modulo the new target modulus m.
  3. Generate a sequence of remainders by repeatedly adding the step size's remainder modulo m.
  4. Count how many additions are needed to reach the target remainder r.
  5. Multiply the step size by this count and add it to the starting solution to get the new particular solution.

Example

To satisfy x ≡ 3 (mod 7) with a starting solution of 21 and step size 60, the video computes 21 mod 7=07 = 0 and 60 mod 7=47 = 4. It generates the remainder sequence 0, 4, 1, 5, 2, 6, 3. Reaching 3 takes 6 steps, so the solution is 21+6∗60=38121 + 6*60 = 381.

Common misconceptions

  • Calculating the actual large numbers in the progression (e.g., 21, 81, 141...) and checking their remainders manually.
  • Forgetting to take the modulo at each step of the remainder sequence.

Watch the explanation

Connected concepts

Explore next

Related questions

Understand why

↗
Understand why

↗
Meet the concept

↗
Find a method

↗

Answers are generated from source material and independently checked. Consult the original video or creator if something is unclear.