Dietzfelbinger M. Primality testing in polynomial time ... - tiera.ru
Dietzfelbinger M. Primality testing in polynomial time ... - tiera.ru
Dietzfelbinger M. Primality testing in polynomial time ... - tiera.ru
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
3.3 Modular Arithmetic 33<br />
Lemma 3.3.3. If a ≡ a ′ (mod m) and b ≡ b ′ (mod m), thena + b ≡ a ′ + b ′<br />
(mod m) and a · b ≡ a ′ · b ′ (mod m), for all a, a ′ ,b,b ′ ∈ Z. Consequently, if<br />
a ≡ a ′ and n ≥ 0 is arbitrary, then a n ≡ (a ′ ) n (mod m).<br />
Proof. As an example, we consider the multiplicative <strong>ru</strong>le. Write a ′ = a + qm<br />
and b ′ = b + rm. Thena ′ · b ′ = a · b +(qb + ar + qrm)m, which implies that<br />
a · b ≡ a ′ · b ′ (mod m). ⊓⊔<br />
In many cases, this lemma makes calculat<strong>in</strong>g a rema<strong>in</strong>der f(a1,...,ar)<br />
mod m easier, for f(x1,...,xr) an arbitrary arithmetic expression. We will<br />
use it without further comment by freely substitut<strong>in</strong>g equivalent terms <strong>in</strong><br />
calculations. To demonstrate the power of these <strong>ru</strong>les, consider the task of<br />
calculat<strong>in</strong>g the rema<strong>in</strong>der (751 100 − 22 59 ) mod 4. Us<strong>in</strong>g Lemma 3.3.3, we see<br />
(s<strong>in</strong>ce 751 ≡ 3, 3 2 ≡ 1, 22 ≡ 2, and 2 2 ≡ 0, all modulo 4):<br />
751 100 − 22 59 ≡ 3 100 − 2 · (2 2 ) 29 ≡ (3 2 ) 50 − 2 · 0 ≡ 1 50 ≡ 1 (mod 4),<br />
and hence (751 100 − 22 59 )mod4=1.<br />
Like all equivalence relations, cong<strong>ru</strong>ence modulo m splits its ground set<br />
Z <strong>in</strong>to equivalence classes (or cong<strong>ru</strong>ence classes). There is exactly one<br />
equivalence class for each rema<strong>in</strong>der r ∈{0, 1,...,m−1},s<strong>in</strong>cea is cong<strong>ru</strong>ent<br />
to a mod m ∈{0, 1,...,m− 1} and dist<strong>in</strong>ct r, r ′ ∈{0, 1,...,m− 1} cannot<br />
be cong<strong>ru</strong>ent. For m = 4 these equivalence classes are:<br />
{a ∈ Z | a mod 4 = 0} = { ..., −12, −8, −4, 0, 4, 8, 12,... },<br />
{a ∈ Z | a mod 4 = 1} = { ..., −11, −7, −3, 1, 5, 9, 13,... },<br />
{a ∈ Z | a mod 4 = 2} = { ..., −10, −6, −2, 2, 6, 10, 14,... },<br />
{a ∈ Z | a mod 4 = 3} = { ..., −9, −5, −1, 3, 7, 11, 15,... }.<br />
We <strong>in</strong>troduce an arithmetic st<strong>ru</strong>cture on these classes. For convenience,<br />
we use the standard representatives from {0, 1,...,m− 1} as names for the<br />
classes, and calculate with these representatives.<br />
Def<strong>in</strong>ition 3.3.4. For m ≥ 2 let Zm be the set {0, 1,...,m− 1}. Onthis<br />
set the follow<strong>in</strong>g two operations +m (addition modulo m) and ·m (multiplication<br />
modulo m) are def<strong>in</strong>ed:<br />
a +m b =(a + b) modm and a ·m b =(a · b) modm.<br />
(The subscript m at the operation symbols is omitted if no confusion arises.)<br />
The operations +m and ·m obey the standard arithmetic laws known<br />
from the <strong>in</strong>tegers: associativity, commutativity, distributivity. Moreover, both<br />
operations have neutral elements, and +m has <strong>in</strong>verses.<br />
Lemma 3.3.5. (a) a +m b = b +m a and a ·m b = b ·m a, fora, b ∈ Zm.<br />
(b) (a +m b) +m c = a +m (b +m c) and (a ·m b) ·m c = a ·m (b ·m c), for<br />
a, b, c ∈ Zm.