Introduction to Euler's Theorem

Euler's Theorem is a fundamental result in number theory that establishes a relationship between exponents and modular arithmetic. Named after the Swiss mathematician Leonhard Euler, this theorem is a generalization of Fermat's Little Theorem and has profound applications in cryptography, particularly in the RSA encryption algorithm.

Why Euler's Theorem Matters:

  • Foundation for modern cryptography and secure communications
  • Generalization of Fermat's Little Theorem
  • Essential for understanding modular arithmetic
  • Key component in RSA encryption algorithm
  • Used in primality testing and factorization algorithms
  • Important for understanding group theory and abstract algebra

In this comprehensive guide, we'll explore Euler's Theorem from its mathematical statement to practical applications, with clear explanations, visual examples, and interactive practice problems to help you master this essential mathematical concept.

Euler's Theorem Statement

Euler's Theorem establishes a fundamental relationship in modular arithmetic between a number and its exponent when taken modulo another number.

Euler's Theorem
aφ(n) ≡ 1 (mod n)

Where:

  • a and n are coprime integers (gcd(a, n) = 1)
  • φ(n) is Euler's Totient Function (the count of integers between 1 and n that are coprime to n)
  • n > 1 (the modulus)

Example: Let a = 3 and n = 8. Since gcd(3, 8) = 1, and φ(8) = 4 (numbers coprime to 8: 1, 3, 5, 7), then:

34 = 81 ≡ 1 (mod 8) because 81 ÷ 8 = 10 remainder 1

Euler's Theorem Verifier

Enter values to verify Euler's Theorem

Euler's Totient Function φ(n)

Euler's Totient Function φ(n) counts the positive integers up to n that are relatively prime to n (i.e., numbers that share no common factors with n other than 1).

Euler's Totient Function Properties
  • φ(1) = 1 by definition
  • If p is prime, then φ(p) = p - 1
  • If p is prime and k ≥ 1, then φ(pk) = pk - pk-1
  • If gcd(m, n) = 1, then φ(mn) = φ(m)φ(n) (multiplicative property)

Examples:

φ(9) = φ(32) = 32 - 31 = 9 - 3 = 6 (numbers: 1, 2, 4, 5, 7, 8)

φ(12) = φ(3×4) = φ(3)φ(4) = 2×2 = 4 (numbers: 1, 5, 7, 11)

φ(15) = φ(3×5) = φ(3)φ(5) = 2×4 = 8 (numbers: 1, 2, 4, 7, 8, 11, 13, 14)

Calculating φ(n) for Any Integer

Step 1: Factor n into prime powers: n = p1k₁ × p2k₂ × ... × prkᵣ

Step 2: Apply the formula: φ(n) = n × (1 - 1/p1) × (1 - 1/p2) × ... × (1 - 1/pr)

Step 3: Simplify the expression

Example: Calculate φ(60)

Step 1: 60 = 22 × 3 × 5

Step 2: φ(60) = 60 × (1 - 1/2) × (1 - 1/3) × (1 - 1/5)

Step 3: φ(60) = 60 × (1/2) × (2/3) × (4/5) = 60 × 8/30 = 16

Verification: Numbers coprime to 60: 1, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 49, 53, 59 (16 numbers)

Totient Function Calculator

Enter a number to calculate its totient function value

Proof of Euler's Theorem

The proof of Euler's Theorem is elegant and relies on properties of modular arithmetic and group theory. Here we present a step-by-step proof.

Proof of Euler's Theorem

Step 1: Let R = {r1, r2, ..., rφ(n)} be the set of positive integers less than n that are coprime to n.

Step 2: Multiply each element of R by a (mod n), where gcd(a, n) = 1. This gives us a new set S = {ar1 mod n, ar2 mod n, ..., arφ(n) mod n}.

Step 3: Show that S is a permutation of R. Since a is coprime to n, multiplication by a is a bijection modulo n.

Step 4: Multiply all elements of R together: r1 × r2 × ... × rφ(n) ≡ P (mod n)

Step 5: Multiply all elements of S together: (ar1) × (ar2) × ... × (arφ(n)) ≡ aφ(n)P (mod n)

Step 6: Since S is a permutation of R, both products are congruent modulo n: aφ(n)P ≡ P (mod n)

Step 7: Since P is coprime to n (as each ri is coprime to n), we can cancel P from both sides: aφ(n) ≡ 1 (mod n)

Example Walkthrough: Let's verify the proof for n = 8, a = 3

Step 1: R = {1, 3, 5, 7} (φ(8) = 4)

Step 2: S = {3×1 mod 8, 3×3 mod 8, 3×5 mod 8, 3×7 mod 8} = {3, 1, 7, 5}

Step 3: S = {3, 1, 7, 5} is indeed a permutation of R = {1, 3, 5, 7}

Step 4: P = 1×3×5×7 = 105 ≡ 1 (mod 8)

Step 5: aφ(n)P = 34 × 105 = 81 × 105 = 8505 ≡ 1 (mod 8)

Step 6: Both products are congruent to 1 mod 8

