markdown
congruence and mod operationmd b0cfb39
lecture/math/abstract-algebra/congruences-and-modular-arithmetic.lecture.n.md
Download PDF

congruence合同式ごうどうしき and mod operation演算えんざん

date2026-07-14document_iddoc_6a6ca43b1c890d8a2a05b45ec31f9e06description合同式と mod 演算を、剰余類の商構造として定義し、加法・乗法・逆元がいつ正当化されるかを説明する。prerequisites[同値関係/どうちかんけい]と[剰余類/じょうよるい] / ユークリッドの[互除法/ごじょほう]type講義content_typelecturestatusactiverelateddata/lecture/math/abstract-algebra/equivalence-relations-and-cosets.lecture.n.md / data/lecture/math/algebra/euclidean-algorithm-and-linear-diophantine-equations.lecture.n.md / data/lecture/math/number-theory/chinese-remainder-theorem.lecture.n.md / data/exercise/math/abstract-algebra/equivalence-relations-and-congruences.exercise.n.md
mathabstract-algebranumber-theorylecture

If congruences合同式ごうどうしき are viewed only as the calculation rule "the remainders are the same," it is hard to see why addition and multiplication are justified. In abstract algebra抽象代数ちゅうしょうだいすう, a congruence合同式ごうどうしき is viewed as equality of residue classes剰余類じょうよるい.

ab[PARSE ERROR: Undefined("Command(\"pmod\")")]n

means

n(a-b)

and at the same time means that a and b belong to the same residue class.

data/lecture/math/abstract-algebra/equivalence-relations-and-cosets.lecture.n.md

1The set of residue classes

Let n[PARSE ERROR: Undefined("Command(\"ge\")")]2. Classifying all integers by their remainders modulo n gives the quotient set商集合しょうしゅうごう

Z/nZ={[0],[1],[PARSE ERROR: Undefined("Command(\"dots\")")],[n-1]}

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 n is fixed, and [a] abbreviates [a]n. 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

[a]+[b]=[a+b]
[a][b]=[ab]

The important point is that the right-hand side does not depend on the choice of representatives. If aa[PARSE ERROR: Undefined("Command(\"pmod\")")]n and bb[PARSE ERROR: Undefined("Command(\"pmod\")")]n, then

(a+b)-(a+b)=(a-a)+(b-b)

is a multiple of n. Also,

ab-ab=a(b-b)+b(a-a)

is a multiple of n. 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 (Z/nZ,+). Closure follows from [a]+[b]=[a+b]Z/nZ. Associativity follows from

([a]+[b])+[c]=[(a+b)+c]=[a+(b+c)]=[a]+([b]+[c]).

The identity is [0], and the inverse of [a] is [-a]. Moreover, [a]+[b]=[a+b]=[b+a]=[b]+[a], so addition is commutative. Therefore (Z/nZ,+) is an abelian group.

The integer laws similarly pass to multiplication of residue classes. For example, associativity and left distributivity are

([a][b])[c]=[(ab)c]=[a(bc)]=[a]([b][c]),
[a]([b]+[c])=[a(b+c)]=[ab+ac]=[a][b]+[a][c].

Commutativity and right distributivity follow in the same way, and [1] 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 [a] has a multiplicative inverse if there exists a class [x] such that

[a][x]=[1]

This is the same as

ax1[PARSE ERROR: Undefined("Command(\"pmod\")")]n

The necessary and sufficient condition for this congruence to have a solution is

[PARSE ERROR: Undefined("Command(\"gcd\")")](a,n)=1

Indeed, if ax1[PARSE ERROR: Undefined("Command(\"pmod\")")]n, then ax-1=kn for some integer k. Every common divisor of a and n divides ax-kn=1, so [PARSE ERROR: Undefined("Command(\"gcd\")")](a,n)=1. Conversely, if [PARSE ERROR: Undefined("Command(\"gcd\")")](a,n)=1, Bezout's identity gives integers x,y such that

ax+ny=1

