KEVOS
ArticlesServicesCase studiesAboutContact
ArticlesServicesCase studiesAboutContact
← ArticlesThe Extended Euclidean Algorithm and Bezout CoefficientsEngineering · Engineering MathematicsLesson 716/884← PrevNext →
ArticlePublished 7 Aug 20262 min readBy Kevin Joginextended Euclidean algorithmBezoutmodular inversecoefficient growth
On this page

Ask about this page

KEVOS AIThe Extended Euclidean Algorithm and Bezout Coefficients

KEVOS knowledge first · trusted web sources when needed

Euclidean Algorithms and Congruences

The Extended Euclidean Algorithm and Bezout Coefficients

Computing Bezout coefficients alongside the GCD, modular inversion as its principal application, and controlling coefficient growth.

Engineering / MathematicsEuclidean Algorithms and Congruences2 min readKV-MATH-0515

The extended algorithm returns not only the GCD but integers expressing it as a combination of the inputs. This is what makes modular inversion possible, and modular inversion is required everywhere from finite field arithmetic to elliptic curve group law.

Bezout's identity

gcd(a, b) = u a + v bThe extended algorithm computes u and v alongside the GCD.

The coefficients are obtained by carrying two auxiliary sequences through the same recurrence that drives the GCD, each updated with the quotient at every step.

Extended Euclidean algorithm

  1. InitialiseTwo coefficient pairs representing a and b in terms of themselves.
  2. DivideCompute quotient and remainder as in the classical algorithm.
  3. UpdateApply the same linear update to both coefficient sequences using the quotient.
  4. TerminateWhen the remainder is zero, the previous row holds the GCD and its coefficients.

Modular inversion

If a and N are coprime, the Bezout identity gives u a + v N = 1, so u is the inverse of a modulo N. If the GCD is not one, no inverse exists — and the GCD itself is a non-trivial factor of N, which several factoring methods exploit deliberately.

Key point

A failed inversion is not merely an error condition. In elliptic curve arithmetic modulo N it is the success condition — the whole point of the elliptic curve method is to provoke one.

Coefficient growth

The Bezout coefficients grow, bounded roughly by the ratio of the inputs to the GCD. For a bare GCD this is harmless, but when the extended algorithm runs inside a larger computation the growth compounds.

Cost

In Hermite normal form computation, the extended algorithm is called once per pivot and its coefficients multiply into the whole matrix. This is the principal source of coefficient explosion.

Variants

Half-extended

Computes only one of the two coefficients. Sufficient for modular inversion and cheaper, since one sequence can be dropped.

Binary extended

The Stein variant with coefficient tracking. Avoids division at the cost of more steps.

Normalised

Reduces the coefficient modulo the input at each step to keep it bounded. Essential when only the modular inverse is wanted.

Frequently Asked Questions

Do I need both Bezout coefficients?
For modular inversion, no — one suffices. Computing only what you need saves roughly half the auxiliary work.
What if the inverse does not exist?
The GCD is greater than one, and it is a proper factor of the modulus. Whether that is an error or a result depends entirely on the calling algorithm.

Source. Henri Cohen, A Course in Computational Algebraic Number Theory, Springer GTM 138 — 1.3.3. Structural reference unverified: the source file was not available during authoring; chapter and section numbers are taken from the published edition and have not been checked against a physical copy.

Related pages

  • The Hermite Normal Form Algorithm
  • The Polynomial Euclidean Algorithm over a Field
  • Lehmer's Accelerated GCD Computation
  • Chinese Remainder Theorem Algorithms

Continue learning

Lehmer's Accelerated GCD ComputationArticle · Engineering MathematicsNEXT LESSON →Chinese Remainder Theorem AlgorithmsArticle · Engineering MathematicsThe Euclidean Algorithm: Classical and Binary VariantsArticle · Engineering MathematicsContinued Fraction Expansion of Real NumbersArticle · Engineering Mathematics
KEVOS · Engineering, manufacturing and project improvement
ArticlesServicesCase studiesAboutContact
© 2026 KEVOS®