Department of Mathematical Sciences
Instructor: Daiva Pucinskaite
Discrete Mathematics
Fermat’s Little Theorem
Recall: Fermat’s Little Theorem: Let p be a prime and let a
be an integer. Then
ap mod p = a mod p.
Remark: Let p be a prime and a ∈ Zp , then ”Fermat’s Little
Theorem” implies
p
a
{z· · · ⊗ a} = a mod p = a mod p = a
|⊗a⊗
p-times
If a 6= 0, then a is invertible (because gcd(a, p) = 1). Thus there
exists b ∈ Zp such that a ⊗ b = 1 (b is called the reciprocal of a).
a
{z· · · ⊗ a} = a
|⊗a⊗
multiply both
sides by b
=⇒
p-times
a
{z· · · ⊗ a} ⊗a ⊗b = a ⊗ b = 1
|⊗a⊗
p−1-times
{z
}
|
ptimes
=⇒
a
⊗ }b = a ⊗ b = 1
|⊗a⊗
{z· · · ⊗ a} ⊗ a
| {z
1
p−1-times
=⇒
a
|⊗a⊗
{z· · · ⊗ a} ⊗1 = 1
p−1-times
=⇒
a
{z· · · ⊗ a} = 1
|⊗a⊗
p−1-times
ap−1 = 1
=⇒
=⇒
for any a ∈ Zp sucht that a 6= 0, we have ap−1 = 1.
a
|⊗a⊗
{z· · · ⊗ a} ⊗a = 1
p−2-times
|
=⇒
{z
p−1-times
}
a
|⊗a⊗
{z· · · ⊗ a} ⊗a = 1
p−2-times
=⇒
a
|⊗a⊗
{z· · · ⊗ a} is the reciprocal of a
p−2-times
1. Determine the reciprocal of a ∈ Zp with a 6= 0 for
(1) p = 7
(2) p = 11
(3) p = 13
1. Determine the reciprocal of a ∈ Zp with a 6= 0 for
(1) p = 7
• The reciprocal of a = 1 is b = 1 (1 ⊗ 1 = 1)
• The reciprocal of a = 2 is
b = |2 ⊗ 2 ⊗{z
2 ⊗ 2 ⊗ 2}
7−2=5-times
⇓
b = |2 {z
⊗ 2} ⊗ 2| {z
⊗ 2} ⊗2
4
4
⇓
4| {z
⊗ 4} ⊗2
b=
16 mod 7=2
⇓
b=2⊗2=4
Check: 2 ⊗ 4 = 8 mod 7 = 1.
• The reciprocal of a = 3 is
b = |3 ⊗ 3 ⊗{z
3 ⊗ 3 ⊗ 3}
5-times
⇓
⊗ 3} ⊗3
b = |3 {z
⊗ 3} ⊗ 3| {z
9 mod 7=2
9 mod 7=2
⇓
b = |2 {z
⊗ 2} ⊗3
4 mod 7=4
⇓
b = 4 ⊗ 3 = 12 mod 7 = 5
2
Check: 3 ⊗ 5 = 15 mod 7 = 1.
• The reciprocal of a = 4 is
b = |4 ⊗ 4 ⊗{z
4 ⊗ 4 ⊗ 4}
5-times
b=
⇓
4| {z
⊗ 4} ⊗ 4| {z
⊗ 4} ⊗4
16 mod 7=2
16 mod 7=2
⇓
b = |2 {z
⊗ 2} ⊗4
4 mod 7=4
⇓
b = 4 ⊗ 4 = 16 mod 7 = 2
Check: 4 ⊗ 2 = 8 mod 7 = 1.
• The reciprocal of a = 5 is
b = |5 ⊗ 5 ⊗{z
5 ⊗ 5 ⊗ 5}
5-times
⇓
b=3⊗3⊗5
⇓
b = 2 ⊗ 5 = 10 mod 7 = 3
Check: 5 ⊗ 3 = 15 mod 7 = 1.
• The reciprocal of a = 6 is
b = |6 ⊗ 6 ⊗{z
6 ⊗ 6 ⊗ 6}
5-times
b=
⇓
⊗ 6} ⊗ 6| {z
⊗ 6} ⊗6
|6 {z
36 mod 7=1
36 mod 7=1
⇓
b=1⊗1⊗6=6
Check: 6 ⊗ 6 = 36 mod 7 = 1.
3
(2) p = 11
• The reciprocal of a = 1 is 1
• The reciprocal of a = 2 is
b = |2 ⊗ 2 ⊗ 2 ⊗ 2 ⊗{z
2 ⊗ 2 ⊗ 2 ⊗ 2 ⊗ 2}
11−2=9-times
⇓
b = |2 {z
⊗ 2} ⊗ 2| {z
⊗ 2} ⊗ 2| {z
⊗ 2} ⊗ 2| {z
⊗ 2} ⊗2
4
b=
4
⊗ 4}
|4 {z
16 mod 11=5
⇓
⊗
4
4
4| {z
⊗ 4}
⊗2
16 mod 11=5
⇓
b = 5 ⊗ 5 ⊗ 2 = 50 mod 11 = 6
Check: 2 ⊗ 6 = 12 mod 11 = 1.
• The reciprocal of a = 3 is b = |3 ⊗ 3 ⊗
{z· · · ⊗ 3} = 4
9-times
• The reciprocal of a = 4 is b = |4 ⊗ 4 ⊗
{z· · · ⊗ 4} = 3
9-times
• The reciprocal of a = 5 is b = |5 ⊗ 5 ⊗
{z· · · ⊗ 5} = 9
9-times
• The reciprocal of a = 6 is b = |6 ⊗ 6 ⊗
{z· · · ⊗ 6} = 2
9-times
• The reciprocal of a = 7 is b = |7 ⊗ 7 ⊗
{z· · · ⊗ 7} = 8
9-times
• The reciprocal of a = 8 is b = |8 ⊗ 8 ⊗
{z· · · ⊗ 8} = 7
9-times
• The reciprocal of a = 9 is b = |9 ⊗ 9 ⊗
{z· · · ⊗ 9} = 5
9-times
• The reciprocal of a = 10 is b = |10 ⊗ 10 ⊗
{z · · · ⊗ 10} = 10
9-times
4
© Copyright 2026 Paperzz