Extended Euclidean Algorithm
Wentang Method
New notes
- Fill in EA first
- then q, r
- then x, y, ax + by
ALWAYS CHECK that ax + by = gcd
Input: integers
Initialize: a table with 6 columns so that
- The columns are labeled
, , (which we will call , EA, , - The first row of the table is (1, 0, a, -, - (technically 0), - (technically
)) - The second row is (0, 1, b,
, , )
Repeat: For
, and (Although this should be done through the EA cell)
Stop: When
Output: Set
Note that this is better illustrated with examples
Find
Row | Explain |
EA | |||||
---|---|---|---|---|---|---|---|
Conclusion
We determine that
For
For row 2, observe: we plug in
For row 2, observe:
For row 3, observe:
For row 3, observe:
Textbook Method
Input: Integers
initialize: A table with four columns so that
- The columns are labelled
, , , and - The first row in the table is (
, , , ) - The second row in the table is (
, , , )
Repeat: For
Stop: when
Output: Set
Let
- Apply EEA to compute
and give a certificate of correctness for - Determine
and give a certificate of correctness for
1.
From the table constructed above, we determine that
2.
We have