Step 7: Since P ≡ 1 (mod 8) and is coprime to 8, we get 34 ≡ 1 (mod 8)

Fermat's Little Theorem

Fermat's Little Theorem is a special case of Euler's Theorem when the modulus n is a prime number.

Fermat's Little Theorem
ap-1 ≡ 1 (mod p)

Where:

  • p is a prime number
  • a is an integer not divisible by p (gcd(a, p) = 1)

Example: Let p = 7 (prime) and a = 3 (not divisible by 7)

36 = 729 ≡ 1 (mod 7) because 729 ÷ 7 = 104 remainder 1

This follows from Euler's Theorem since φ(7) = 6

Fermat's Little Theorem Calculator

Enter values to verify Fermat's Little Theorem

Euler's Theorem

aφ(n) ≡ 1 (mod n)

Works for any n > 1 where gcd(a, n) = 1

More general

Fermat's Little Theorem

ap-1 ≡ 1 (mod p)

Works only when p is prime

Special case of Euler's Theorem

Applications of Euler's Theorem

Euler's Theorem has numerous practical applications, particularly in cryptography and computer science.

🔐

RSA Cryptography

RSA encryption relies on Euler's Theorem for its security. The theorem ensures that encryption and decryption are inverse operations.

Key insight: If ed ≡ 1 (mod φ(n)), then (me)d ≡ m (mod n) for any message m coprime to n.

This property allows secure communication by making it computationally difficult to factor n.

🔢

Modular Exponentiation

Euler's Theorem allows efficient computation of large exponents modulo n.

Example: To compute 7100 mod 15, note that φ(15) = 8, so 78 ≡ 1 (mod 15).

Then 7100 = 78×12 + 4 = (78)12 × 74 ≡ 112 × 74 ≡ 2401 ≡ 1 (mod 15)

🧪

Primality Testing

Fermat's Little Theorem (a special case) is used in probabilistic primality tests.

Fermat Test: If an-1 ≢ 1 (mod n) for some a coprime to n, then n is composite.

While not foolproof (Carmichael numbers can pass the test), it's efficient for large numbers.

🎲

Random Number Generation

Euler's Theorem underpins certain pseudorandom number generators.

Linear Congruential Generators use modular arithmetic properties derived from Euler's Theorem.

The period of such generators relates to φ(m) where m is the modulus.

RSA Encryption Example

Problem: Demonstrate the RSA encryption process using small numbers.

Step 1: Choose primes p = 3, q = 11, so n = p×q = 33

Step 2: Calculate φ(n) = (p-1)(q-1) = 2×10 = 20

Step 3: Choose e = 3 (coprime to 20)

Step 4: Find d such that e×d ≡ 1 (mod 20). d = 7 works since 3×7 = 21 ≡ 1 (mod 20)

Step 5: Public key: (e, n) = (3, 33), Private key: (d, n) = (7, 33)

Step 6: Encrypt message m = 4: c = me mod n = 43 mod 33 = 64 mod 33 = 31

Step 7: Decrypt ciphertext c = 31: m = cd mod n = 317 mod 33

Using Euler's Theorem: 3120 ≡ 1 (mod 33), so 317 = 3120×0 + 7 ≡ 317 mod 33

312 = 961 ≡ 4 (mod 33), 314 ≡ 42 = 16 (mod 33), 317 = 314×312×31 ≡ 16×4×31 = 1984 ≡ 4 (mod 33)

Result: Original message m = 4 is recovered after encryption and decryption.

Worked Examples

Example 1: Find the remainder when 7100 is divided by 15.

Solution:

1. Note that gcd(7, 15) = 1, so Euler's Theorem applies.

2. Calculate φ(15) = φ(3×5) = φ(3)φ(5) = 2×4 = 8.

3. By Euler's Theorem: 78 ≡ 1 (mod 15).

4. Express 100 in terms of 8: 100 = 8×12 + 4.

5. Then 7100 = 78×12 + 4 = (78)12 × 74 ≡ 112 × 74 ≡ 74 (mod 15).

6. Calculate 72 = 49 ≡ 4 (mod 15), so 74 ≡ 42 = 16 ≡ 1 (mod 15).

Answer: The remainder is 1.

Example 2: Find the last two digits of 32024.

Solution:

Finding the last two digits means finding 32024 mod 100.

1. Note that gcd(3, 100) = 1, so Euler's Theorem applies.

2. Calculate φ(100) = φ(22×52) = 100×(1-1/2)×(1-1/5) = 100×1/2×4/5 = 40.

3. By Euler's Theorem: 340 ≡ 1 (mod 100).

4. Express 2024 in terms of 40: 2024 = 40×50 + 24.

5. Then 32024 = 340×50 + 24 = (340)50 × 324 ≡ 150 × 324 ≡ 324 (mod 100).

6. Calculate step by step:

32 = 9

34 = 81

38 = 812 = 6561 ≡ 61 (mod 100)

316 = 612 = 3721 ≡ 21 (mod 100)

324 = 316 × 38 ≡ 21 × 61 = 1281 ≡ 81 (mod 100)

