FP2 5.6 - Solving congruence equations
Decide whether a linear congruence has solutions, find multiplicative inverses using Bezout's identity, and solve with the correct modulus. Describe every solution, including the multiple residue classes that occur when the coefficient and modulus are not coprime.
Check the coefficient and modulus before trying to solve
Why does have six solution residues modulo , while changing to leaves none? Multiplication can merge remainder classes, so a congruence equation need not behave like an ordinary equation with one answer. The common factor of the coefficient and modulus controls what is possible.
You already know
means . Euclid finds the positive highest common factor , and back substitution expresses it as an integer combination of . Cancelling a factor while keeping the modulus is safe only when that factor is coprime to the modulus. A residue class means all integers , .
In a linear congruence , the unknown is an integer , the coefficient and right-hand side are integers, and the modulus here is an integer . Asking for solutions modulo means identifying which classes of integers satisfy the condition, usually using representatives .
Existence of solutions
Let . Then
When solutions exist, there are exactly distinct solution classes modulo .
Not in the formula booklet: learn it.
Here is why the existence test works. The congruence is equivalent to for some integer . Since divides both , it must divide : this is necessary.
Conversely, suppose . Bezout gives integers with . Multiply this identity by :
Thus is a solution. The condition is sufficient too. We will justify the count of classes when reducing the modulus below.
For the opening equation, . This divides , so solutions exist, but does not divide , so the changed equation has none. Having no multiplicative inverse of modulo does not rule out every right-hand side.
Key idea
Find , using the coefficient and the modulus. Check whether it divides the right-hand side before attempting an inverse or searching for a residue.
Test the condition on a new equation.
Read a multiplicative inverse from an identity equal to one
To undo multiplication by while keeping modulus , seek an integer with . Then multiplying a congruence by turns its coefficient into .
Multiplicative inverse
An inverse of modulo exists exactly when . If Bezout's identity gives
then
and is a multiplicative inverse of . Any integer congruent to is also an inverse.
Not in the formula booklet: learn it.
The identity proves sufficiency. For necessity, gives an integer combination of equal to , so their highest common factor is . This is why as an ordinary fraction is not a substitute for finding an integer inverse.
Worked example 1: a negative Bezout coefficient
Question. Use Bezout's identity to find a multiplicative inverse of modulo , giving the least nonnegative representative.
Plan. Use Euclid and back substitution to express in terms of , then reduce the coefficient of .
Why this step? The coefficient of , not the coefficient of the modulus, is the inverse. A negative coefficient is allowed.
Answer. An inverse is , so the requested representative is .
Check. .
Keep modulus ; change only the coefficient from to .
Worked example 2: recalculate the inverse after changing the coefficient
Question. Find the least nonnegative inverse of modulo using Bezout's identity.
Plan. Recompute the remainder chain and substitute backwards; the inverse of cannot be reused.
Why this step? Reducing this identity modulo removes its -term and leaves .
Answer. The inverse is .
Check. .
The inverse is a residue class, so and are equally valid during working in the first example. A requested least nonnegative answer must be in to .
Watch out
Wrong: take as the inverse of from . Right: take , the coefficient multiplying , then reduce it if a representative is requested.
Change the coefficient by one again.
Multiply by the inverse and state the full residue class
When , an inverse gives
The forward step multiplies by ; the reverse step multiplies by . Thus the method preserves all solutions, not just one candidate. This solving rule follows from the inverse and is not separately printed in the formula booklet.
There is one solution class modulo , containing infinitely many integers. A bare integer is only one representative unless the question asks for a single value in a specified range.
Worked example 3: use the inverse already found
Question. Solve , giving all integer solutions.
Plan. Multiply both sides by the inverse , reduce the right-hand side, then write the full class.
Why this step? The modulus stays because multiplying by an inverse is reversible. No division by as an ordinary fraction is used.
Answer. , or for .
Check. . Increasing by changes by a multiple of , so the whole class works.
Keep the coefficient and modulus fixed; change only the right-hand side from to .
Worked example 4: a changed right-hand side uses the same inverse
Question. Solve .
Plan. Retain inverse and apply it to the new right-hand side.
Why this step? The inverse depends on the coefficient and modulus, so changing only the right-hand side does not require a new Euclidean algorithm.
Answer. , equivalently , .
Check. .
The final statement must retain the modulus. It describes which repeated integer values work, rather than suggesting that equals just its smallest nonnegative representative.
Watch out
Wrong: finish “” when asked to solve over the integers. Right: state , or with .
Change only the right-hand side again.
Continue this lesson.
You’re previewing NovaLearn without an account. Create a free account to read the rest.
Create free account