Week - 4
Lecture 16:
Modular Inverse
Modular Inverse in ()
Multiplicative Operation
-
Defied as:
-
( )
Multiplicative Inverse
Definition
- A element ( b ) is inverse of ( a ) if:
Key Condition
Only coprime elements have inverses
Why Inverse May Not Exist
Example: ( )
- Take ( a = 2 )
- o such ( b ) exists
- Because:
Theorem (Existence of Inverse)
Statement
Proof Idea
(⇒) If inverse exists:
So gcd = 1
(⇐) If gcd = 1:
So iverse exists
Special Case: () (p is Prime)
Set
Define:
Property
- For prime ( p ):
Every o-zero element has inverse
Result
-
( ) forms:
- Multiplicative group
- Cyclic group
Importat Isights
-
( ) under multiplication:
- ❌ not always a group
-
( ) (p prime):
- ✅ Group
- ✅ Every element is invertible
Key Takeaways
-
Modular inverse exists only for coprime elements
-
Prime modulus → guarantees inverses
-
( ):
- Finite
- Cyclic
- Used in cryptography
Final Conclusion
-
Modular inverse is core to:
- RSA
- Diffie-Hellman
- ECC
-
Prime fields ( ) are heavily used because:
- Every o-zero element is invertible
Lecture 17:
Extended Euclidean Algorithm
Extended Euclidean Algorithm (EEA)
Goal
- Find:
- Also compute modular inverse
Key Idea
If:
The:
So:
Step 1: Euclidean Algorithm (GCD)
Example
Find inverse of 41 mod 54
gcd = 1
Step 2: Back Substitution
Substitute:
Now substitute:
Result
So:
- ( x = -25 )
- ( y = 19 )
Modular Inverse
Final Answer:
General Algorithm (EEA)
Input: a, b
Output: gcd, x, y such that ax + by = gcd
r0 = a, r1 = b
x0 = 1, x1 = 0
y0 = 0, y1 = 1
while r1 != 0:
q = r0 // r1
r2 = r0 - q*r1
x2 = x0 - q*x1
y2 = y0 - q*y1
r0, r1 = r1, r2
x0, x1 = x1, x2
y0, y1 = y1, y2
return r0, x0, y0
Important Insight
- If gcd = 1 → inverse exists
- If gcd ≠ 1 → inverse does not exist
Key Takeaways
-
EEA gives:
- gcd
- coefficients ( x, y )
-
Used to compute:
- Modular inverse
-
Core for:
- RSA
- Cryptographic algorithms
Final Conclusion
- Extended Euclidean Algorithm is the standard method to compute modular inverses efficiently
- Essential tool in modern cryptography
Lecture 18:
Fermat's Little Theorem, Euler Phi Function
Fermat’s Little Theorem
Statement
Let ( p ) be a prime and ( a ) be an integer such that ( \gcd(a,p)=1 )
Key Idea
-
Work in:
-
Multiply all elements by ( a ):
- This is just a permutation of:
Proof Sketch
Multiply all elements:
Cancel ((p-1)!):
Euler’s Totient Function
Definition
Examples
- If ( p ) is prime:
Example
Euler’s Theorem (Generalization)
If:
Then:
Multiplicative Property of Totient
If:
Then:
Special Case (Prime Powers)
If:
Then:
Example (Fermat)
Let:
- ( a = 5 )
- ( p = 7 )
Key Takeaways
-
Fermat’s theorem:
- Special case of Euler’s theorem
-
Euler function:
- Counts coprime integers
-
Used in:
- Modular exponentiation
- RSA
Final Conclusion
-
For prime modulus:
-
For general modulus:
✔ Fundamental results in number theory and cryptography
Lecture 19:
Euler's theorem, Quadratic Residue
Euler’s Theorem
Statement
Let ( ) and ( )
Proof Idea
- Consider reduced residue system:
- Multiply each element by ( a ):
- Since ( \gcd(a,n)=1 ), multiplication is a permutation:
Multiply all elements
Cancel:
Quadratic Residue
Definition
An integer ( a ) is a quadratic residue mod p if:
Otherwise
- ( a ) is quadratic non-residue
Example (p = 11)
Squares mod 11:
So:
- Remaining → non-residues
✔ Both sets have equal size
Euler’s Criterion
Statement
Let ( p ) be prime and ( )
Proof Idea
Part 1 (⇒)
If:
Then:
(using Fermat)
Part 2 (⇐)
- ( ) is cyclic
- Let generator ( g )
Then:
- If ( i = 2k ) (even):
✔ So ( a ) is QR
Key Takeaways
-
Euler’s theorem → generalization of Fermat
-
Quadratic residues:
- Important in cryptography
-
Euler’s criterion:
- Efficient test for QR
Final Conclusion
-
Euler’s theorem:
-
Euler’s criterion:
✔ Core tools in number theory and cryptography
Lecture 20:
Polynomial Arithmetic
Polynomial Arithmetic (Cryptography Context)
Definition
A polynomial of degree ( n ):
- ( a_i ) → coefficients (from a ring/field)
- ( a_n \ne 0 )
Special Types
-
Monic Polynomial:
-
Constant Polynomial:
Polynomials over Finite Field
-
Work over:
-
Common case:
Example (Used in AES)
- Coefficients in ( )
- Irreducible polynomial
Polynomial Operations
Addition
- Done coefficient-wise
- In ( ): XOR
Subtraction
Multiplication
- Normal polynomial multiplication
- Reduce coefficients mod ( p )
Division
- ( )
Finite Field using Polynomials
Construction
-
Take:
-
Modulo irreducible polynomial ( ):
Resulting Set
Field Size
Galois Field (Finite Field)
- Denoted as:
-
Properties:
- Closed under + and ×
- Additive & multiplicative inverses
- Finite number of elements
Irreducible Polynomial
Definition
- Cannot be factored into lower-degree polynomials
✔ Required to construct field
Primitive Polynomial
Definition
- Irreducible polynomial
- Also generates entire multiplicative group
Key Property
- Every primitive polynomial is irreducible
- Not every irreducible polynomial is primitive
Connection to LFSR
-
LFSR feedback defined by polynomial
-
Primitive polynomial ⇒
- Maximum-length sequence
- Good pseudorandomness
Key Takeaways
-
Polynomial arithmetic used in:
- AES
- LFSR
-
Finite fields:
- Built using irreducible polynomials
-
Primitive polynomials:
- Important for sequence generation
Final Conclusion
- Cryptography uses:
-
Built using:
- Polynomial arithmetic
- Irreducible polynomials
✔ Foundation of modern symmetric cryptography (like AES)