Department of Mathematical Sciences
Instructor: Daiva Pucinskaite
Discrete Mathematics
Modular Arithmetic
Recall: Let n ∈ Z such that n > 0 and a ∈ Zn .
• An element a ∈ Zn = {0, 1, . . . , n − 1} is invertible if and only
if gcd(a, n) = 1.
• If gcd(a, n) = 1, then there exist integers x, y such that
1=a·x+n·y
• If 1 = a · x + n · y and b = x mod n, then a ⊗ b = 1.
1. Determine all invertible elements in
(1) Z7 .
Let a ∈ Z7 such that a 6= 0, then a ∈ {1, 2, 3, 4, 5, 6}. Since 1
and 7 are the only positive divisors of 7, we have that the only
common positive divisor of 7 and a is 1. Thus gcd(a, 7) = 1,
and consequently a is invertible.
(2) Z13 .
Let a ∈ Z13 such that a 6= 0, then a ∈ {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12}.
Since 1 and 13 are the only posivtive divisors of 13, we have
that the only common positive divisor of 13 and a is 1. Thus
gcd(a, 13) = 1, and consequently a is invertible.
(3) Z24 .
The invertible elements in Z24 are in the set
A = {1, 5, 7, 11, 13, 17, 19, 23}
All those element are prime numbers, and 1 is the only positive
common divisor with 24. For any number in
x ∈ Z24 − A = {0, 2, 3, 4, 6, 8, 9, 10, 12, 14, 15, 16, 18, 20, 21, 22}
we have gcd(x, 24) 6= 1.
(4) Z25 . The invertible elements in Z25 are in the set
A = {1, 2, 3, 4, 6, 7, 8, 9, 11, 12, 13, 14, 16, 17, 18, 19, 21, 22, 13},
because gcd(a, 24) = 1 for any a ∈ A.
2. Determine the reciprocal of any invertible element a from 1. (i.e.
for each invertible element a from 1. find b in the given number
system such that a ⊗ b = 1.)
(1) Z7 .
• Since 1 ⊗ 1 = 1, we have that 1 is the reciprocal of 1.
• Reciprocal of 2 ∈ Z7 .
Using Euclid’s Algorithm we can find integers x, y such
that gcd(2, 7) = 1 = 2 · x + 7 · y.
(The reciprocal of 2 ∈ Z7 is then b = x mod 7.)
7 = 3 · 2 + 1 =⇒ gcd(2, 7) = 1 = 2 · (−3) +7 · |{z}
1
| {z }
x
y
2 = 2·1+0
Since 4 = (−3) mod 7, we have that 4 is the reciprocal of
2 ∈ Z7 ( check: 2 ⊗ 4 = 8 mod 7 = 1)
• Reciprocal of 3 ∈ Z7 .
Using Euclid’s Algorithm we can find integers x, y such
that gcd(3, 7) = 1 = 3 · x + 7 · y.
(The reciprocal of 3 ∈ Z7 is then b = x mod 7.)
7 = 2 · 3 + 1 =⇒ gcd(3, 7) = 1 = 3 · (−2) +7 · |{z}
1
| {z }
x
3 = 3·1+0
2
y
Since 5 = (−2) mod 7, we have that 5 is the reciprocal of
3 ∈ Z7 ( check: 3 ⊗ 5 = 15 mod 7 = 1)
• Reciprocal of 4 ∈ Z7 .
Using Euclid’s Algorithm we can find integers x, y such
that gcd(4, 7) = 1 = 4 · x + 7 · y.
(The reciprocal of 4 ∈ Z7 is then b = x mod 7.)
7 = 1 · 4 + 3 =⇒ 3 = 4 · (−1) + 7
4 = 1 · 3 + 1 =⇒ 1 = 4 − 3
= 4 − (4 · (−1) + 7)
|
{z
}
3
= 4 · |{z}
2 +7 · (−1)
| {z }
x
y
3 = 3·1+0
We have gcd(4, 7) = 1 = 4 · |{z}
2 +7 · (−1). Since 2 =
| {z }
x
y
(2) mod 7, we have that 2 is the reciprocal of 4 ∈ Z7 (
check: 4 ⊗ 2 = 8 mod 7 = 1)
• Reciprocal of 5 ∈ Z7 .
Using Euclid’s Algorithm we can find integers x, y such
that gcd(5, 7) = 1 = 5 · x + 7 · y.
(The reciprocal of 5 ∈ Z7 is then b = x mod 7.)
7 = 1 · 5 + 2 =⇒ 2 = 5 · (−1) + 7
5 = 2 · 2 + 1 =⇒ 1 = 5 − 2 · 2
= 5 − 2 (5 · (−1) + 7)
|
{z
}
2
= 5 · |{z}
3 +7 · (−2)
| {z }
x
y
2 = 2·1+0
We have gcd(5, 7) = 1 = 5 · |{z}
3 +7 · (−2). Since 3 =
| {z }
x
y
(3) mod 7, we have that 3 is the reciprocal of 5 ∈ Z7 (
check: 5 ⊗ 3 = 15 mod 7 = 1)
• Reciprocal of 6 ∈ Z7 .
Using Euclid’s Algorithm we can find integers x, y such
that gcd(6, 7) = 1 = 6 · x + 7 · y.
(The reciprocal of ∈ Z7 is then b = x mod 7.)
3
7 = 1 · 6 + 1 =⇒ gcd(6, 7) = 1 = 6 · (−1) +7 · |{z}
1
| {z }
x
y
6 = 6·1+0
Since 6 = (−1) mod 7, we have that 6 is the reciprocal of
6 ∈ Z7 ( check: 6 ⊗ 6 = mod 7 = 1).
Let a ∈ Z7 such that a 6= 0, then a ∈ {1, 2, 3, 4, 5, 6}. Since 1
and 7 are the only positive divisors of 7, we have that the only
common positive divisor of 7 and a is 1. Thus gcd(a, 7) = 1,
and consequently a is invertible.
(2) Z13 .
• 1 ⊗ 1 = 1, thus 1 is the reciprocal of 1 ∈ Z13 .
• 2 ⊗ 7 = 14 mod 13 = (1 + 1 · 13) mod 13 = 1, thus 7 is the
reciprocal of 2 ∈ Z13 .
• 3 ⊗ 9 = 27 mod 13 = (1 + 2 · 13) mod 13 = 1, thus 9 is the
reciprocal of 3 ∈ Z13 .
• 4 ⊗ 10 = 40 mod 13 = (1 + 3 · 13) mod 13 = 1, thus 10 is
the reciprocal of 4 ∈ Z13 .
• 5 ⊗ 8 = 40 mod 13 = (1 + 3 · 13) mod 13 = 1, thus 8 is the
reciprocal of 5 ∈ Z13 .
• 6 ⊗ 11 = 66 mod 13 = (1 + 5 · 13) mod 13 = 1, thus 11 is
the reciprocal of 6 ∈ Z13 .
• 7 ⊗ 2 = 14 mod 13 = (1 + 1 · 13) mod 13 = 1, thus 2 is the
reciprocal of 7 ∈ Z13 .
• 8 ⊗ 5 = 40 mod 13 = (1 + 3 · 13) mod 13 = 1, thus 5 is the
reciprocal of 8 ∈ Z13 .
• 9 ⊗ 3 = 27 mod 13 = (1 + 2 · 13) mod 13 = 1, thus 3 is the
reciprocal of 9 ∈ Z13 .
• 10 ⊗ 4 = 40 mod 13 = (1 + 3 · 13) mod 13 = 1, thus 4 is
the reciprocal of 10 ∈ Z13 .
• 11 ⊗ 6 = 66 mod 13 = (1 + 5 · 13) mod 13 = 1, thus 6 is
the reciprocal of 11 ∈ Z13 .
• 12 ⊗ 12 = 144 mod 13 = (1 + 11 · 13) mod 13 = 1, thus 12
is the reciprocal of 12 ∈ Z13 .
4
Let a ∈ Z13 such that a 6= 0, then a ∈ {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12}.
Since 1 and 13 are the only posivtive divisors of 13, we have
that the only common positive divisor of 13 and a is 1. Thus
gcd(a, 13) = 1, and consequently a is invertible.
(3) Z24 .
• 1 ⊗ 1 = 1, thus 1 is the reciprocal of 1 ∈ Z24 .
• 5 ⊗ 5 = 25 mod 24 = (1 + 1 · 24) mod 24 = 1, thus 5 is the
reciprocal of 5 ∈ Z24 .
• 7 ⊗ 7 = 49 mod 24 = (1 + 2 · 24) mod 24 = 1, thus 7 is the
reciprocal of 7 ∈ Z24 .
• 11 ⊗ 11 = 121 mod 24 = (1 + 5 · 24) mod 24 = 1, thus 11
is the reciprocal of 11 ∈ Z24 .
• 13 ⊗ 13 = 169 mod 24 = (1 + 7 · 24) mod 24 = 1, thus 13
is the reciprocal of 13 ∈ Z24 .
• 17 ⊗ 17 = 289 mod 24 = (1 + 12 · 24) mod 24 = 1, thus 17
is the reciprocal of 17 ∈ Z24 .
• 19 ⊗ 19 = 361 mod 24 = (1 + 15 · 24) mod 24 = 1, thus 19
is the reciprocal of 19 ∈ Z24 .
• 23 ⊗ 23 = 529 mod 24 = (1 + 22 · 24) mod 24 = 1, thus 24
is the reciprocal of 24 ∈ Z24 .
(4) Z25 .
• 1 ⊗ 1 = 1,
• 2 ⊗ 13 = 1,
• 3 ⊗ 17 = 1,
• 4 ⊗ 19 = 1,
• 6 ⊗ 21 = 1,
• 7 ⊗ 18 = 1,
• 8 ⊗ 22 = 1,
• 9 ⊗ 14 = 1,
• 11 ⊗ 16 = 1,
5
•
•
•
•
•
•
•
•
•
•
•
12 ⊗ 23 = 1,
13 ⊗ 2 = 1,
14 ⊗ 9 = 1,
16 ⊗ 11 = 1,
17 ⊗ 3 = 1,
18 ⊗ 7 = 1,
19 ⊗ 4 = 1,
21 ⊗ 6 = 1,
22 ⊗ 8 = 1,
23 ⊗ 12 = 1,
24 ⊗ 24 = 1.
3. For each invertible element a from 1. find c in the given number system such that a ⊗ c = 3.
(1) Z7 .
• Since 1 ⊗ 1 = 1, we have 3 = 1 ⊗ 3, thus a = 3.
• Since 2 ⊗ 4 = 1, we have
3 = 1 ⊗ 3 = (2 ⊗ 4) ⊗3 = 2 ⊗ (4 ⊗ 3),
| {z }
| {z }
1
5∈Z7
Thus a = 5 ( check: 2 ⊗ 5 = 10 mod 7 = 3).
• Since 3 ⊗ 5 = 1, we have
3 = 1 ⊗ 3 = (3 ⊗ 5) ⊗3 = 3 ⊗ (5 ⊗ 3),
| {z }
| {z }
1
1∈Z7
Thus a = 1 ( check: 3 ⊗ 1 = 3 mod 7 = 3).
• Since 4 ⊗ 2 = 1, we have
3 = 1 ⊗ 3 = (4 ⊗ 2) ⊗3 = 4 ⊗ (2 ⊗ 3),
| {z }
| {z }
1
6∈Z7
Thus a = 6 ( check: 4 ⊗ 6 = 24 mod 7 = 3).
6
• Since 5 ⊗ 3 = 1, we have
3 = 1 ⊗ 3 = (5 ⊗ 3) ⊗3 = 5 ⊗ (3 ⊗ 3),
| {z }
| {z }
1
2∈Z7
Thus a = 2 ( check: 5 ⊗ 2 = 10 mod 7 = 3).
• Since 6 ⊗ 6 = 1, we have
3 = 1 ⊗ 3 = (6 ⊗ 6) ⊗3 = 6 ⊗ (6 ⊗ 3),
| {z }
| {z }
1
4∈Z7
Thus a = 4 ( check: 6 ⊗ 4 = 24 mod 7 = 3).
(3) Z24 .
• Since 1 ⊗ 1 = 1, we have 3 = 1 ⊗ 3, thus a = 3.
• Since 5 ⊗ 5 = 1, we have
3 = 1 ⊗ 3 = (5 ⊗ 5) ⊗3 = 5 ⊗ (5 ⊗ 3),
| {z }
| {z }
1
15∈Z24
Thus a = 15 ( check: 5 ⊗ 15 = 75 mod 24 = 3).
• Since 7 ⊗ 7 = 1, we have
3 = 1 ⊗ 3 = (7 ⊗ 7) ⊗3 = 7 ⊗ (7 ⊗ 3),
| {z }
| {z }
1
21∈Z24
Thus a = 21 ( check: 7 ⊗ 21 = 147 mod 24 = 3).
• Since 11 ⊗ 11 = 1, we have
3 = 1 ⊗ 3 = (11 ⊗ 11) ⊗3 = 11 ⊗ (11 ⊗ 3),
| {z }
| {z }
1
9∈Z24
Thus a = 9 ( check: 11 ⊗ 9 = 99 mod 24 = 3).
• Since 13 ⊗ 13 = 1, we have
3 = 1 ⊗ 3 = (13 ⊗ 13) ⊗3 = 13 ⊗ (13 ⊗ 3),
| {z }
| {z }
1
15∈Z24
Thus a = 15 ( check: 13 ⊗ 15 = 195 mod 24 = 3).
• Since 17 ⊗ 17 = 1, we have
7
3 = 1 ⊗ 3 = (17 ⊗ 17) ⊗3 = 17 ⊗ (17 ⊗ 3),
| {z }
| {z }
1
3∈Z24
Thus a = 3 ( check: 17 ⊗ 3 = 21 mod 24 = 3).
• Since 19 ⊗ 19 = 1, we have
3 = 1 ⊗ 3 = (19 ⊗ 19) ⊗3 = 19 ⊗ (19 ⊗ 3),
| {z }
| {z }
1
9∈Z24
Thus a = 9 ( check: 19 ⊗ 9 = 171 mod 24 = 3).
4. For each not invertible element a from 1. find c 6= 0 in the
given number system such that a ⊗ c = 0.
(1) 0 ⊗ 5 = 0 and 5 6= 0 in Z7 .
(2) 0 ⊗ 5 = 0 and 5 6= 0 in Z13 .
(3) Z24 .
• 0 ⊗ 5 = 0 and 5 6= 0 in Z24 .
Recall.
If a ∈ Z24 is non-invertibe, then d = gcd(a, 24) 6= 1. Since
d|a and d|24, there exist x, y ∈ Z such a = d · x and
24 = d · y. Therefore
a ⊗ y = (d · x) ⊗y
| {z }
a
= (d · x · y) mod 24
= (x · d · y ) mod 24 .
|{z}
24
= (24 · x) mod 24
= 0
• Since gcd(2, 24) = 2, we have 2 = 2 · |{z}
1 and 24 = 2 · |{z}
12 .
x
y
Thus 2 ⊗ 12 = 0.
• Since gcd(3, 24) = 3, we have 3 = 3 · |{z}
1 and 24 = 3 · |{z}
8 .
x
Thus 3 ⊗ 8 = 0.
8
y
• Since gcd(4, 24) = 4, we have 4 = 4 · |{z}
1 and 24 = 4 · |{z}
6 .
x
y
Thus 4 ⊗ 6 = 0.
• Since gcd(6, 24) = 3, we have 6 = 3 · |{z}
2 and 24 = 3 · |{z}
8 .
x
y
Thus 6 ⊗ 8 = 0.
• Since gcd(8, 24) = 4, we have 8 = 4 · |{z}
2 and 24 = 4 · |{z}
6 .
x
y
Thus 8 ⊗ 6 = 0.
• Since gcd(10, 24) = 2, we have 10 = 2 · |{z}
5 and 24 =
2 · |{z}
12 . Thus 10 ⊗ 12 = 0.
x
y
• Since gcd(14, 24) = 2, we have 14 = 2 · |{z}
7 and 24 =
2 · |{z}
12 . Thus 14 ⊗ 12 = 0.
x
y
• Since gcd(15, 24) = 3, we have 15 = 3 · |{z}
5 and 24 =
3 · |{z}
8 . Thus 15 ⊗ 8 = 0.
x
y
• Since gcd(16, 24) = 8, we have 16 = 8 · |{z}
2 and 24 =
8 · |{z}
3 . Thus 16 ⊗ 3 = 0.
x
y
• Since gcd(18, 24) = 6, we have 18 = 6 · |{z}
3 and 24 =
6 · |{z}
4 . Thus 18 ⊗ 4 = 0.
x
y
• Since gcd(20, 24) = 4, we have 20 = 4 · |{z}
5 and 24 =
4 · |{z}
6 . Thus 20 ⊗ 6 = 0.
x
y
• Since gcd(21, 24) = 3, we have 21 = 3 · |{z}
7 and 24 =
3 · |{z}
8 . Thus 21 ⊗ 8 = 0.
x
y
• Since gcd(22, 24) = 2, we have 22 = 2 · |{z}
11 and 24 =
x
9
2 · |{z}
12 . Thus 22 ⊗ 12 = 0.
y
10
© Copyright 2026 Paperzz