Fact-checked by Grok 2 weeks ago

Extended Euclidean algorithm

The Extended Euclidean algorithm is an efficient computational procedure in that extends the classical to not only determine the (GCD) of two integers a and b, denoted d = gcd(a, b), but also to find integers x and y such that a x + b y = d. This expresses d as a Bézout combination of a and b, proving , which states that such coefficients always exist for any pair of integers. The operates by iteratively applying the division algorithm, tracking quotients and while maintaining expressions for each as a of the original inputs. It begins with r0 = a = 1·a + 0·b and r1 = b = 0·a + 1·b, then computes subsequent ri = ri-2 - qi · ri-1, updating the coefficients accordingly until a of zero is reached, at which point the penultimate is the GCD and its coefficients provide the . The process runs in O(log min(a, b)) , making it highly practical for large integers. Originating as an enhancement to Euclid's algorithm from (circa 300 BCE), the extended version explicitly constructs the coefficients implied by the original method, with the theorem formalized as by in 1779, though the core idea predates him. Key applications include solving linear Diophantine equations a x + b y = c (feasible when d divides c), computing modular multiplicative inverses when gcd(a, m) = 1 (vital for systems like encryption), and facilitating primality testing and in . These uses underscore its foundational role in modern , , and algebraic structures like rings.

Fundamentals

Definition and Description

The extended Euclidean algorithm builds upon the classical Euclidean algorithm, originally described by the ancient Greek mathematician Euclid in the 3rd century BCE for computing the greatest common divisor (GCD) of two integers. Early extensions of this method to find integer coefficients expressing the GCD as a linear combination trace back to the Indian mathematician Aryabhata around 500 CE, who developed a procedure known as the "pulverizer" (kuttaka) for solving linear Diophantine equations. In the 18th century, French mathematician Étienne Bézout formalized the underlying identity in his 1779 work Théorie générale des équations algébriques, establishing it for both integers and polynomials, though the algorithmic back-substitution process predates this attribution. The algorithm's significance in modern computational number theory emerged in the 20th century, where it became essential for efficient implementations in areas like cryptography and algebraic computation. Formally, given two integers a and b with a > b \geq 0 and not both zero, the extended Euclidean algorithm computes d = \gcd(a, b) along with integers x and y satisfying : ax + by = d. This equation guarantees that the GCD can always be expressed as an integer of a and b, reflecting the generated by a and b in the . The algorithm proceeds at a high level by iteratively applying the division step of the —replacing (a, b) with (b, r) where r = a - q b for q, until the remainder is zero—while tracking coefficients through back-substitution to reconstruct the for the final non-zero , which is d. The Bézout coefficients x and y are not unique; if (x', y') is another pair satisfying the equation, then x' = x + k (b/d) and y' = y - k (a/d) for some k, making the solutions unique up to multiples of (b/d, -a/d). This modulo structure arises directly from the equation's homogeneity and the properties of the GCD.

Illustrative Example

