Skip to main content
Presentation 3 of 16

Modular Arithmetic, GCD and the Extended Euclidean Algorithm

The world of remainders: the computational foundation of modern cryptography

Slides: 25 PDF · 1000 KB
Loading slides…

Keyboard: Left arrow Right arrow Slides; F — fullscreen

Summary

“The heart of RSA”: the mathematics needed to read the formula c = m^e mod n — remainders and congruences, residue classes Z_n, properties of modular operations and fast exponentiation. Euclid's algorithm then finds the GCD, while the extended Euclidean algorithm and Bézout's identity give the modular inverse (d = e^(-1) mod φ(n)); the Chinese Remainder Theorem is introduced. All examples are checked by hand and in Python (gcd, extended_gcd, mod_inverse), and the pitfalls of the % operator with negative numbers are shown.

Key terms

modulli arifmetika taqqoslama chegirmalar sinflari oltin qoida tez darajaga ko'tarish EKUB Yevklid algoritmi kengaytirilgan Yevklid Bezu ayniyati teskari element Xitoy qoldiqlar teoremasi RSA-CRT

Lecture outline

  1. The problem: why cryptography computes with remainders
  2. Remainder, congruence and the clock analogy
  3. The set Z_n: residue classes and operation tables
  4. Properties of modular operations: the “golden rule” — reduce first, then compute
  5. Fast exponentiation: 5 operations instead of 13
  6. Euclid's algorithm: finding the GCD, complexity and Lamé's theorem
  7. Extended Euclid, Bézout's identity and the modular inverse
  8. Chinese Remainder Theorem (RSA-CRT)
  9. Python practice, negative numbers and the % operator, summary
Related lesson Math Foundations: Modular Arithmetic, GCD & Congruences