Foundations of Security Week3 Lecture
Fermat’s Theorem and Euler’s Theorem
Lecture Outline
- Introduction to Fermat’s Theorem
- Conditions for applying Fermat’s Theorem
- Examples of Fermat’s Theorem in modular arithmetic
- Introduction to Euler’s Totient Function and computing totient values
- Introduction to Euler’s Theorem
- Conditions for applying Euler’s Theorem
Learning Outcomes
By the end of this lecture, students should be able to:
- Explain the concept of Fermat’s Theorem
- Identify the conditions required to apply Fermat’s Theorem
- Apply Fermat’s Theorem to simplify modular exponentiation
- Define Euler’s Totient Function & Calculate the totient value of a number
- Apply Euler’s Theorem to solve modular exponentiation problems
Fermat’s Theorem
Before discussing what Fermat’s Theorem entails, consider the calculation of . This might seem difficult due to the size of the numbers, but with Fermat’s Theorem, we can find a simple solution.
The Magic of Fermat’s Theorem:
The result of is 1.
Applying Fermat’s Theorem:
Fermat’s Theorem states that if p is a prime number and a is an integer not divisible by p, then
Given 523 is a prime number, any number raised to 522 (which is 523-1) modulo 523 will result in 1, according to Fermat’s Theorem.
This property exemplifies the theorem’s practicality, showing that even without direct calculation, we can determine that because is congruent to , which simplifies to 1.
Preconditions for Applying Fermat’s Theorem:
- Check if p is a prime number: Fermat’s Theorem only applies if p is prime.
- Ensure a is not divisible by p: a must be an integer that p does not divide for the theorem to hold.
If these conditions are met, then
Example:
Let a=2 and p=3. Since p is prime and a is not divisible by p, we can apply Fermat’s Theorem.
Calculation:
Compute :
Result:
As expected, , proving the theorem’s validity in this case.
Example Application
Given: a = 2, p = 11
Objective: Verify the conditions and apply Fermat’s Theorem.
Conditions:
p should be a prime number.
a should not be divisible by p.
Solution:
p = 11 is a prime number. a = 2 is not divisible by 11. These conditions allow us to apply Fermat’s Theorem, which states .
Example (confirming)
Compute:
Calculating
Result:
, confirming the theorem.
Euler’s Totient Function
Introduction:
Euler’s totient function, denoted as , counts the number of integers between 1 and inclusive that are co-prime to . This means they share no common divisors with other than 1.
Formula:
Example Calculation - :
- Consider the integers from 1 to 6: {1, 2, 3, 4, 5, 6}.
- Determine which numbers are co-prime to 6 by checking if their gcd with 6 is 1:
(not co-prime)
(not co-prime)
(not co-prime)
(not co-prime)
Result:
- Only 1 and 5 are co-prime to 6.
- Therefore, .
Exercise:
- Find the value of .
- Find the value of .
Properties of Euler’s Totient Function:
- Prime Numbers: If is a prime number, for all . Thus, .
- Power of Primes: For a prime number and any integer , exactly numbers between 1 and are divisible by . This results in: .
- Product of Co-prime Numbers: If and are relatively prime, then
First Property of Euler’s Totient Function:
- Prime Numbers: If is a prime number, for all . Thus, . Example: Understanding through simple computation:
- The set {1,2,3,4,5} includes integers less than 5.
- ; .
- Thus, four numbers are co-prime with 5, resulting in .
Clarification using :
- For prime number 23, every number from 1 to 22 is co-prime with 23.
- Thus, .
Second Property of Euler’s Totient Function:
- Power of Primes: For a prime number and any integer , exactly numbers between 1 and are divisible by . This results in: .
Example: Calculate :
- Theorem: From , for and , we have:
- Verification: Considering the set {1, 2, 3, 4, 5, 6, 7, 8}, the numbers co-prime with 8 are 1, 3, 5, 7.
- The of 1, 3, 5, 7 with 8 is 1, confirming that .
Third Property of Euler’s Totient Function:
- Product of Co-prime Numbers: If and are relatively prime, then .
- Example: Calculate where and (since , 3 and 5 are relatively prime):
- Calculation: From the properties,
Important Note: and must be distinct and co-prime for this property to apply.
For instance, , which is , should be calculated using the property for prime powers, not as :
-
Correct Approach: Using the second property,

-
Product of Co-prime Numbers: If and are relatively prime, then .
Another Example: Calculate , where :
Calculation: Since 2 and 3 are co-prime,
Assignment: Complete these exercise and submit during seminar class
- Calculate the Euler’s Totient Function for the given numbers:
Show how you computed your answers.
Only handwritten solutions.
No copy-paste will be accepted.
Euler’s Theorem
- It states that if and are co-prime (i.e., ), then raised to the power of Euler’s totient function is congruent to 1 modulo : For the given example where and :
- Checking if co-prime:
- The gcd of 3 and 10 is 1, which confirms that 3 and 10 are co-prime.
- Apply Euler’s Theorem:
- We first calculate , where , and using the formula for Euler’s Totient function,
- Calculation of : Since 10 is the product of two distinct prime numbers, is calculated as:
- Now from we show that
This confirms that , thus validating Euler’s Theorem.
Assignment
Complete this exercise and submit during seminar class
Find a number between 0 and 16 congruent to using Fermat’s Little Theorem and Modular Exponentiation.
支持与分享
如果这篇文章对你有帮助,欢迎分享给更多人或赞助支持!