






Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
An introduction to modular arithmetic and its importance in algorithmic number theory, focusing on key concepts such as modular arithmetic properties, modular inverses, fermat's theorem, euler's identity, and the chinese remainder theorem. These concepts are essential for computer algebra algorithms.
Typology: Study notes
1 / 12
This page cannot be seen from the preview
Don't miss anything!







Modular Arithmetic Jeremy R. Johnson
Objective: To become familiar with modular arithmetic andsome key algorithmic constructions that are important forcomputer algebra algorithms.^ –^
Modular Arithmetic
-^
Modular inverses and the extended Euclidean algorithm
-^
Fermat’s theorem
-^
Euler’s Identity
-^
Chinese Remainder Theorem References: Rivest, Shamir, Adelman.
The equivalence classes [a] mod n, are typically represented
by the representatives a.
-^
Positive Representation: Choose the smallest positiveinteger in the class [a] then the representation is {0,1,…,n-1}.
-^
Symmetric Representation: Choose the integer with thesmallest absolute value in the class [a]. The representationis {-
⎣(n-1)/
⎣n/
⎦^ }. When n is even, choose the
positive representative with absolute value n/2.
-^
Theorem: If a
Z, then ap
p-^
≡^ 1 (mod p). More generally, if
a^ ∈
Zp
, then a
p^ ≡
a (mod p).
Proof: Assume that a
Z. Thenp
a * 2a * … (p-1)a = (p-1)! * a
p-
Also, since a*i
≡^ a*j (mod p)
i^ ≡
j (mod p), the numbers
a, 2a, …, (p-1)a are distinct elements of Z
. Therefore theyp
are equal to 1,2,…,(p-1) and their product is equal to^ (p-1)! mod p. This implies that (p-1)! * a
p-^
≡^ (p-1)! (mod p)
p-1 a ≡^ 1 (mod p).
Definition: phi(n) = #{a: 0 < a < n and gcd(a,n) = 1}
-^
Properties:^ –^
ϕ(p) = p-1, for prime p.
-^
ϕ(p^e) = (p-1)*p^(e-1)
-^
ϕ^ (m*n) =
ϕ^ (m)*
ϕ(n) for gcd(m,n) = 1.
-^
ϕ(pq) = (p-1)(q-1)
-^
Examples:^ –^
ϕ(15) =
ϕ(3)*
ϕ(5) = 2*4 = 8. = #{1,2,4,7,8,11,13,14}
-^
ϕ(9) = (3-1)3^(2-1) = 23 = 6 = #{1,2,4,5,7,8}
Theorem: If gcd(m,n) = 1, then given a and b there exist an
integer solution to the system: x^ ≡^
a (mod m) and x = b (mod n). Proof: Consider the map x
(x mod m, x mod n).
This map is a 1-1 map from Z
mn^
to Z
×m Zn
, since if x and y map
to the same pair, then x
y (mod m) and x
y (mod n).
Since gcd(m,n) = 1, this implies that x
y (mod mn).
Since there are mn elements in both Z
mn^
and Z
×m Zn
, the map
is also onto. This means that for every pair (a,b) we canfind the desired x.
Let Z
×m Zn
denote the set of pairs (a,b) where a
Zm
Z. We can perform arithmetic on Zn
×m Zn
by performing
componentwise modular arithmetic.^ –^
(a,b) + (c,d) = (a+b,c+d)
-^
(a,b)(c,d) = (ac,b*d)
-^
Theorem: Z
mn^
×m Zn
. I.E. There is a 1-1 mapping from
Zmn
onto Z
×m Zn
that preserves arithmetic.
-^
(ac mod m, bd mod n) = (a mod m, b mod n)*(c mod m, d mod n)
-^
(a+c mod m, b+d mod n) = (a mod m, b mod n)+(c mod m, d mod n)
-^
The CRT implies that the map is onto. I.E. for every pair (a,b) there isan integer x such that (x mod m, x mod n) = (a,b).