8.02e–8.02h - Modular arithmetic and congruences
Calculate with remainders, solve linear congruences, and use quadratic residues to settle equations without searching through every integer. You will combine up to three congruences, including systems whose moduli share a factor, and express every solution rather than one successful example.
Arithmetic with remainders
An integer leaves remainder on division by and remainder on division by . What is the smallest positive integer it could be, and how can you describe every possibility? There are infinitely many candidates, but only a few remainders to organise.
First, consider a simpler calculation. Both and leave remainder on division by . For a question about twelves, replacing by loses nothing useful.
You already know
Division writes a positive integer as , where . The remainder is unique, and a remainder of zero means exact divisibility.
The notation records that two integers differ by a multiple of the modulus.
Congruence
For integers and a modulus ,
means . Equivalently, and have the same remainder on division by . The least non-negative residue is the unique representative in . For example, and , but .
Negative representatives can make arithmetic shorter. For example, , so : you know the last digit without squaring ninety-nine.
[DIAGRAM: asset_name: Congruence classes modulo five; asset_slug: h245_8_02_residue_classes; caption: Every integer belongs to one of five remainder classes; description: Five horizontal rows labelled zero through four contain the integers from minus ten to fourteen arranged by common remainder modulo five. The row with remainder three contains minus seven, minus two, three, eight and thirteen and is highlighted blue. Arrows join successive integers in that row, each separated by five.]

Adding or multiplying congruent integers preserves congruence. If and , then and are multiples of .
Arithmetic modulo a fixed integer
For a common modulus , if and , then
In particular, for every non-negative integer .
Not in the formula booklet: learn it.
Reduce after each multiplication to avoid carrying large numbers.
Worked example 1: reducing a large power
Question. Find the least non-negative residue of modulo seven.
Plan. Replace eight by its remainder one before taking the power.
Why this step? Taking a power of the small representative gives the same remainder as taking a power of the original number.
Answer. The residue is .
Check. The units modulo seven cycle immediately: every positive power of a number congruent to one is also congruent to one.
The next example changes the representative from one to minus one. The parity of the exponent now matters.
Worked example 2: using a negative representative
Question. Find the least non-negative residue of modulo seven.
Plan. Replace six by minus one and use the odd exponent.
Why this step? Minus two is a convenient intermediate representative, but the requested least non-negative residue is five.
Answer. The residue is .
Check. , and .
Keep equality for identical integers and congruence for identical remainders.
Watch out
Wrong: . Right: . Also, the modulus stays fixed through a chain of modular calculations; a statement modulo seven cannot simply be added to one modulo five.
Use the same shortcut with a different modulus.
Linear congruences and inverses
Solving means finding every integer for which is a multiple of .
For , adding sevens to the right side gives . The value nine is divisible by three, giving . All numbers congruent to three modulo seven also work.
An inverse provides a quicker version of this search.
Multiplicative inverse modulo n
An integer is an inverse of modulo if . Such an inverse exists exactly when . For example, , so five is an inverse of three modulo seven. Two has no inverse modulo six, since every multiple of two is even.
Multiplying by an inverse gives . This inverse method and its coprimality condition are not in the formula booklet: learn them. Find an inverse by trying multiples, or by finding an integer combination .
The inverse condition is also the condition for cancelling the same factor while keeping the modulus unchanged. Cancellation with a non-coprime factor belongs to the next part.
Worked example 3: multiplying by an inverse
Question. Determine the solution of .
Plan. Find an inverse of four modulo eleven, multiply both sides by it, and reduce.
Why this step? Multiplying by an inverse turns the coefficient of into one without changing the modulus.
Answer. , or for .
Check. .
The next example changes only the right side. The same inverse can be reused.
Worked example 4: the same inverse with a new right side
Question. Determine the solution of .
Plan. Multiply by three, the inverse of four, and reduce the resulting residue.
Why this step? An inverse depends on the coefficient and modulus, not on the right side of the equation.
Answer. , where .
Check. , a multiple of eleven.
A congruence describes a whole class, even when you write one small representative.
Watch out
Wrong: “The only solution is .” Right: , meaning every integer . If the question asks for a representative in a stated range, give that representative as well.
Show how you obtain the residue in an OCR “Determine” question: an unexplained calculator answer does not display the required reasoning.
When a coefficient is not invertible
A non-coprime coefficient can produce several residue classes or no solutions at all.
For example, means , so . Thus , which represents the two classes . Dividing the equation has divided the modulus as well.
Reducing a linear congruence
Let . The congruence has solutions if and only if . When and , it is equivalent to
The reduced coefficient and modulus are coprime. There is one class modulo , giving classes modulo the original modulus . If and , every integer is a solution.
Not in the formula booklet: learn it.
To see the obstruction, write . Every term except possibly is divisible by , so must be too. If it is, division by gives the reduced congruence, where an inverse exists unless the condition has become automatic. For example, holds for every integer ; has no solutions.
This is a decision to make before searching for an inverse.
Worked example 5: several classes in the original modulus
Question. Determine all solutions of , giving the residue classes modulo fifteen.
Plan. Divide the coefficient, right side and modulus by their common factor, then solve the reduced congruence.
Why this step? The reduced modulus is five, so increasing by five gives another solution before reaching the original modulus fifteen.
Answer. , where . Modulo fifteen the classes are .
Check. leave remainders , respectively, on division by fifteen.
The next example changes only the right side. The common factor now rules out every candidate.
Worked example 6: proving that no solution exists
Question. Determine all solutions of .
Plan. Test whether the highest common factor of the coefficient and modulus divides the right side.
The left side is divisible by three, but the right side is not.
Why this step? Checking a common factor rules out infinitely many integers at once; a long unsuccessful search would not prove insolubility.
Answer. There are no integer solutions.
Check. The possible residues of modulo fifteen are , none of which is eight.
The right side decides whether a non-invertible coefficient is an obstruction or a route to a smaller modulus.
Watch out
Wrong: . Right: the new modulus is five. Keeping fifteen would discard valid solutions.
Apply the same common-factor test before attempting any cancellation.
Continue this lesson.
You’re previewing NovaLearn without an account. Create a free account to read the rest.
Create free account