Answer: The last two digits are 81.

Example 3: Solve the congruence 5x ≡ 3 (mod 17).

Solution:

We need to find the multiplicative inverse of 5 modulo 17.

1. Since 17 is prime, by Fermat's Little Theorem: 516 ≡ 1 (mod 17).

2. Then 515 is the inverse of 5 modulo 17 because 5 × 515 ≡ 516 ≡ 1 (mod 17).

3. We need to compute 515 mod 17 efficiently.

4. Use successive squaring:

52 = 25 ≡ 8 (mod 17)

54 ≡ 82 = 64 ≡ 13 (mod 17)

58 ≡ 132 = 169 ≡ 16 (mod 17)

515 = 58 × 54 × 52 × 5 ≡ 16 × 13 × 8 × 5

16 × 13 = 208 ≡ 4 (mod 17)

4 × 8 = 32 ≡ 15 (mod 17)

15 × 5 = 75 ≡ 7 (mod 17)

5. So the inverse of 5 modulo 17 is 7.

6. Multiply both sides of the congruence by 7: x ≡ 3 × 7 ≡ 21 ≡ 4 (mod 17)

Answer: x ≡ 4 (mod 17)

Interactive Practice

Euler's Theorem Practice Tool

Practice various aspects of Euler's Theorem with randomly generated problems or create your own.

Select a topic and click "Generate Problem"

Challenge: Find the remainder when 21000 is divided by 25.

Solution:

1. We need to find 21000 mod 25.

2. gcd(2, 25) = 1, so Euler's Theorem applies.

3. φ(25) = φ(52) = 25 - 5 = 20.

4. By Euler's Theorem: 220 ≡ 1 (mod 25).

5. 1000 = 20×50, so 21000 = (220)50 ≡ 150 ≡ 1 (mod 25).

Answer: The remainder is 1.

Challenge: Find the last three digits of 71234.

Solution:

Finding the last three digits means finding 71234 mod 1000.

1. gcd(7, 1000) = 1, so Euler's Theorem applies.

2. φ(1000) = φ(23×53) = 1000×(1-1/2)×(1-1/5) = 1000×1/2×4/5 = 400.

3. By Euler's Theorem: 7400 ≡ 1 (mod 1000).

4. 1234 = 400×3 + 34, so 71234 = (7400)3 × 734 ≡ 13 × 734 ≡ 734 (mod 1000).

5. Calculate 734 mod 1000 using successive squaring:

72 = 49

74 = 492 = 2401 ≡ 401 (mod 1000)

78 ≡ 4012 = 160801 ≡ 801 (mod 1000)

716 ≡ 8012 = 641601 ≡ 601 (mod 1000)

732 ≡ 6012 = 361201 ≡ 201 (mod 1000)

734 = 732 × 72 ≡ 201 × 49 = 9849 ≡ 849 (mod 1000)

Answer: The last three digits are 849.

Euler's Theorem Summary & Cheat Sheet

Concept Formula/Statement Key Points Example
Euler's Theorem aφ(n) ≡ 1 (mod n) Requires gcd(a, n) = 1, n > 1 34 ≡ 1 (mod 8)
Euler's Totient Function φ(n) = n × ∏(1 - 1/p) Counts numbers coprime to n φ(12) = 4
Fermat's Little Theorem ap-1 ≡ 1 (mod p) Special case when p is prime 36 ≡ 1 (mod 7)
Modular Inverses aφ(n)-1 ≡ a-1 (mod n) Using Euler's Theorem 515 ≡ 7 (mod 17)
RSA Encryption med ≡ m (mod n) Based on Euler's Theorem 43×7 ≡ 4 (mod 33)
Modular Exponentiation ak ≡ ak mod φ(n) (mod n) Efficient computation 7100 ≡ 74 (mod 15)
Common Mistakes to Avoid

Mistake: Applying Euler's Theorem without checking gcd(a, n) = 1

Wrong: Trying to use Euler's Theorem when a and n share factors

Correct: Always verify gcd(a, n) = 1 before applying the theorem

Mistake: Confusing Euler's Theorem with Fermat's Little Theorem

Wrong: Using an-1 ≡ 1 (mod n) for composite n

Correct: Fermat's Little Theorem only works for prime modulus

Mistake: Incorrectly calculating φ(n)

Wrong: φ(mn) = φ(m)φ(n) without checking gcd(m, n) = 1

Correct: φ(mn) = φ(m)φ(n) only when gcd(m, n) = 1

Mistake: Misapplying the exponent reduction

Wrong: ak ≡ ak mod n (mod n)

Correct: ak ≡ ak mod φ(n) (mod n) when gcd(a, n) = 1

Pro Tips for Success
  • Always check gcd(a, n): Euler's Theorem only applies when a and n are coprime
  • Master φ(n) calculation: Practice calculating Euler's totient function for various n
  • Use successive squaring: For large exponents, use the method of successive squaring
  • Understand the proof: Knowing why the theorem works helps with application
  • Practice with applications: Work through RSA examples to see the theorem in action