Reducing this equality modulo n gives ax1[PARSE ERROR: Undefined("Command(\"pmod\")")]n, so [x] is the inverse of [a].

This condition is also independent of the representative. If a=a+kn, every common divisor of a and n divides a, while every common divisor of a and n divides a=a-kn. Hence [PARSE ERROR: Undefined("Command(\"gcd\")")](a,n)=[PARSE ERROR: Undefined("Command(\"gcd\")")](a,n).

data/lecture/math/algebra/euclidean-algorithm-and-linear-diophantine-equations.lecture.n.md

Here 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

2·12·4[PARSE ERROR: Undefined("Command(\"pmod\")")]6

holds, but 1[PARSE ERROR: Undefined("Command(\"not\")")]4[PARSE ERROR: Undefined("Command(\"pmod\")")]6. Thus the factor 2 cannot be cancelled unconditionally as it could in an equality of integers.

In general, if cacb[PARSE ERROR: Undefined("Command(\"pmod\")")]n and [PARSE ERROR: Undefined("Command(\"gcd\")")](c,n)=1, then [c] has a multiplicative inverse. Multiplying both sides by [c]-1 gives [a]=[b], or ab[PARSE ERROR: Undefined("Command(\"pmod\")")]n. Thus [PARSE ERROR: Undefined("Command(\"gcd\")")](c,n)=1 is a sufficient condition for cancellation by c.

6Connection to Fermat's little theorem

If p is prime, every nonzero residue class has an inverse. Write the set of all nonzero residue classes as

(Z/pZ)×

This set has the p-1 elements [1],,[p-1], and every element has an inverse by the criterion proved above. If the product of nonzero [a] and [b] were [0], multiplication by [a]-1 would give [b]=[0], a contradiction. Thus it is closed under multiplication. Associativity follows from integer multiplication, and [1] is the identity. It is therefore a group of order p-1. Lagrange's theorem, studied later, gives [a]p-1=[1] whenever pa, or equivalently

ap-11[PARSE ERROR: Undefined("Command(\"pmod\")")]p

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 n be a positive integer. If the congruences合同式ごうどうしき

ab[PARSE ERROR: Undefined("Command(\"pmod\")")]n,cd[PARSE ERROR: Undefined("Command(\"pmod\")")]n

hold, then

a+cb+d[PARSE ERROR: Undefined("Command(\"pmod\")")]n,acbd[PARSE ERROR: Undefined("Command(\"pmod\")")]n

also hold.

First prove the statement for addition. The congruence合同式ごうどうしき ab[PARSE ERROR: Undefined("Command(\"pmod\")")]n means n(a-b), and cd[PARSE ERROR: Undefined("Command(\"pmod\")")]n means n(c-d). Therefore

(a+c)-(b+d)=(a-b)+(c-d)

is also divisible by n. Hence a+cb+d[PARSE ERROR: Undefined("Command(\"pmod\")")]n.

For multiplication, rewrite

ac-bd=ac-bc+bc-bd=c(a-b)+b(c-d)

Since n(a-b) and n(c-d), both terms on the right are divisible by n. Hence n(ac-bd), so acbd[PARSE ERROR: Undefined("Command(\"pmod\")")]n.

This proof証明しょうめい does not divide by n; it uses the fact that n divides a difference. Therefore no issue of division by zero in symbolic division arises. However, in the notation [PARSE ERROR: Undefined("Command(\"pmod\")")]n, the modulus n is fixed as a positive integer.

9Summary

A congruence合同式ごうどうしき is equality of residue classes. Mod operations are justified because addition and multiplication on residue classes are determined independently of representatives. The additive structure (Z/nZ,+) is an abelian group. Multiplicative inverses do not always exist; the condition [PARSE ERROR: Undefined("Command(\"gcd\")")](a,n)=1 is necessary and sufficient.

raw .n.md をコピー
loc をコピー (filepath:line ~ line)
copy share link
copy encoded share link
path をコピー
copy share link
copy encoded share link
copy share link
copy encoded share link
タブを全て閉じる