For any two integers a and b (with b≠0 ), it is possible to express their greatest common divisor (GCD) as a linear combination of a and b. Specifically, if d=GCD(a, b) then there exist unique integers x and y such that
d = ax + by
Where d is the greatest divisor of a and b i.e. d= GCD(a, b)
Step 1: Euclidean Algorithm Setup.
First, write the Euclidean Algorithm as a series of steps finding remainders:
- a = bq1 + r1 (where r1 is the remainder when a is divided by b.)
- b = r1 q2 + r2
- r1 = r2 q3 + r3
- Continue until rn − 1 = rnqn + 1 + 0
Here, GCD(a ,b) = rn, the last non-zero remainder.
Step 2: Expressing the GCD as a Linear Combination.
This critical step where we will express each remainder ri as a linear combination of a and b.
- Starting with the final remainder equation that equals the GCD.
- rn = rn − 2 − rn − 1 qn
Here, qn is the quotient from the previous division.
We will continue this process backtracking through all previous equations, substituting for each each ri until we can express rn (which is GCD(a, b)) purely in terms of a and b.
For example, if we had the sequence:
- rn − 1 = rn − 3 − rn − 2qn − 1
Substituting this into the equation for rn:
- rn = (rn − 3 − rn − 2qn − 1) − rn − 1qn
Continue this process until all ri are expressed in terms of a and b.
Step 3: Recursive Construction of Coefficients.
To keep track of the coefficients x and y in the equation ax + by = GCD(a, b), we define:
- x0 = 1, y0 = 0 (for a)
- x1 = 0, y1 = 1 (for b)
For each step i, as we perform divisions, we also compute:
For each remainder equation:
The coefficients x and y for the new remainder can be calculated as follows:
From
- ri = ri − 2 − ri − 1qi:
- xi = xi − 2 − xi − 1qi
- yi = yi − 2 − yi − 1qi
This process allows for the recursive construction of the coefficients x and y for each step.
Step 4: Final Expression for GCD(a, b).
After back-substituting through the remainder equations, you will eventually reach a point where:
where rn = GCD(a, b). The integers x and y are the coefficients we sought.
This concludes the proof of the Extended Euclidean Algorithm, illustrating how to find x and y such that ax + by = GCD(a, b).
First we use Euclid's algorithm to find the GCD( 240, 46);
240 = 46 × 5 + 1 0 .... (i)
46 = 10 × 4 + 6 .... (ii)
10 = 6 × 1 + 4 .... (iii)
6 = 4 × 1 + 2 .... (iv)
4 = 2 × 2 + 0 .... (v)
So GCD( 240, 46) is 2
Now we rewrite the remainder equation to express the GCD as a combination of 240 and 46.
from eq (iv) we get
2 = 6 - 4 × 1
From eq(iii) we get , ( 4 = 10 - 6) substituting this value in the above equation
2 = 6 - ( 10 -6) × 1
2 = 6 × 2 - 10
From eq(ii) we get, ( 6 = 46 -10 × 4) substituting this value in the above equation
2 = (46 − 10 × 4 ) × 2 − 10 = 46 × 2 − 10 × 9
2 = 46 × 2 − 10 × 9
From eq(i) we get, ( 10 = 240 − 46 × 5) substituting this value in the above equation
2 = 46 × 2 − ( 240 − 46 × 5 ) × 9 = 46 × 2 − ( 240 × 9 − 46 × 45) = 46 × 47 - 240 × 9
2 = 46 × 47 - 240 × 9
So, x = − 9 and y = 47,
which satisfies the equation ax + by = GCD ( a, b )
240( − 9) + 46(47) = 2
First we use Euclid's algorithm to find the GCD( 81, 57);
81 = 57 × 1 + 24 .... (i)
57 = 24 × 2 + 9 .... (ii)
24 = 9 × 2 + 6 .... (iii)
9 = 6 × 1 + 3 .... (iv)
6 = 3 × 2 + 0 .... (v)
So GCD( 240, 46) is 3
Now we rewrite the remainder equation to express the GCD as a combination of 81 and 57.
from eq (iv) ( 9 = 6 × 1 + 3 ) we get
3 = 9 - 6 × 1
From eq(iii) we get , ( 6 = 24 - 9 × 2) substituting this value in the above equation
3 = 9 - ( 24 - 9 × 2 ) × 1
3 = 9 × 3 - 24
From eq(ii) we get, ( 9 = 57 -24 × 2) substituting this value in the above equation
3 = (57 -24 × 2) × 3 - 24
3 = 57 × 3 − 24 × 7
From eq(i) we get, ( 24 = 81 - 57 × 1) substituting this value in the above equation
3 = 57 × 3 − (81 - 57 ) × 7 = 57 × 10 − 81 × 7
3 = 57 × 10 + 81 × (-7)
Comparing it with 81x + 57y = 3 we get
So, x = -7 and y = 10,
which satisfies the equation
240( − 9) + 46(47) = 2
ax + by = GCD ( a, b )