congruence and mod operation 演算 えんざん
If
means
and at the same time means that and belong to the same residue class.
data/lecture/math/abstract-algebra/equivalence-relations-and-cosets.lecture.n.md1The set of residue classes
Let . Classifying all integers by their remainders modulo gives the
The elements of this set are not integers themselves, but equivalence classes of integers.
Here the quotient set is the set obtained by grouping integers with the same remainder into one class and then treating those classes as the elements.
Throughout this lecture the modulus is fixed, and abbreviates . Because changing the modulus changes the residue class, restore the subscript when several moduli are discussed at once.
2Addition and multiplication
Define addition and multiplication of residue classes by
The important point is that the right-hand side does not depend on the choice of representatives. If and , then
is a multiple of . Also,
is a multiple of . Therefore the sum and product are well-defined.
3The additive group structure
Now that addition is independent of representatives, we can verify the group axioms for . Closure follows from . Associativity follows from
The identity is , and the inverse of is . Moreover, , so addition is commutative. Therefore is an abelian group.
The integer laws similarly pass to multiplication of residue classes. For example, associativity and left distributivity are
Commutativity and right distributivity follow in the same way, and is the multiplicative identity. Not every element has a multiplicative inverse. These addition and multiplication laws will later be organized as the ring axioms.
4The condition for an inverse
A residue class has a multiplicative inverse if there exists a class such that
This is the same as
The necessary and sufficient condition for this congruence to have a solution is
Indeed, if , then for some integer . Every common divisor of and divides , so . Conversely, if , Bezout's identity gives integers such that
Reducing this equality modulo gives , so is the inverse of .
This condition is also independent of the representative. If , every common divisor of and divides , while every common divisor of and divides . Hence .
data/lecture/math/algebra/euclidean-algorithm-and-linear-diophantine-equations.lecture.n.mdHere we are not dividing by a symbol; we are proving the existence of an inverse from the fact that the greatest common divisor is 1. Therefore, whenever a division-like operation is used, one must first check the condition that an inverse exists.
5Cancellation is not always valid in congruences
The congruence
holds, but . Thus the factor 2 cannot be cancelled unconditionally as it could in an equality of integers.
In general, if and , then has a multiplicative inverse. Multiplying both sides by gives , or . Thus is a sufficient condition for cancellation by .
6Connection to Fermat's little theorem
If is prime, every nonzero residue class has an inverse. Write the set of all nonzero residue classes as
This set has the elements , and every element has an inverse by the criterion proved above. If the product of nonzero and were , multiplication by would give , a contradiction. Thus it is closed under multiplication. Associativity follows from integer multiplication, and is the identity. It is therefore a group of order . Lagrange's theorem, studied later, gives whenever , or equivalently
This is Fermat's little theorem.
This section is a preview of later material on groups and Lagrange's theorem. The main thread of this page uses only the well-definedness of residue-class operations and the condition for inverses to exist.
7Proof supplement: why congruence 合同式 ごうどうしき is preserved by addition and multiplication
Let be a positive integer. If the
hold, then
also hold.
First prove the statement for addition. The
is also divisible by . Hence .
For multiplication, rewrite
Since and , both terms on the right are divisible by . Hence , so .
This
8Exercise link
data/exercise/math/abstract-algebra/equivalence-relations-and-congruences.exercise.n.md9Summary
A