全部书籍

专业

应用 关于 Coach 登录 开始阅读

书籍暂未推出简体中文版——当前显示英文版。

Mathematics · 术语表

什么是 Congruence?

Definition 29.4 High School Mathematics · 第 29 章 — Arithmetic

Let n∈N∗n \in \N^*. Two integers a,ba, b are congruent modulo nn, written a≡b(modn)a \equiv b \pmod n, if n∣(a−b)n \mid (a - b) — equivalently, if aa and bb have the same remainder in the Euclidean division by nn.

在原文中阅读 →
Definition 6.18 University Mathematics — Year 1 · 第 6 章 — Integer Arithmetic

For n∈N∗n \in \N^*: a≡b(modn)a \equiv b \pmod n when n∣a−bn \mid a - b. This is an equivalence relation compatible with addition and multiplication: if a≡ba \equiv b and a′≡b′a' \equiv b' (mod nn), then a+a′≡b+b′a + a' \equiv b + b', aa′≡bb′aa' \equiv bb', and ak≡bka^k \equiv b^k for k∈Nk \in \N.

示例

Example 6.19 (Casting out nines)

Compatibility with ++ and ×\times is a checking device as old as commerce. Since 10≡1(mod9)10 \equiv 1 \pmod 9, every integer is congruent mod 99 to its digit sum (proved as Exercise 6.2). To check the claim 1234×567=699 6781234 \times 567 = 699\,678: digit sums give 1234≡11234 \equiv 1 and 567≡18≡0(mod9)567 \equiv 18 \equiv 0 \pmod 9, so the product must be ≡1×0=0\equiv 1 \times 0 = 0; and indeed 6+9+9+6+7+8=45≡06 + 9 + 9 + 6 + 7 + 8 = 45 \equiv 0. The check passes (and the product is in fact correct). Had someone reported 699 478699\,478, the digit sum 43≡7≢043 \equiv 7 \not\equiv 0 would convict them instantly. The test is one-sided — it catches an error unless the error is itself a multiple of 99 — which is exactly the pseudoprime lesson of Example 6.24 in miniature: congruence checks refute, they do not certify.

Example 6.21 (Inverting 77 modulo 2626)

Since gcd⁡(7,26)=1\gcd(7, 26) = 1, the class of 77 is invertible mod 2626. Extended Euclid:

26=3×7+5,7=1×5+2,5=2×2+1,26 = 3 \times 7 + 5, \qquad 7 = 1 \times 5 + 2, \qquad 5 = 2 \times 2 + 1 ,

then backwards:

1=5−2×2=5−2(7−5)=3×5−2×7=3(26−3×7)−2×7=3×26−11×7.1 = 5 - 2 \times 2 = 5 - 2(7 - 5) = 3 \times 5 - 2 \times 7 = 3(26 - 3 \times 7) - 2 \times 7 = 3 \times 26 - 11 \times 7 .

Hence 7×(−11)≡1(mod26)7 \times (-11) \equiv 1 \pmod{26}, i.e. 7−1≡−11≡15(mod26)7^{-1} \equiv -11 \equiv 15 \pmod{26}; check: 7×15=105=4×26+17 \times 15 = 105 = 4 \times 26 + 1. With the inverse in hand, any congruence 7x≡c(mod26)7x \equiv c \pmod{26} is solved in one multiplication: x≡15cx \equiv 15c. This mechanical inversion is the workhorse of modular arithmetic — and of the public-key protocols mentioned in Remark 6.27, where the moduli have hundreds of digits but the algorithm is exactly this one.

Example 6.22 (When the coefficient is not invertible)

Solve 12x≡8(mod20)12x \equiv 8 \pmod{20}. Here gcd⁡(12,20)=4\gcd(12, 20) = 4, so 1212 is not invertible mod 2020 — but the equation is still tractable. The congruence says 20∣12x−820 \mid 12x - 8; dividing the whole relation by 44 (divisor of all three ingredients), it is equivalent to 5∣3x−25 \mid 3x - 2, i.e.

3x≡2(mod5).3x \equiv 2 \pmod 5 .

Now gcd⁡(3,5)=1\gcd(3, 5) = 1 and 3−1≡2(mod5)3^{-1} \equiv 2 \pmod 5 (3×2=6≡13 \times 2 = 6 \equiv 1), so x≡4(mod5)x \equiv 4 \pmod 5: the solutions are x≡4,9,14,19(mod20)x \equiv 4, 9, 14, 19 \pmod{20} — four classes mod 2020, matching the gcd. (Had the right side not been divisible by 44, say 12x≡6(mod20)12x \equiv 6 \pmod{20}, there would be no solution at all: the left side is always ≡0(mod4)\equiv 0 \pmod 4.) General shape: ax≡b(modn)ax \equiv b \pmod n is solvable iff gcd⁡(a,n)∣b\gcd(a, n) \mid b, and then has exactly gcd⁡(a,n)\gcd(a, n) solution classes — divide everything by the gcd and invert.

在原文中阅读 →