Extended Euclidean Algorithm

Context: FIT1058_MOC · the Euclidean Algorithm plus bookkeeping triples · returns with · the engine for modular inverses

Quick Revision

  • 🎯 Objective: run Euclid while tracking each value as ➔ output and the Bézout .
  • 📦 Core Components: seed triples ➔ vector update ➔ invariant .
  • ⚡ Key Constraint: the engine for modular inverses; extra cost is only bookkeeping.

📝 Core

1. The Algorithm (Triples)

2. The Update

  • Quotient.
  • Vector step ➔ new ; old -triple becomes new -triple.
  • Stop ⟹ output the -triple.

3. Invariant & Check

  • Invariant ➔ every triple keeps , .
  • Answer ➔ final -triple gives .
  • Self-check ➔ final -triple gives ; failure flags an arithmetic slip.

Key identities:

When It Flips: the coefficients are exactly what Coprimality needs () and what yields [[Modular Inverse| in ]] (from , inverse is ) — central to RSA-style key setup.

📊 Exam Execution Trace

Manual Execution Trace

EEA on :

Step / State
0 (Init)
13
21
32
42

⚠️ Common Mistakes

  • 💡 Invariant ➔ true for seeds and preserved by the update; the final -triple’s is a free consistency check.

🧠 Active Recall