Modular Arithmetic and Some Important
Theorems
Nrip Dave
26 March 2024
Introduction
Welcome to the fascinating world of modular arithmetic! In the realm of math-
ematics, modular arithmetic is a powerful and versatile tool that finds applica-
tions across various fields, from cryptography to number theory. At its core,
modular arithmetic revolves around the concept of remainders and offers a
unique perspective on the properties of integers under specific arithmetic oper-
ations.
In this handout, we will embark on a journey through the fundamental
concepts of modular arithmetic and explore its significance in mathematical
reasoning. We will delve into the basic definitions, properties, and operations
within this arithmetic system, laying the groundwork for a deeper understanding
of more advanced topics.
Through the study of modular arithmetic, you will not only enhance your
problem-solving skills but also develop a keen insight into the structure and
patterns inherent in integer arithmetic. As we progress, we will encounter sev-
eral important theorems that play pivotal roles in understanding and utilizing
modular arithmetic effectively.
Whether you are a student or a curious learner, the concepts presented in this
handout will expand your mathematical horizons and provide you with valuable
tools for tackling a wide range of mathematical problems. So, let’s embark on
this mathematical journey together, as we explore the beauty and utility of
modular arithmetic and its profound impact on the world of mathematics.
1
Contents
1 Properties of Congruence Modulo 3
1.1 Some Illustrations . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.2 Practice Problems . . . . . . . . . . . . . . . . . . . . . . . . . . 5
2 Some Important Theorems 6
2.1 Fermat’s Little Theorem . . . . . . . . . . . . . . . . . . . . . . . 6
2.2 Euler’s Totient Function . . . . . . . . . . . . . . . . . . . . . . . 7
2.3 Wilson’s Theorem . . . . . . . . . . . . . . . . . . . . . . . . . . 8
2.4 Chinese Remainder Theorem (CRT) . . . . . . . . . . . . . . . . 9
2.5 Some Illustrations . . . . . . . . . . . . . . . . . . . . . . . . . . 10
2.6 Practice Problem . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
3 Conclusion 13
2
1 Properties of Congruence Modulo
In what follows n, a, b, c, d, x, y are integers.
1. a ≡ a(modn) (Reflexive relation for all a ∈ Z)
2. a ≡ b(modn) ⇔ b ≡ a(modn) (Symmetric relation for all a, b ∈ Z)
3. a ≡ b(modn), b ≡ c(modn) ⇒ a ≡ c(modn) (Transitive relation for all
Integers a, b, c)
4. If a ≡ b(modn) and c ≡ d(modn),
then
(i) a + c ≡ b + d(modn)
(ii) a − c ≡ b − d(modn)
(iii) a · c ≡ b · d(modn)
(iv) ax + cy ≡ bx + dy(modn)
5. If a ≡ b(modn),
then
(i) a + c ≡ b + c(modn)
(ii) a − c ≡ b − c(modn)
(iii) a · c ≡ b · c(modn)
(iv) a + k1 n ≡ b + k2 n(modn); k1 , k2 ∈ Z
(v) am ≡ bm (modn), m ∈ N
6. a ≡ b(modc) ⇒ f (a) ≡ f (b)(modc)Where f is a polynomial over Z. i.e.,
f (x) is a polynomial with integer coefficients
n
7. aλ ≡ bλ(modn) ⇒ a ≡ b(mod (λ,n) )In particular, if gcd(λ, n) = 1, then
aλ ≡ bλ(modn) ⇒ a ≡ b(modn)
8. If n ̸= 0 and (a, n) = 1, then there exists an integer a′ such that aa′ ≡
1(modn) which is called the inverse of ’ a ’ modulo n.
NOTE-
Always Take (mod 9) when asked f or sum of digits
T ake (mod 10n ) when asked f or Last n digits
3
1.1 Some Illustrations
Q.1.1.1
Find Remainder When 20252026 is divided by 2026
Solution-
As 2025 ≡ −1 (mod 2026)
−→ 20252026 ≡ 1 (mod 2026)
Q.1.1.2
P rove T hat 82024 − 1 is divisible by 9
Solution-
Consider 82024 = 82 ≡ 1 (mod 9) −→(82 )1012 ≡ 1 (mod 9)
1 − 1=0 (mod 9)
Hence it is Divisible
Q.1.1.3
Compute Last T wo Digits of 3124
Solution-
3124 = 962 = 8131 = 81 × 8130
−→ 81 × (812 )15 ) = 81 ×6115
= 81 ×815 = 81 ×1 ≡ 81 (mod 10)
4
1.2 Practice Problems
Q.1.2.1
Find Last three Digits of (70057 + 90058 + 70059 + ........... + 90052024 )
Q.1.2.2
P rove T hat (41999 +71999 - 2) is divisible by 9
Q.1.2.3
P rove T hat (3099 + 61100 ) is divisible by 31
Q.1.2.4 [Azerbaijan M O]
34!=295232799039a041408476186096435b000000
a, b are digits
F ind a, b
Q1.2.5
p
+bp
If gcd(a, b) = 1 and p is an odd prime, show that gcd a + b, aa+b = 1 or p.
Q1.2.6
If x, y, z Are Any Three Integers,
Then Show That xyz(x3 − y 3 )(y 3 − z 3 )(z 3 − x3 ) Is Divisible by 7
5
2 Some Important Theorems
2.1 Fermat’s Little Theorem
Statement: If p is a prime number and a is an integer not divisible by p, then
ap−1 ≡ 1 (mod p)
Proof: Let’s consider a as an integer not divisible by prime p. We aim to
prove that ap−1 ≡ 1 (mod p).
We can start by considering the set of numbers {a, 2a, 3a, . . . , (p−1)a}. None
of these numbers are divisible by p because if any of them were divisible by p,
it would imply that a itself is divisible by p, which contradicts our assumption.
Now, let’s multiply all the elements of this set together:
a · 2a · 3a · . . . · (p − 1)a = ap−1 (p − 1)!
Since p is prime and none of the elements in the set are divisible by p, their
product is congruent to the product of the elements from 1 to p − 1 modulo p.
Therefore, we have:
ap−1 (p − 1)! ≡ (p − 1)! (mod p)
Now, since p is prime, (p−1)! is divisible by p according to Wilson’s theorem.
Hence, we can cancel (p − 1)! from both sides of the congruence:
ap−1 ≡ 1 (mod p)
This completes the proof of Fermat’s Little Theorem.
6
2.2 Euler’s Totient Function
Definition: Euler’s totient function, denoted by ϕ(n), counts the number of
positive integers less than or equal to n that are relatively prime to n.
Properties:
1. Euler’s Totient Theorem: If a and n are coprime positive integers,
then
aϕ(n) ≡ 1 (mod n)
2. Multiplicative Property: If m and n are coprime positive integers, then
ϕ(mn) = ϕ(m) · ϕ(n)
3. Euler’s Product Formula: The value of Euler’s totient function ϕ(n)
can be expressed as a product over distinct prime factors of n:
1 1 1
ϕ(n) = n 1 − 1− ··· 1 −
p1 p2 pk
where p1 , p2 , . . . , pk are the distinct prime factors of n.
7
2.3 Wilson’s Theorem
Statement: If p is a prime number, then (p − 1)! ≡ −1 (mod p).
Proof: Let p be a prime number. We aim to prove that (p−1)! ≡ −1 (mod p).
Consider the set of integers {1, 2, 3, . . . , p − 1}. Each of these integers is
coprime to p, since none of them divide p.
Now, let’s multiply all the elements of this set together:
1 · 2 · 3 · . . . · (p − 1) = (p − 1)!
Since each element of the set is coprime to p, their product is congruent to
the product of all integers from 1 to p − 1 modulo p. Therefore, we have:
(p − 1)! ≡ 1 · 2 · 3 · . . . · (p − 1) (mod p)
Let’s denote the set of integers {1, 2, 3, . . . , p − 1} by S. Now, consider the
set S ′ obtained by multiplying each element of S by −1 modulo p. That is,
S ′ = {−1, −2, −3, . . . , −(p − 1)}.
Now, let’s multiply all the elements of S ′ together:
(−1) · (−2) · (−3) · . . . · (−(p − 1)) = (−1)p−1 (p − 1)!
Since p is odd, we have (−1)p−1 = −1, and thus:
(−1) · (−2) · (−3) · . . . · (−(p − 1)) = −(p − 1)!
Therefore, we have:
−(p − 1)! ≡ (p − 1)! (mod p)
Adding (p − 1)! to both sides, we get:
(p − 1)! + (p − 1)! ≡ 0 (mod p)
2(p − 1)! ≡ 0 (mod p)
Since p is prime, it cannot divide 2, so we can divide both sides by 2:
0
(p − 1)! ≡ (mod p)
2
(p − 1)! ≡ 0 (mod p)
Thus, we have proven that (p − 1)! ≡ −1 (mod p),
which is Wilson’s theorem.
8
2.4 Chinese Remainder Theorem (CRT)
Statement: Let n1 , n2 , . . . , nk be pairwise coprime positive integers, and let
a1 , a2 , . . . , ak be any integers. Then the system of congruences x ≡ a1 (mod n1 )
x ≡ a2 (mod n2 )
..
.
x ≡ ak (mod nk ) has a unique solution modulo N = n1 n2 · · · nk .
Proof: We will construct a solution x using the Chinese Remainder Theorem
(CRT).
Define Ni = nNi for each i. Since ni and Ni are coprime, there exists an
integer yi such that Ni yi ≡ 1 (mod ni ).
Now, let
Xk
x= ai Ni yi
i=1
We claim that this x is a solution to the system of congruences.
First, let’s check that x ≡ ai (mod ni ) for each i. Since Ni ≡ 0 (mod nj )
for j ̸= i, we have
ai Ni yi ≡ ai · 0 · yi ≡ 0 (mod nj )
for j ̸= i. Therefore,
x ≡ ai Ni yi ≡ ai · 1 · yi ≡ ai (mod ni )
for each i, as desired.
Next, let’s show that x is unique modulo N . Suppose x′ is another solution
to the system of congruences. Then, we have x ≡ x′ (mod ni ) for each i. This
implies that ni divides (x − x′ ) for each i, so N = n1 n2 · · · nk divides (x − x′ ).
Therefore, x ≡ x′ (mod N ).
Thus, we have shown that the system of congruences has a unique solution
modulo N , completing the proof of the Chinese Remainder Theorem.
9
2.5 Some Illustrations
Q.2.5.1
Find Remainder When ( 202436 + 202536 + ........... + 308836 ) is Divided By 37
Solution-
This is one Direct And Easy Application of Fermat’s Little Theorem
So, Using Fermat’s Little Theorem
ap−1 ≡ 1 And gcd(a,p)=1
Here is same...Numbers Between 2024 to 3088 are 1065
So, We have 1065 (mod 37) −→1065 ≡ 29 (mod 37)
So, Remainder is 29
Q2.5.2
Compute the Remainder when 68! is divided by 71
Solution-
This is an Application of Wilson’s Theorem
(p − 1)! ≡ −1 (mod p) −→ 70! ≡ −1 (mod 71)
70! ≡ −1 + 71 (mod 71)
69! ≡ 1 (mod 71) [dividingby70]
69! ≡ 1 + 71 × 34 (mod 71)
69! ≡ 2415 (mod 71)
68! ≡ 35 (mod 71)
Hence, Remainder is 35
10
Q.2.5.3 [INMO 1992]
Find Remainder When 1992 is divided by 92
Solution-
T his is an Application of Euler′ s totient f unction
19ϕ(92) ≡ 1 (mod 92)
1944 ≡ 1 (mod 92)
1988 ≡ 1 (mod 92)
4 88
19 × 19 ≡ 194 (mod 92)
By some calculation,
194 ≡ 49 (mod 92)
So the remainder is 49.
11
2.6 Practice Problem
Q.2.6.1 [Lithuania MO]
Find the remainder when
1965 + 2965 + 3965 + .............. + 2018965
is Divided by 2021
Q.2.6.2
F or a given positive integer k, denote the square of the sum
of its digit by f1 (k) and
fn+1 (k) = f1 [fn (k)]
Find the value of f1995 21995
Q.2.6.3 [Singapore MO]
Find the remainder when
72023 + 92023
is divided by 64
Q.2.6.4
Let f (n) denotes digit sum of n
Compute f (f (f (52013 )))
Q.2.6.5
Find all n such that ϕn |n
where n ∈ N
12
3 Conclusion
Dear Readers,
As we draw to a close on our exploration of modular arithmetic, we extend
our heartfelt gratitude for accompanying us on this mathematical journey. To-
gether, we’ve traversed the intricate pathways of congruence modulo, uncovered
the elegance of Fermat’s Little Theorem, marveled at the versatility of the Chi-
nese Remainder Theorem, and appreciated the profundity of Wilson’s Theorem.
I express our deepest appreciation for your engagement and curiosity as we
delved into these fundamental concepts. Your eagerness to learn fuels our pas-
sion for sharing the beauty and utility of mathematics.
As we bid farewell, I encourage you to continue your mathematical voyage with
a spirit of inquiry and a hunger for knowledge. Remember, mathematics is not
merely a subject of study but a gateway to understanding the world around us
and unlocking new realms of possibility.
With warm regards and sincere thanks,
[Nrip Dave]
13