To illustrate the extended Euclidean algorithm, consider the problem of computing \gcd(240, 46) and finding integers x and y such that $240x + 46y = \gcd(240, 46). This process follows , which guarantees the existence of such integers for any pair of integers. The algorithm proceeds in two phases: first, applying the to find the gcd via successive divisions, tracking quotients and remainders; second, back-substituting to express the gcd as a . The following table summarizes the forward phase, where each remainder r_i is computed as r_{i} = r_{i-2} - q_i r_{i-1}, with initial values r_0 = 240 and r_1 = 46.
Stepr_i (remainder)Quotient q_iExpression for r_i
0240-$240 = 1 \cdot 240 + 0 \cdot 46
146-$46 = 0 \cdot 240 + 1 \cdot 46
2105$10 = 240 - 5 \cdot 46
364$6 = 46 - 4 \cdot 10
441$4 = 10 - 1 \cdot 6
521$2 = 6 - 1 \cdot 4
602$0 = 4 - 2 \cdot 2
The process terminates when the remainder is 0, so \gcd(240, 46) = 2. In the back-substitution phase, express the gcd using the previous equations, starting from the penultimate step and substituting upward: \begin{align*} 2 &= 6 - 1 \cdot 4 \\ &= 6 - 1 \cdot (10 - 1 \cdot 6) \quad (\text{substitute } 4 = 10 - 1 \cdot 6) \\ &= 2 \cdot 6 - 1 \cdot 10 \\ &= 2 \cdot (46 - 4 \cdot 10) - 1 \cdot 10 \quad (\text{substitute } 6 = 46 - 4 \cdot 10) \\ &= 2 \cdot 46 - 9 \cdot 10 \\ &= 2 \cdot 46 - 9 \cdot (240 - 5 \cdot 46) \quad (\text{substitute } 10 = 240 - 5 \cdot 46) \\ &= -9 \cdot 240 + 47 \cdot 46. \end{align*} Thus, x = -9 and y = 47, satisfying $240(-9) + 46(47) = 2. To verify, compute $240 \times (-9) = -2160 and $46 \times 47 = 2162, so -2160 + 2162 = 2. This confirms the result. Common pitfalls include misidentifying the gcd when the remainder reaches zero—the gcd is always the last nonzero remainder—and overlooking that coefficients like x and y may be negative, which is valid under , though equivalent nonnegative pairs can be obtained by adding multiples of $46/2 = 23 to x and subtracting multiples of $240/2 = 120 from y.

Mathematical Proof

The correctness of the extended Euclidean algorithm, which computes integers x and y such that ax + by = \gcd(a, b) for nonnegative integers a \geq b \geq 0, can be established by on b, leveraging that \gcd(a, b) is the smallest positive of a and b. Base case: If b = 0, then \gcd(a, 0) = a, and the algorithm returns x = 1, y = 0, satisfying a \cdot 1 + 0 \cdot 0 = a. This holds since any integer divides zero, and the greatest of a and zero is a itself. Inductive step: Assume the algorithm is correct for all pairs with second argument less than b > 0; that is, for the recursive call on \gcd(b, r) where r = a \mod b = a - qb and q = \lfloor a/b \rfloor, it returns integers x' and y' such that b x' + r y' = \gcd(b, r) = d = \gcd(a, b). Substituting r = a - qb yields b x' + (a - qb) y' = d, or a y' + b (x' - q y') = d. Thus, setting x = y' and y = x' - q y' satisfies a x + b y = d, confirming the algorithm's output for the original pair. The algorithm terminates because the underlying does: each remainder strictly decreases (r < b) and remains nonnegative, eventually reaching zero after finitely many steps, at most O(\log b) iterations by properties of the Fibonacci sequence bounding the worst case. The solution (x, y) is not unique; all integer solutions to a x + b y = d are given by x = x_0 + k (b/d) and y = y_0 - k (a/d) for integer k, where (x_0, y_0) is any particular solution and d = \gcd(a, b), since adding multiples of b/d to x and subtracting multiples of a/d from y preserves the equation due to a (b/d) = b (a/d).

Algorithmic Implementation

Recursive Formulation

