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)
- Purpose ➔ run the Euclidean Algorithm tracking each value as an Integer Linear Combination of .
- Output ➔ and integers with .
- Seeds ➔ , .
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) | — | ||
| 1 | 3 | ||
| 2 | 1 | ||
| 3 | 2 | ||
| 4 | 2 |
⚠️ Common Mistakes
- 💡 Invariant ➔ true for seeds and preserved by the update; the final -triple’s is a free consistency check.
🧠 Active Recall
What invariant do the EEA triples maintain, and how does it give both the answer and a check?
- Hint: preserved.
Answer
- Short answer: Each triple keeps ; final -triple gives , final -triple gives .
- Why: Preserved by update ➔ true for seeds, and the vector step maintains it.
How does EEA produce a modular inverse, and how much extra work over plain Euclid?
- Hint: Bézout gives the inverse.
Answer
- Short answer: On with it returns , so ; gcd steps are identical.
- Why: Only accounting ➔ overhead is updating coefficient pairs, not extra divisions.