EUCLIDEAN ALGORITHM
and BEZOUT’S THEOREM
EUCLIDEAN ALGORITHM
Let a, b ∈ Z such that b > 0 .
1.If b|a, then gcd(a,b) = b.
2.If b!/a, then we do the following:
a = b(q1) + r1, 0 ≤ r1 < b
b = r1(q2) + r2, 0 ≤ r2 < r1
r1 = r2(q3) + r3, 0 ≤ r3 < r2
.
.
rn-2 = rn-1(qn) + rn, 0 ≤ rn < rn-1
rn-1 = rn(qn-1) + 0
Therefore, gcd(a,b) = rn
NOTE: a = dividend , b = divisor, q = quotient and r = remainder
Euclidean Example:
1. Find gcd(40, 25)
40 = 25 (1) + 15 ----- a = b(q1) + r1
25 = 15 (1) + 10 ----- b = r1 (q1) + r2
15 = 10 (1) + 5 ----- r1 = r2 (q2) + r3
10 = 5 (2) + 0 ----- r2 = r3(q3) + 0
gcd(40, 25) = 5
Bezout’s Theorem Example:
1. Find integers x and y.
a.) gcd (813, 526) = 813x + 526y
First find the gcd(813, 526) using Euclidean Algorithm
813 = 526 (1) + 287
526 = 287 (1) + 239
287 = 239 (1) + 48
239 = 48 (4) + 47
48 = 47(1) + 1
47 = 1 (47) + 0
gcd(813, 526) = 1
Since the gcd = 1
1 = 48 - 47 (1) = 48 + 47(-1) ; substitute the value of 47
= 48 + (239 - 48(4))(-1) ; = 48 +239(-1) + 48(4)
= 239(-1) + 48(5) ; substitute the value of 48
= 239(-1) + (287 - 239(1))(5)
= 239(-1) + 287(5) +239(-5)
= 287(5) +239(-6); substitute the value of 239
= 287(5) +(526 - 287(1))(-6)
= 287(5) + 526(-6) + 287(6)
= 526(-6) + 287(11); substitute the value of 287
= 526(-6) + (813 - 526(1)(11)
= 526(-6) + 813(11) + 526(-11)
1 = 813(11) + 526(-17)
Therefore, x = 11, y = -17
B. gcd(1124, 1026) = 1124x + 1026y
1124 = 1026(1) + 98
1026=98(10) + 46
98 = 46(2) + 6
46= 6(7) + 4
6= 4(1) + 2
4= 2(2) + 0
gcd= 2
2 = 6 + 4(-1)
2 = 6 + (46 - 6(7))(-1); 2 = 6(8) + 46(-1); 2 = 46(-1) + 6(8)
2 = 46(-1) + (98 - 46(2))(8) ; 2 = 98(8) + 46(-17)
2 = 98(8) + (1026 - 98(10))(-17) ; 2 = 1026(-17) + 98(178)
2 = 1026(-17) + (1124 - 1026(1))(178);
2 = 1124(178) + 1026(-195)x = 178 ; y = -195
Least Common Multiple
● If a and b are integers such that both a|m and b|m, then m is called a
common multiple of a and b. If m is smallest positive common multiple of a
and b, we call it the least common multiple of a and b , and denoted by
lcm(a,b)
Example:
Find the lcm(12, 18).
Linear Diophantine Equation
It is a equation in a form of ax + by = c in unknowns x and y and a, b, c ∈ Z.
THEOREM:
The linear Diophantine Equation has a solution if and only if gcd(a,b)|c. If x0 and
y0 are solutions, then all other solutions are given by
x = x0 + (b/d)t and y = y0 - (a/d)t
Example:
Find the solutions of linear Diophantine equation 106x + 82y = 124
gcd(106,82) = 2 and 2|124 = 62
X0 = -1054 d=2 a = 106
Y0 = 1364 b = 82
X = -1054 + (82/2)t ; X = -1054 + 41t X =-1054 + 41(25) = -29
Y= 1364 - (106/2)t; Y = 1364 - 53t Y = 1364 - 53(25) = 39
-1054 + 41t > 0 and 1364 - 53t > 0
41t > 1054 and -53t> -1364
t > 25.71 and t > 25.74; 25.71 < t < 25.74
t = 25