Learn/Number Theory/Extended Euclidean Algorithm
Number Theory • Topic 11

Extended Euclidean Algorithm

The Extended Euclidean Algorithm not only finds the GCD but also expresses it as a linear combination of the two numbers. This is critical for finding modular inverses.

Bézout Coefficients

For any integers , there exist integers such that:

The Algorithm (Back-Substitution)

Run the standard Euclidean Algorithm, saving the equations. Then work backwards.
Example (Find x, y for 252x + 105y = 21)
Forward:
Backward: Start with the GCD equation (2): Substitute for 42 using equation (1): Solution: .

Table Method

A systematic way to track coefficients such that at every step.

Practice Problems

Exercise (Problem 1)
Find integers such that .
Exercise (Problem 2)
Express as a linear combination of 119 and 204.
Exercise (Problem 3)
Solve the Diophantine equation .