Math Fundamentals18 sections · 814 units
Open in Course

Extended Euclidean Algorithm

Finding coefficients

The extended Euclidean algorithm finds integers x and y such that a × x + b × y = gcd(a, b). This is called Bezout identity.

Example: gcd(12, 18) = 6. You can write 6 = 12 × (-1) + 18 × 1. Here x = -1, y = 1.

This is useful for modular inverses and solving linear Diophantine equations. You will not see it often, but when you need it, you need it.