170 likes | 402 Views
1. The Euclidean Algorithm 2. The Fundamental Theorem of Arithmetic's. Instructor: Hayk Melikyan melikyan@nccu.edu. Proof:. Example: (963, 657). So, (963, 657) = 9. Example: (450, 198)= ?. j r j r j+1 q j+1 r j+2 0 450 198 2 54
E N D
1. The Euclidean Algorithm 2. The Fundamental Theorem of Arithmetic's Instructor: Hayk Melikyan melikyan@nccu.edu
Example: (963, 657) So, (963, 657) = 9
Example: (450, 198)= ? j rj rj+1 qj+1 rj+2 0 450 198 2 54 1 198 54 3 36 2 54 36 1 18 3 36 18 2 0 450 = 2*198 + 54 198 = 3*54 + 36 54 = 1*36 + 18 36 = 2*18
As a Linear Combination 18 = 54 - 1*36 = 1*54 – 1*(198 – 3*54) = 4*54 -1*198 = 4*(450 – 2 *198) – 1*(198) = 4*450 + (-9)*178 So 18 = 450*x0 + 198*y0 Where x0 = 4 and y0 = -9
Extended Euclidean Algorithm In general to see how d = (a, b) may be expressed as a linear combination of a and b we traverse the EA backward. rn = (a, b) = rn-2 - rn-1 qn-1 If we substitutern-1 from the second ( bottom) equation, we will find that rn-1 = rn-3 - rn-2 qn-2 therefore (a, b) =( 1 – qn-1qn-2) rn-2 - qn-1 rn-3 If we continue working backward trough the steps of EA we will express (a, b) as a linear combination of a (r0) and b (r1)
If at some step we have (a, b) = srj + trj -1 Then, since rj = rj-2 - rj-1 qj-1 After substitution (a, b) = s(rj-2 - rj-1 qj-1 ) + trj -1 = (t – sqj-1)rj-1 + srj-2
Theorem 13*. Let a, b Z+. Then(a, b) = sna + tnb for some n Z+, where sn, tn are the nth terms of the sequence recursively defined bys0 = 1, t0 = 0, s1 = 0, t1 = 1and sj = sj-2 – qj-1sj-1, tj = tj-2 – qj-1tj-1for j = 2, 3, …, n where qjare the quotients in the DAwhen it is used for a and b
Example: gcd (450, 198) sj = sj-2 – qj-1sj-1, tj = tj-2 – qj-1tj-1 j rj rj+1 qj+1 rj+2sjtj 0 450 198 2 54 10 1 198 54 3 36 01 2 54 36 1 18 1 -2 3 36 18 2 0 3 7 4-9