You are on page 1of 3

S8 Modular Arithmetic Basics

Ahmed Hasib Ittihad


M Ahsan Al Mahir

March 10, 2021

r se
1 Necessary Theorems

ou
Go read 104 Number Thoery Problems by Titu Andrescu, Dorin Andrica, and Zuming Feng. RIGHT NOW.

Theorem 1.1 (What can you do in MOD?) — We all know that a ≡ b (mod m) means m | a − b. The

C
following are the valid operations you can do in mod:

1. If a ≡ b (mod m) and b ≡ c (mod m), then a ≡ c (mod m) (transitivity).

2. If a ≡ b (mod m), then b ≡ a (mod m)


sh
3. If a ≡ b (mod m) and c ≡ d (mod m), then a + c ≡ b + d (mod m) and a − c ≡ b − d (mod m)

4. If a ≡ b (mod m), then for any integer k, ka ≡ kb( mod m).


ra

5. If a ≡ b (mod m), then a


k ≡ b
k (mod m) if and only if gcd(k, m) = 1
6. If a ≡ b (mod m) and c ≡ d (mod m), then ac ≡ bd (mod m). In general, if ai ≡ bi (mod m), i =
1, . . . , k, then a1 · · · ak ≡ b1 · · · bk (mod m). In particular, if a ≡ b (mod m), then for any positive
C

integer k, ak ≡ bk (mod m)

7. We have a ≡ b (mod m)i , i = 1, . . . , k, if and only if

a≡b (mod lcm (m1 , . . . , mk ))


O

In particular, if m1 , . . . , mk are pairwise relatively prime, then a ≡ b (mod m)i , i = 1, . . . , k, if


and only if a ≡ b (mod m)1 · · · mk
dM

8. Let a, b, n be integers, n ̸= 0, such that a = nq1 + r1 , b = nq2 + r2 , 0 ≤ r1 , r2 < |n|. Then a ≡ b


(mod m) if and only if r1 = r2 .

Theorem 1.2 — There are infinitely many primes of the form 4k − 1.


B

Theorem 1.3 (Dirichlet’s Theorem) — There are infinitely many primes of the form ak + b where a, b,
are two relatively prime integers.

This basically means that there are infinitely many primes in an arithmetic sequence.

Theorem 1.4 (Chinese Remainder Theorem) — Let (m1 , m2 , . . . mn ) is a set of parewise coprime inte-
gers, that is gcd(mi , mj ) = 1 for all i, j . Also let (a1 , a2 . . . an ) be any integers. Then the Chinese
Remainder theorem tells us that there is an integer x such that the following equivalencs are all

1
satisfied:
x ≡ a1 (mod m1 )
x ≡ a2 (mod m2 )
..
.
x ≡ an (mod mn )

Lemma 1.5 — Let p be a prime. If x and y are integers such that xy ≡ 0 (mod m), then either x ≡ 0
(mod p) or y ≡ 0 (mod p) or both.

se
Theorem 1.6 — Let m be a positive integer, and let a and b be integers relatively prime to m. If x
and y are integers such that

ax ≡ bx (mod m) and ay ≡ by (mod m),

r
then

ou
agcd(x,y) ≡ bgcd(x,y) (mod m)

Definition (Residue Classes)— In modular arithmetic, we classify every integer into an unique class according
to their remainder on division by n. For example, {1, 11, 21, 31 . . . } all can be classified to 1 (or 11, 21, or 31)
modulo 10.

C
We call these classes according to dividsion by n, residue classes. So there are n residue classes modulo n.

Definition (Complete set of residue classes)— The set of all residue classes modulo n is called the complete
set of residue classes.
sh
For example, there are 5 residue classes, and the complete set of residue classes is {0, 1, 2, 3, 4} modulo 5. Note
that {0, 6, 2, 13, −1} is also another complete set of residue classes.
ra

Lemma 1.7 — The following can be checked using complete set of residue classes:

1. n2 ≡ 0 or 1 (mod 3)
C

2. n2 ≡ 0 or ±1 (mod 5)

3. n2 ≡ 0 or 1 or 4 (mod 8)

4. n3 ≡ 0 or ±1 (mod 9)
O

5. n4 ≡ 0 or 1 (mod 16)

Lemma 1.8 — Let {a1 , a2 , . . . an } be a complete set of residuce classes modulo n. Then the following
dM

results hold:

1. {a1 + k, a2 + k, . . . an + k} is a complete residue set module n for all values of k .

2. {ba1 , ba2 , . . . ban } is a complete residue set modulo n if gcd(b, n) = 1.

3. {ba1 + k, ba2 + k . . . ban + k} is a complete residue set for all k and b ⊥ n.


B

Theorem 1.9 — Let m be a positive integer. Let a be an integer relatively prime to m, and let b be
an integer. There exist integers x such that ax ≡ b (mod m), and all these integers form exactly one
residue class modulo m.
Definition (Inverse)— Setting b = 1 in the previous theorem, we get that for all integer a coprime to m,
there is a number x with ax ≡ 1 (mod m). This x is called the inverse of a modulo m, and is written as a−1
or a1 .

2
Definition (Wilson’s theorem)— For any prime p,

(p − 1)! ≡ −1 (mod p)

Theorem 1.10 (Fermat’s Little Theorem) — Let p be a prime, and let a be an integer not divisible by
p. Then we have,
ap ≡ a (mod p), and ap−1 ≡ 1 (mod p)

Definition (Euler’s totient function)—

se
2 Intro Problems

r
Problem 2.1. Let m be an even positive integer. Assume that {a1 , a2 , . . . , am } and {b1 , b2 , . . . , bm } are
two complete sets of residue classes modulo m. Prove that

ou
{a1 + b1 , a2 + b2 , . . . , am + bm }

is not a complete set of residue classes.

C
Problem 2.2. Prove Lemma 1.8.2.
sh
3 Hard Problems

Problem 3.1 (Russia 2001). Find all primes p, q such that p + q = (p − q)3 .
ra
C
O
dM
B

You might also like