The recursive formulation of the extended Euclidean algorithm computes the greatest common divisor d = \gcd(a, b) of two integers a and b (assuming a \geq b \geq 0), along with the Bézout coefficients x and y satisfying the equation ax + by = d. This version naturally extends the recursive structure of the standard Euclidean algorithm by tracking the coefficients through back-substitution in the recursion. The function, typically denoted as extended_gcd(a, b), returns a tuple (d, x, y). In the base case, if b = 0, it returns (a, 1, 0), since \gcd(a, 0) = a and a \cdot 1 + 0 \cdot 0 = a. For the recursive case, the algorithm calls itself on the pair (b, a \mod b) to obtain (d, x_1, y_1) where d = \gcd(b, a \mod b) and b x_1 + (a \mod b) y_1 = d. It then computes the coefficients for the original pair as x = y_1 and y = x_1 - \left\lfloor \frac{a}{b} \right\rfloor y_1, before returning (d, x, y). This adjustment ensures the linear combination holds for a and b, mirroring the division step in the . The following pseudocode illustrates this structure:
function extended_gcd(a, b):
    if b == 0:
        return (a, 1, 0)
    else:
        (d, x1, y1) = extended_gcd(b, a % b)
        x = y1
        y = x1 - (a // b) * y1
        return (d, x, y)
The time complexity of this recursive formulation is O(\log \min(a, b)) arithmetic operations, matching that of the standard Euclidean algorithm, as the number of recursive calls equals the number of division steps until the base case is reached, and each call performs constant work beyond the recursion. The recursion depth is also O(\log \min(a, b)), since the arguments decrease rapidly. This recursive approach offers advantages in conceptual clarity, as its structure directly parallels the inductive proof of the 's correctness, making it particularly suitable for understanding and verifying the computation of Bézout coefficients through mathematical induction on the input size.

Iterative Pseudocode

The iterative formulation of the extended computes the greatest common divisor d = \gcd(a, b) along with Bézout coefficients x and y such that ax + by = d, using a loop to simulate the divisions and back-substitutions without recursion. This approach is particularly useful in programming environments where recursion depth limits could be exceeded for large inputs. The following language-agnostic pseudocode illustrates the core structure, initializing coefficients for the initial remainders and updating them in each iteration while shifting the values of a and b:
function extended_gcd(a, b):
    if b == 0:
        return a, 1, 0
    prevx, x = 1, 0
    prevy, y = 0, 1
    while b != 0:
        q = a // b
        a, b = b, a % b
        x, prevx = prevx - q * x, x
        y, prevy = prevy - q * y, y
    return a, prevx, prevy  // returns d, x, y where original_a * x + original_b * y = d
In this implementation, the variables track the coefficients for the current and previous remainders, ensuring the invariant holds after each update. An array-based variant builds sequences for the remainders r, coefficients s, and coefficients t iteratively, akin to constructing a table of values. Initialize r_0 = a, r_1 = b, s_0 = 1, s_1 = 0, t_0 = 0, t_1 = 1. Then, for each subsequent index i \geq 2, compute the quotient q_i = \lfloor r_{i-2} / r_{i-1} \rfloor, and update r_i = r_{i-2} - q_i r_{i-1}, s_i = s_{i-2} - q_i s_{i-1}, t_i = t_{i-2} - q_i t_{i-1}. Continue until r_i = 0; the GCD is the last non-zero remainder r_{i-1}, with corresponding s_{i-1} and t_{i-1}. This method explicitly stores all intermediate coefficients, facilitating verification or further computations. To handle edge cases, if a = 0 and b \neq 0, return d = |b|, x = 0, y = \operatorname{sign}(b); if b = 0, return d = |a|, x = \operatorname{sign}(a), y = 0. For negative inputs, apply the algorithm to |a| and |b| and adjust the signs of the coefficients based on the original signs to ensure a x + b y = d > 0. The iterative versions achieve the same time complexity as the underlying , O(\log \min(|a|, |b|)), due to the logarithmic number of divisions, while avoiding overhead and potential issues.

Generalizations

Polynomial Version

The extended Euclidean algorithm generalizes to univariate polynomials over a K, such as the rational numbers or real numbers, in the K. Given two polynomials f, g \in K, not both zero, the algorithm computes a monic d \in K and polynomials s, t \in K satisfying f s + g t = d. This adaptation relies on the fact that K forms a , where the degree function serves as the Euclidean norm, enabling division with remainder analogous to the integer case. The algorithm proceeds recursively, mirroring the structure for integers but using polynomial division. , assume \deg(f) \geq \deg(g). Divide f by g to obtain the q and r such that f = q g + r with \deg(r) < \deg(g). Recursively apply the algorithm to g and r, yielding polynomials s' and t' where g s' + r t' = d. Back-substituting the expression for r gives f s' + g (t' - q s') = d, so set s = s' and t = t' - q s'. The base cases occur when g = 0, in which d = f (normalized to be monic) with s = 1 and t = 0, or when g is a nonzero constant, in which d = 1 (the monic unit) and the coefficients are scaled accordingly by the leading coefficient of g. Normalization ensures d is monic by dividing by its leading coefficient throughout. For illustration, consider f(x) = x^2 + 1 and g(x) = x + 1 over the real numbers \mathbb{R}. Dividing f by g yields quotient x - 1 and constant remainder $2. The recursion on g and $2 produces the monic gcd d = 1, and back-substitution provides explicit s and t satisfying the identity, though the full computation involves scaling by the leading coefficient of the remainder. The computational complexity of this algorithm is O(\deg(f) \cdot \deg(g)) arithmetic operations in the field K, assuming standard polynomial division algorithms. With faster multiplication techniques, such as those based on fast Fourier transforms, the complexity can improve, but the basic version aligns with the quadratic scaling in degrees.

Extension to Multiple Arguments

The extended Euclidean algorithm can be generalized to compute the greatest common divisor d of n > 2 integers a_1, a_2, \dots, a_n and express d as an integer d = \sum_{i=1}^n x_i a_i, where the coefficients x_i are integers (not necessarily unique). This generalization relies on extended to multiple integers, which holds by : the base case for two integers is given by the standard extended Euclidean algorithm, and for additional integers, the result follows from expressing the GCD of the first n-1 as a linear combination and then incorporating the nth via another application of the algorithm. The method proceeds iteratively by pairwise application. Begin by applying the extended Euclidean algorithm to the first two integers a_1 and a_2 to obtain d_2 = \gcd(a_1, a_2) = x_1 a_1 + x_2 a_2. Then, compute d_3 = \gcd(d_2, a_3) = y_1 d_2 + y_3 a_3 using the extended Euclidean algorithm again, and substitute the expression for d_2 to yield d_3 = (y_1 x_1) a_1 + (y_1 x_2) a_2 + y_3 a_3. Continue this process sequentially for each subsequent a_i, updating the coefficients for prior terms by multiplication with the new intermediate coefficient and adding the new term's coefficient. This yields the full after n-1 applications. For example, consider the integers 48, 18, and 30. First, apply the to 48 and 18: \begin{align*} 48 &= 2 \cdot 18 + 12, \\ 18 &= 1 \cdot 12 + 6, \\ 12 &= 2 \cdot 6 + 0. \end{align*} Back-substituting gives \gcd(48, 18) = 6 = -1 \cdot 48 + 3 \cdot 18. Now incorporate 30 by computing \gcd(6, 30): \begin{align*} 30 &= 5 \cdot 6 + 0. \end{align*} Thus, $6 = 1 \cdot 6 + 0 \cdot 30. Substituting the prior expression yields $6 = -1 \cdot 48 + 3 \cdot 18 + 0 \cdot 30. The coefficients are updated accordingly, confirming d = 6. In this iterative approach, the coefficients x_i can grow rapidly—potentially exponentially in n—due to successive multiplications during , especially when intermediate quotients are large, although minimal coefficients satisfying the equation are bounded by the sum of the |a_i|. This growth makes the method less efficient for large n, as the bit length of coefficients may increase significantly. If only the GCD is needed without coefficients, an alternative is to use Stein's algorithm (also known as the ) iteratively in a pairwise fashion, which avoids divisions and uses bit shifts and subtractions for faster computation on large integers, though it does not directly provide Bézout coefficients.

Applications

Rational Number Simplification

To simplify a expressed as a \frac{p}{q} where p and q are integers and q \neq 0, the extended Euclidean algorithm (EEA) is applied to compute the d = \gcd(|p|, |q|). The simplified form is then \frac{p/d}{q/d}, with signs adjusted to ensure the denominator is positive (e.g., if q < 0, multiply numerator and denominator by -1). This process reduces the to its lowest terms by dividing both numerator and denominator by their common divisor d. The EEA is particularly efficient for this task because it computes the GCD in O(\log \min(|p|, |q|)) steps using repeated division, outperforming naive factorization methods for large integers. Although the EEA also outputs Bézout coefficients expressing d as an integer linear combination of |p| and |q|, these are incidental for simplification and not required. For example, consider the fraction \frac{240}{46}. Applying the EEA yields \gcd(240, 46) = 2, so the simplified form is \frac{240/2}{46/2} = \frac{120}{23}. Edge cases must be handled carefully: if q = 0, the fraction is undefined; if p = 0, it simplifies to \frac{0}{1}. The steps of the EEA on p and q directly mirror the continued fraction expansion of \frac{p}{q}, where the quotients from successive divisions form the continued fraction coefficients, terminating finitely for rationals. Historically, the EEA's precursor—the Euclidean algorithm for GCD—has been used since Euclid's Elements (Book VII, c. 300 BCE) in early arithmetic for handling exact fractions in rational computations.

Modular Multiplicative Inverses

In modular arithmetic, an integer a has a multiplicative inverse modulo m if and only if \gcd(a, m) = 1, meaning there exists an integer x such that a x \equiv 1 \pmod{m}. The extended Euclidean algorithm computes this inverse by finding integers x and y satisfying Bézout's identity a x + m y = 1, from which x \mod m (adjusted to a positive representative between 0 and m-1) serves as the inverse. To compute the inverse, apply the extended Euclidean algorithm to a and m:
  1. Perform the standard Euclidean algorithm to find \gcd(a, m); if it is not 1, no inverse exists.
  2. Use the extended version to back-substitute and express 1 as a linear combination a x + m y = 1.
  3. The coefficient x is the inverse, taken modulo m.
For example, to find the inverse of 5 17: \begin{align*} 17 &= 3 \cdot 5 + 2, \\ 5 &= 2 \cdot 2 + 1, \\ 2 &= 2 \cdot 1 + 0. \end{align*} Back-substituting: $1 = 5 - 2 \cdot 2, \quad 2 = 17 - 3 \cdot 5, $1 = 5 - 2 \cdot (17 - 3 \cdot 5) = 7 \cdot 5 - 2 \cdot 17. Thus, $5 \cdot 7 \equiv 1 \pmod{17}, so the inverse is 7. If \gcd(a, m) = d > 1, no multiplicative inverse exists for a modulo m when solving a x \equiv 1 \pmod{m}, as d does not divide 1; more generally, the linear a x \equiv b \pmod{m} is solvable if and only if d divides b. The extended Euclidean algorithm's efficiency in computing these inverses is crucial in , such as RSA decryption, where the exponent d is the modular inverse of the public exponent e modulo \phi(n), computed via the algorithm during . Similarly, in Diffie-Hellman variants like implicitly-certified public keys, inverses modulo p-1 are required to derive keys from shared parameters. Wilson's theorem connects to modular inverses by stating that for a prime p, (p-1)! \equiv -1 \pmod{p}, reflecting the structure of the modulo p where every non-zero element has a unique .

Inverses in Algebraic Extensions

In algebraic extensions of a K, such as simple extensions K[\alpha] where \alpha is a of an irreducible polynomial m(x) \in K, elements can be represented as polynomials in \alpha of degree less than the degree of m(x). The extended Euclidean algorithm applied to polynomials over K enables the computation of multiplicative s for elements that are coprime to m(x). To invert an element \beta \in K[\alpha], represent \beta as a polynomial \beta(x) \in K with \deg(\beta(x)) < \deg(m(x)). Apply the extended Euclidean algorithm to \beta(x) and m(x), which computes the and Bézout coefficients s(x), t(x) \in K such that s(x) \beta(x) + t(x) m(x) = \gcd(\beta(x), m(x)). Since m(x) is irreducible and \beta is invertible if \gcd(\beta(x), m(x)) = 1 (a constant in K), the coefficients yield s(x) \beta(x) \equiv 1 \pmod{m(x)}, so the inverse is s(\alpha) reduced m(x). This process leverages the division algorithm in K to generate the remainder sequence until the gcd is reached, then back-substitutes to express the gcd. For example, consider the quadratic extension \mathbb{Q}(\sqrt{2}), where \alpha = \sqrt{2} satisfies the minimal polynomial m(x) = x^2 - 2. To invert \beta = 1 + \sqrt{2}, represent it as \beta(x) = x + 1. Applying the extended Euclidean algorithm over \mathbb{Q}: \begin{align*} x^2 - 2 &= (x - 1)(x + 1) + (-1). \end{align*} The next step divides x + 1 by -1, yielding quotient -(x + 1) and remainder 0, so the GCD is -1 (a unit). Back-substituting: -1 = x^2 - 2 - (x - 1)(x + 1), $1 = -(x^2 - 2) + (x - 1)(x + 1). Thus, s(x) = x - 1, so the inverse is \sqrt{2} - 1. Verification: (1 + \sqrt{2})(\sqrt{2} - 1) = 2 - 1 = 1. This method generalizes to finite-degree extensions K(\alpha_1, \dots, \alpha_n), where inverses reduce to applications of the polynomial extended Euclidean algorithm in towers of simple extensions, provided the base field K supports exact arithmetic. In computer algebra systems like SageMath, this technique is implemented for efficient inversion in quadratic and higher-degree number fields, supporting symbolic computations in algebraic geometry and number theory. Analogs appear in elliptic curve cryptography, where inverses in finite field extensions (e.g., \mathbb{F}_{p^k}) are computed via the extended Euclidean algorithm for point arithmetic over composite fields. The approach requires coefficients in a K (e.g., \mathbb{Q} or \mathbb{F}_p) for exact division; it does not directly apply to composite extensions without primitive element decomposition or handling non-simple structures.

References

  1. [1]
    21-110: The extended Euclidean algorithm
    The extended Euclidean algorithm finds the greatest common divisor of two integers and writes it as a linear combination of those integers.
  2. [2]
    The Extended Euclidean Algorithm
    The Extended Euclidean Algorithm is an algorithm that constructs a linear combination of two numbers, and is an extension of the Euclidean algorithm.
  3. [3]
    Number Theory - Euclid's Algorithm
    Using the extended Euclidean algorithm we can find m , n such that d = m a + n b , thus we have a solution x = k m , y = k n . Suppose ...
  4. [4]
    [PDF] 1 The Extended Euclidean Algorithm
    The Extended Euclidean Algorithm finds x and y such that gcd(a, b) = ax + by, using a table to express the number as a linear combination.
  5. [5]
    [PDF] Introduction to Factorization and Primality Testing - Penn State
    The equation (2.1) is called Bézout's identity, and is in É. Bézout (1779), Théorie générale des équations algébriques, Paris, Ph.-D. Pierres. Euclid's ...
  6. [6]
    [PDF] Math 180A - Notes - UCI Mathematics
    Bézout's identity tells us how to find a solution whenever c = gcd(a, b). With the help of. Corollary 2.11, this is essentially all we need. Corollary 2.12 ...
  7. [7]
    [PDF] Example of Extended Euclidean Algorithm - CS@Cornell
    Example of Extended Euclidean. Algorithm. Recall that gcd(84,33) = gcd(33,18) = gcd(18,15) = gcd(15,3) = gcd(3,0) = 3. We work backwards to write 3 as a linear ...
  8. [8]
    [PDF] Public Key Cryptography: RSA and Lots of Number Theory
    – Asymmetry provides proof of origin: The secret key is ... =gcd(a,b). Page 19. Extended Euclidean Algorithm. ○ The idea in the proof leads to the Extended ...
  9. [9]
    [PDF] CSE 311: Foundations of Computing - Washington
    If a and b are positive integers, then there exist integers s and t such that gcd(a,b) = sa + tb. Proof is algorithmic: via the Extended Euclidean algorithm ...
  10. [10]
    [PDF] Lecture 08: Divisibility 1 Number Theory - MIT OpenCourseWare
    Mar 5, 2024 · This gives rise to the Extended Euclidean Algorithm, aka The Pulverizer. ... Attributed to Aryabhata, around .. . 500CE. Definition 5 (The ...
  11. [11]
    [PDF] Extended gcd algorithms - The University of Queensland
    Extended gcd calculation has a long history and plays an impor- tant role in computational number theory and linear algebra. Recent results have shown that ...
  12. [12]
    2.4 The Bezout Identity - Mathematics and Computer Science
    This question of the Bezout identity is implemented in Sage as xgcd(a,b) , because this is also known as the eXtended Euclidean algorithm .
  13. [13]
    3.4 Multiplicative Inverses
    🔗. The inverse of modulo a modulo m is its Bézout coefficient in the equality. gcd ( a , m ) = a s + m t · 🔗. The inverse is also unique (up to congruence), but ...
  14. [14]
    Extended Euclid Division Algorithm - GeeksforGeeks
    Jul 23, 2025 · Example 1: Find two integers a and b such that 240a + 46b = GCD(240, 46). Solution: First we use Euclid's algorithm to find the GCD( 240, 46);.
  15. [15]
    eea - Euclidean Algorithm - Caltech CMS
    We provide a proof-sketch of the correctness of the Euclidean Algorithm by induction. ... The base case can be seen by noting that gcd(x,0)=x. For the induction ...
  16. [16]
    [PDF] Numbers: GCD and Bezout's Identity1 - Dartmouth Computer Science
    Aug 28, 2021 · Bezout's identity says there exists x∗ and y∗ such that x∗a+y∗b = 1. Multiply by z to get the solution x = x∗z and y = y∗z. Before we ...
  17. [17]
    [PDF] The Extended Euclidean Algorithm Andreas Klappenecker August ...
    Aug 25, 2006 · The extended Euclidean algorithm finds integers (g, r, s) such that gcd(a, b) = g = ar + bs, using matrix formulation to track quotient ...
  18. [18]
    [PDF] Lecture 10 - People @EECS
    Proof: Correctness is proved by (strong) induction on y, the smaller of the two input numbers. For each y ≥ 0, let P(y) denote the proposition that the ...
  19. [19]
    [PDF] 6. Linear Diophantine equations - UCSD Math
    We have already seen that the general solution of this equation is (x − x0,y − y0)=(bk,−ak), so that the general solution of the equation ax + by = c is x = x0 ...
  20. [20]
    [PDF] Linear Diophantine Equations
    Apr 2, 2019 · A general linear Diophantine equation has the form a1x1 + ··· anxn = c. There are solutions if (a1,...an) | c. If there is a solution, it will ...
  21. [21]
    Extended Euclid Algorithm - UMBC CSEE
    The Extended Euclid algorithm can be used to find s and t. Finding s and t is especially useful when we want to compute multiplicative inverses.
  22. [22]
    [PDF] Notes 10 - People @EECS
    Since the extended gcd algorithm has exactly the same recursive structure as the vanilla version, its running time will be the same up to constant factors ( ...
  23. [23]
    [PDF] Euclidean algorithm
    May 25, 2010 · These notes give an alternative, recursive presentation of the Euclidean algorithm for calculating the GCD.
  24. [24]
    [PDF] Extended Euclidean Algorithm
    The Euclidean algorithm works by successively dividing one number (we assume for convenience they are both positive) into another and computing.
  25. [25]
    Extended Euclidean Algorithm
    Oct 12, 2025 · $$a \cdot x + b \cdot y = \gcd(a, b)$$. It's important to note that by Bézout's identity we can always find such a representation. For instance, ...Missing: history | Show results with:history
  26. [26]
    [PDF] Extended-Euclidean & Bézout Identity Recitation #9
    Nov 6, 2020 · Euclidean algorithm. Euclidean algorithm is a classic algorithm for computing the greatest common divisor (GCD) of two integers. ▫ Example ...
  27. [27]
    [PDF] 1 Factorization of Polynomials
    Nov 11, 2010 · The Extended Euclidean Algorithm (finding the polynomials s(x) and t(x)) is obtained anal- ogously to the case of the integers. • Def: Let R ...
  28. [28]
    [PDF] Extended Euclidean Algorithm - UC Davis Mathematics
    The following algorithm will compute the GCD of two polynomials f,g as well as linear combination sf + tg = GCD(f,g) (and more information). Important.
  29. [29]
    [PDF] Math 310.003 Polynomial Euclidean Algorithm Fall 2018 Division ...
    The Extended Euclidean Algorithm gives f(x)p(x) + g(x)a(x) = 1. Multiplying by b(x): p(x) | f(x)p(x)b(x) + g(x)a(x)b(x) = b(x).
  30. [30]
    [PDF] Lec6A Complexity of algorithms in F[x] - CECM, SFU
    Jan 27, 2021 · Let a, b Z, B be a constant, 0 < a < B", 0<b< Bm, n > m. In the tables EEA Extended Euclidean Algorithm. = O(n). O(nm).
  31. [31]
    [PDF] Elementary Number Theory - Bard Faculty
    May 4, 2013 · Bézout's Identity. Let a and b be nonzero integers, and let d = gcd ... The greatest common divisor can be defined for more than two integers at a ...
  32. [32]
    [PDF] Number Theory Course notes for MA 341, Spring 2018
    May 2, 2018 · Note that if a prime p divides two of the three numbers, then it divides ... the Extended Euclidean Algorithm to find y and z such that my + nz ...
  33. [33]
    Estimates for Bezout coefficients - MathOverflow
    Oct 2, 2012 · The Bezout's identity states that for any positive non-zero integers a1,…,an there exist integers x1,…,xn such that a1x1+⋯+anxn=gcd(a1,…,an).Missing: uniqueness | Show results with:uniqueness
  34. [34]
    Stein's Algorithm for finding GCD - GeeksforGeeks
    Feb 12, 2025 · Stein's algorithm or binary GCD algorithm is an algorithm that computes the greatest common divisor of two non-negative integers.
  35. [35]
    Euclidean Algorithm -- from Wolfram MathWorld
    The algorithm for rational numbers was given in Book VII of Euclid's Elements. The algorithm for reals appeared in Book X, making it the earliest example of an ...<|control11|><|separator|>
  36. [36]
    Euclidean Algorithm: GCD, Formula, Complexity, Uses - WsCube Tech
    Sep 24, 2024 · Simplifying Fractions: Helps in reducing fractions to their simplest form by dividing both the numerator and denominator by their GCD. ...
  37. [37]
    [PDF] Continued Fractions and the Euclidean Algorithm
    The process of finding the continued fraction expansion of a rational number is essentially identical to the process of applying the Euclidean algorithm to the ...
  38. [38]
    [PDF] This is a Chapter from the Handbook of Applied Cryptography, by A ...
    Inverses in Zn can be computed using the extended Euclidean algorithm as next described. ... Hellman [548] extended the Shannon theory approach to cryptography ...
  39. [39]
    None
    Summary of each segment:
  40. [40]
    None
    Summary of each segment:
  41. [41]
    Wilson's Theorem -- from Wolfram MathWorld
    This theorem was proposed by John Wilson and published by Waring (1770), although it was previously known to Leibniz. It was proved by Lagrange in 1773.Missing: authoritative source
  42. [42]
    [PDF] 29 Extension Fields - UCI Mathematics
    Let E be an extension field of F. An element α ∈ E is algebraic over F if it is a zero of some polynomial f ∈ F[x]. Otherwise, the element ...
  43. [43]
    [PDF] Lecture 3 1 Introduction 2 Polynomial Rings
    Sep 14, 2005 · Note that inverses can be found efficiently in Zp by using the Extended Euclidean Algorithm. Suppose h(x) ∈ F[x] is irreducible. Then K = F[x]/h ...
  44. [44]
    Elements optimized for quadratic number fields
    This module defines a Cython class NumberFieldElement_quadratic to speed up computations in quadratic extensions of Q.Missing: euclidean | Show results with:euclidean
  45. [45]
    [PDF] Guide to Elliptic Curve Cryptography
    Inverses can be efficiently computed by the extended. Euclidean algorithm for integers. The extended Euclidean algorithm for integers. Let a and b be integers ...