Congruences and Remainders
Section titled “Congruences and Remainders”For a positive integer , write when . The integers have the same remainder after division by . Congruences let us discard information that is irrelevant to a divisibility or remainder question.
We can add, subtract, and multiply congruences with the same modulus. We can also raise them to nonnegative integer powers. Reducing intermediate results keeps calculations small.
Example. Find the remainder when is divided by .
The last digits of successive powers of seven are , then repeat because . Since ,
A table suggests a cycle; an identity such as proves the repetition. For longer exponents, repeated squaring is another efficient method.
Inverses and Safe Cancellation
Section titled “Inverses and Safe Cancellation”A modular inverse of modulo is an integer with . It exists exactly when , by Bézout’s identity.
Example. Solve .
The Euclidean algorithm gives , so . Multiplying by the inverse,
Check: .
If , the congruence has solutions exactly when . In that case, divide the coefficients and the modulus by , then solve the reduced congruence. There are solution classes modulo the original modulus.
Example. Solve .
Divide all three numbers by two to get . Since , we have . Modulo this gives or .
Canceling the six while keeping modulus would not be valid because six has no inverse modulo fourteen.
Chinese Remainder Theorem
Section titled “Chinese Remainder Theorem”For coprime positive moduli , any pair of congruences
has exactly one solution class modulo . A practical way to find it is to write and substitute into the other congruence.
Example. Find the smallest positive integer satisfying and .
Write . The second congruence becomes , so . Therefore , and the smallest positive solution is .
For noncoprime moduli, compatibility is required: . Compatible systems have one class modulo . For instance, and are incompatible because they force opposite parities.
Bases, Digits, and Divisibility Tests
Section titled “Bases, Digits, and Divisibility Tests”The base- numeral with digits represents , where . Modulo , the base is one, so is congruent to its digit sum. Modulo , the base is negative one, so is congruent to its alternating digit sum.
Example. Find the digit for which the decimal number is divisible by .
The digit sum is . This must be divisible by nine. Since , the only possibility is , so .
To specify the last two digits in base , work modulo . For decimal endings, that means modulo , not modulo .
Ruling Out Integer Solutions
Section titled “Ruling Out Integer Solutions”A congruence obstruction is enough to prove no integer solution exists. First list possible residues of the powers involved, then compare with the required residue.
Example. Prove that has no integer solutions.
An integer square is or modulo four. The sum of two squares can therefore be or , but never modulo four. The right side is always modulo four, giving a contradiction.
Why Linear Congruences Have Several Solutions
Section titled “Why Linear Congruences Have Several Solutions”Suppose and . The equivalent equation shows that is necessary. If it holds, divide by to obtain a congruence modulo with an invertible coefficient.
A single solution class modulo becomes classes modulo , separated by . This explains the solution count and the change of modulus at the same time.
Example. Find all residue classes modulo sixty satisfying .
The GCD is six, which divides twenty-four. Divide to get . The inverse of three modulo ten is seven, so .
The six classes modulo sixty are
Each differs from the next by ten, not sixty. Substituting the first gives , and adding ten to changes the left side by a multiple of sixty.
If the GCD did not divide the right side, there would be no solution at all. Checking this condition before finding an inverse avoids an impossible calculation.
Constructing CRT Solutions
Section titled “Constructing CRT Solutions”For pairwise coprime moduli , let and . Since is invertible modulo , choose with . Then
satisfies for every . Each term is zero modulo all the other moduli and has the desired value modulo its own modulus.
Uniqueness modulo follows because the difference of two solutions is divisible by every coprime modulus and hence by their product. This proof explains both parts of CRT rather than treating it as a search rule.
Example. Solve , , and .
Here . The complementary products are twenty, fifteen, and twelve, whose inverses modulo their respective moduli are two, three, and three. Therefore
The least nonnegative solution is fifty-eight. Direct substitution checks the three remainders.
For a system with noncoprime moduli, compare the required residues modulo their GCD first. Compatible systems can be merged two at a time, using the least common multiple as the new modulus. The product modulus is correct only in the coprime case.
Large Powers with a Noninvertible Base
Section titled “Large Powers with a Noninvertible Base”Euler’s theorem cannot reduce an exponent when the base shares a factor with the modulus. A useful replacement is to split the modulus into coprime prime-power factors. On a factor dividing the base, a sufficiently large power becomes zero. On the remaining factors, ordinary order or Euler reduction is available.
Example. Find the last three decimal digits of .
Work modulo eight and one hundred twenty-five. The power is zero modulo eight because twelve contains two factors of two and the exponent is large enough.
Modulo , the base is coprime and . Euler gives . Write . The condition modulo eight becomes , giving .
Thus , so the final three digits are 376.
This method avoids the tempting but invalid calculation of reducing the exponent modulo before checking the base. CRT separates the part where the power dies from the part where it cycles.
Square Roots Modulo Composite Numbers
Section titled “Square Roots Modulo Composite Numbers”Modulo a prime, a product is zero only if a factor is zero. Modulo a composite number, zero divisors invalidate that step. Thus need not imply or .
Example. Find all solutions to .
Modulo three, is one or negative one. Modulo five, it is also one or negative one. The four sign combinations are independent and give, by CRT,
For instance, , even though neither nor is divisible by fifteen. The factors split the prime divisors between them.
For an odd squarefree modulus with distinct prime factors, this argument gives square roots of one. Prime powers and powers of two require separate analysis; the squarefree statement should not be extended without checking those cases.
For odd prime powers, the two factors have GCD dividing two. An odd prime cannot divide both, so its entire required power must lie in one factor. This explains why there are only two roots of one modulo an odd prime power.
Numeral Bases and Division Pitfalls
Section titled “Numeral Bases and Division Pitfalls”Digit tests come from the base’s residue, not from decimal notation itself. In base , the value is congruent to the digit sum modulo and to the alternating digit sum modulo . Also, the last digits determine the remainder modulo .
Example. The base- numeral with digits 3, 4, 5 is divisible by . Find every possible base.
The digits require . Since , the integer must divide twelve and be at least five. It is therefore six or twelve, giving or .
Both bases satisfy the digit restriction and the divisibility condition.
A repeated-digit number often has a quotient representation, such as for a string of decimal ones. Do not divide a congruence by nine modulo a multiple of three. The quotient is an integer, but nine does not have a modular inverse there.
For example, is divisible by twenty-seven, but is not. To prove by clearing this quotient, require , not merely .
Combining Moduli with Descent
Section titled “Combining Moduli with Descent”A residue obstruction may become visible only after removing forced factors. If three squares sum to a multiple of four, each square must be zero modulo four: with only three terms, a sum of residues zero or one cannot otherwise be zero.
Thus every variable is even, and the equation can be divided by four. Repeating this step strips powers of four before testing modulo eight.
Example. Prove that no integer of the form , with , can be a sum of three integer squares.
Suppose . If , the preceding modulo-four argument forces all variables even. Divide by four and repeat until the right side is .
A square modulo eight is zero, one, or four. Three such residues cannot sum to seven: with no four the sum is at most three; with one four the other two give residues zero, one, or two; with at least two fours the remaining residue gives zero, one, or four modulo eight. This is a contradiction.
The argument proves a necessary obstruction, not the full classification of sums of three squares. Keep that distinction when using a modular proof to infer existence.
Lifting a Square Root One Prime Power at a Time
Section titled “Lifting a Square Root One Prime Power at a Time”Suppose . Every lift of this residue modulo has the form . Expanding and dividing the known multiple of gives
If , this is a linear congruence with one solution for modulo . Thus each nondegenerate root has a unique lift. This is an elementary instance of Hensel lifting, distinct from LTE’s valuation formula.
Example. Find all square roots of two modulo forty-nine.
Modulo seven, the roots are three and four. Lift three by writing . Then , so . This gives and root ten.
The negative root is thirty-nine. Both original roots lift uniquely, so the complete list is ten and thirty-nine.
Fractions in a Prime Modulus
Section titled “Fractions in a Prime Modulus”A fraction modulo a prime means multiplication by an inverse. Its denominator must be nonzero modulo that prime. Record excluded values before clearing denominators.
Example. Solve .
Exclude . Multiplying by the invertible denominator gives , or . The square roots of two modulo seven are three and negative three, so or five.
Neither is excluded, and substitution verifies both. At four, the inverses are five and three, whose sum is one modulo seven. The other candidate works the same way.
The polynomial obtained by clearing denominators may have a root at an excluded value in other problems. Solving it is only the candidate-generation step; the original modular domain must still be checked.
Degenerate Roots Can Have Several Lifts
Section titled “Degenerate Roots Can Have Several Lifts”The coefficient in a square-root lifting equation must be invertible for uniqueness. If it vanishes modulo the prime, there may be several lifts or none.
For example, is equivalent to . Its solutions modulo are , giving different lifts of the single zero root modulo .
Thus “every root lifts uniquely” requires the nondegeneracy hypothesis. The expansion proves which linear congruence must be solved and makes the exceptional case visible rather than hiding it in a memorized theorem.