Algebra often constructs a new object by treating several old objects as equivalent. The construction works only if its operations do not depend on a hidden choice of representative. Congruence classes of integers offer a concrete place to learn that proof technique before using abstract quotients.
This section uses the natural-number induction principle and integer arithmetic and order. The complete division and Bézout proof below supplies the integer facts used in the unit criterion and linear-congruence argument. Group and ring names in the concrete residue example are previews; their general axioms are introduced in 1.2 and 2.1, not prerequisites for the representative checks here.
1 Equivalence classes
A relation on a set is an equivalence relation if it is reflexive, symmetric and transitive. The class consists of all elements equivalent to . Two classes are either identical or disjoint: an element in both lets transitivity connect their representatives. Thus classes partition the original set.
Fix an integer . Define when divides . The relation is reflexive because , symmetric because divisibility survives negation, and transitive because it survives addition. Division with remainder shows there are exactly classes, represented by . The set of classes is .
Define and . These require a well-definedness proof. If , , then and
Both differences are divisible by . Hence the resulting classes are independent of representatives. Exponentiation to nonnegative integer powers also respects congruence by repeated multiplication.
By contrast, a proposed operation is meaningless without additional conditions: might not be an integer, and a denominator class need not be invertible.
2 Groups domains and fields in one example
Under addition, the classes form an abelian group: zero is the identity, is the inverse, and associativity descends from integer addition. With multiplication they form a commutative ring with identity . A nonzero class can be a zero divisor, meaning it multiplies another nonzero class to zero. In , .
A unit is a class with a multiplicative inverse.
An integral domain is a nonzero commutative ring with identity and no nonzero zero divisors. A field is a nonzero commutative ring with identity in which every nonzero element is a unit. In a field, with gives , so every field is a domain. These are the definitions used in E4. The group axioms are developed in Symmetry structure and homomorphisms; the full ring and ideal conventions are collected in Ideals and the polynomial Euclidean algorithm.
Unit criterion. is a unit modulo if and only if .
Proof. If the gcd is 1, Bézout gives integers with , so . Conversely, if , then is divisible by , so every common divisor of divides 1.
Bézout itself follows from the Euclidean algorithm: repeated division preserves the set of integer combinations, and back substitution expresses the last nonzero remainder, the gcd, as such a combination.
For example, , so modulo 10. Modulo a prime , every nonzero class is coprime to , so every nonzero class is a unit: is a field. Composite moduli fail: if with , the nonzero classes multiply to zero.
3 Solving a linear congruence
The congruence is solvable exactly when divides . Necessity follows because makes . For sufficiency, multiply a Bézout identity by to obtain a solution.
If one solution is , all solutions differ by multiples of modulo . Indeed, is divisible by exactly when is divisible by ; coprimality permits cancellation. There are exactly solution classes modulo .
For , divides 8. Dividing gives and the inverse of 3 modulo 7 is 5, so . The two classes modulo 14 are 6 and 13. Direct substitution verifies both.
The zero-coefficient case is included: has all residue classes as solutions if , and none otherwise. Here , so and the general criterion agrees. No division by the coefficient 0 is used.
Full integer proof reused in the congruence argument
In this integer proof means . The following division, gcd-invariance, termination and coefficient-update argument supplies the Bézout assertion used above; all signed and zero input cases are included.
The least-element principle used here follows from induction. If a nonempty had no least member, then ; if are absent, cannot belong to , since it would then be least. Induction excludes every natural number from , contradicting nonemptiness. We apply this principle to nonnegative remainder candidates and to positive integer combinations.
Theorem 1.1.1
(Division algorithm)
Let with . Then there exist unique integers and such that
The integer is the quotient and is the remainder.
The condition is not decoration. It is what makes the remainder unique. For example,
has an allowed remainder , while
does not count as the division algorithm because is not smaller than .
For existence, first take and . The set
contains , so well-ordering supplies a least member . If , then would be a smaller nonnegative member. Hence . If and , the integer is nonnegative. Divide by the case just proved; rearranging gives with the same allowed remainder. For , divide by and replace the resulting quotient by . Thus no sign case requires a negative remainder.
For uniqueness, suppose with both remainders in range. Then , but . A nonzero integer multiple of has absolute value at least , so . Since , the remaining equality forces . The strict upper bound proves uniqueness; merely requiring a nonnegative remainder would not.
Theorem 1.1.2
(Gcd step)
If , then
Proof: Preserve the entire set of common divisors
The target is equality of two gcds. A stronger intermediate statement makes the proof direct: an integer divides both exactly when it divides both . In the forward direction use ; in the reverse direction use . Both steps use closure under integer linear combinations.
The two divisor sets therefore have the same greatest element when the inputs are not both zero. If , then and both gcds equal by convention. The identity itself does not need a remainder bound; the bound is needed to make the algorithm progress.
Concept lensAlgorithmic
An invariant and a decreasing computation
The gcd is the quantity preserved by each replacement . The remainder is the quantity made smaller. These serve different purposes: preservation proves that the final answer is the original gcd, while strict decrease proves that a final step will occur. Start with absolute values, swap to put the larger positive input first, and stop immediately if the other input is zero. In every remaining division the divisor is positive.
The algorithm must terminate because the remainders form a strictly decreasing sequence of nonnegative integers:
A strictly decreasing sequence of nonnegative integers cannot continue forever.
Back-substitution can also be organized forward. For positive inputs put , , and keep coefficients , starting with and . If , then
Substituting the two known linear combinations proves this update. Every coefficient remains integral, and the row for the last nonzero remainder supplies the required coefficients of the gcd.
Theorem 1.1.3
(Bézout's identity)
For any integers , there exist integers such that
For signed nonzero inputs, compute using and absorb their signs into the resulting coefficients. If one input is zero, use or its counterpart for ; for use . This proves all cases of the identity.
When the inputs are not both zero, the gcd is also the smallest positive integer linear combination. It is such a combination by the identity, and every positive combination is a positive multiple of the gcd, hence at least as large. For there is no positive combination.
Dividing a congruence changes its modulus
Solve . The gcd is 4, which divides 12, so solutions exist. The definition of congruence gives an integer with . Dividing this integer equality by 4 gives , hence the equivalent congruence is , not modulo 20. Since , multiply by 3 to get .
Thus the complete integer solution is . Modulo 20, write with ; this yields exactly the four distinct classes . Their products with 8 are , all congruent to 12 modulo 20. Completeness follows from the equivalent integer equation, not from checking these four candidates alone.
Cancelling a common factor while keeping the original modulus would change the problem. For example is a genuine solution, but . Dividing by a nonunit is justified by dividing the modulus at the same time. Multiplication by a unit, in contrast, preserves the modulus and is reversible within the same quotient ring.
4 Graded practice
E1 Foundation. List the units modulo 12 and identify one nonzero zero divisor.
E2 Congruence. Solve and .
E3 Well-definedness. Does define a function? Does ?
E4 Proof. In an integral domain, prove and imply . Explain why cancellation fails in .
5 Full solutions
S1. Units are , the classes coprime to 12. For example is a zero divisor since with both factors nonzero.
S2. The first reduces to , so : classes 4 and 9 modulo 10. The second has no solution because does not divide 5.
In that reduction, , so multiplying by 3 gives . Lifting that one class to modulus 10 gives exactly 4 and 9.
S3. Yes for : a difference divisible by 6 is divisible by 3. No for : but , so one input would receive two outputs.
S4. , and absence of zero divisors forces . Modulo 8, although , because . Nonzero is not enough for multiplicative cancellation in a ring with zero divisors.
Summary
Equivalence classes are sets of indistinguishable representatives. Operations and maps on them must be checked for well-definedness. Congruence arithmetic exhibits additive groups, rings, units and fields concretely, while the gcd controls both inverses and linear-congruence solvability.
Further study
The blocks below use the unit criterion, the Bézout coefficient update and the solution count for linear congruences proved above.
Worked example 1.1.4
(An inverse modulo 26 from the coefficient rows)
To invert modulo 26, run the forward coefficient update of the gcd section with , , keeping :
Each row is the row two above minus times the row directly above, with the quotient written in the row directly above: , , . The last row says ; indeed . Reducing modulo 26 gives , so . Check: . By the unit criterion such an inverse had to exist, since .
Worked example 1.1.5
(Six solution classes of one linear congruence)
Solve . Here divides 18, so solutions exist and there are exactly six classes modulo 30. Dividing the integer equation by 6 gives the equivalent congruence , with the modulus divided as well. Since , multiplication by 3 gives .
The integer solutions are , and modulo 30 they form the six classes , spaced by . For example and . By contrast has no solution, because : every value is a multiple of 6.
Worked example 1.1.6
(Every nonzero class modulo 15 is a unit or a zero divisor)
The unit criterion picks out the classes coprime to 15: . Their inverses are found by inspection and checked by multiplication:
all congruent to 1 modulo 15. The remaining nonzero classes share a factor with 15, and each is a zero divisor: if , then is a multiple of 15 while , so with both factors nonzero. Thus and . A class cannot be both: if with and had an inverse, multiplying by it would give .
Counterexample mode
Exponents cannot be reduced modulo n
Claim: since powers respect congruence, defines an operation in which the exponent is also a class modulo . Take . The exponents 1 and 6 are congruent modulo 5, but while . The rule gives two different values for the same exponent class, so it is not well defined. What Section 1 proves is that the base may be replaced by any representative, because implies by repeated multiplication. The exponent counts factors; it is an ordinary integer, and nothing in the representative check allows it to be changed by multiples of .
Quick check
(Use the Euclidean algorithm to find the inverse of modulo 40, and check the answer.)
Divide 40 by 7, then 7 by the remainder, and substitute back.
Solution · Answer
The divisions are , and . Back substitution gives . Hence . Check: .
Quick check
(Do the rules and define functions from to ?)
Replace by , as in the well-definedness check of Section 1 and solution S3.
Solution · Answer
For : replacing by changes by , a multiple of 15, so the output class is unchanged and is a function. For : the change is , which need not be a multiple of 15. Concretely , but while . One input would receive two outputs, so is not a function.
Quick check
(Find the remainder of on division by 7 without computing .)
First find a small power of 2 that is congruent to 1 modulo 7.
Solution · Answer
Since and products respect congruence, . Hence , and the remainder is 2. The exponent was split as by integer division; it was not reduced modulo 7, which would give the wrong value .