Download presentation
Presentation is loading. Please wait.
Published byJasmine Harvey Modified over 5 years ago
1
Miniconference on the Mathematics of Computation
MTH 210 Euclidean Algorithm Dr. Anthony Bonato Ryerson University
2
Greatest Common Divisors
m and n integers > 1 among all the divisors of m and n, the largest is called the greatest common divisor write gcd(m,n)
3
Examples gcd(12,14) gcd(105,385) divisors of 12: 1,2,3,4,6,12
105 = 3 x 5 x 7 385 = 5 x 7 x 11 gcd(105,385) = 5 x 7 = 35
4
Key Facts gcd(n,0) = n If a = bq + r, then gcd(a,b) = (b,r)
useful idea: to find gcd(a,b) simplifies to “smaller” case: gcd(b,r) call r the remainder
5
Euclidean Algorithm Goal: find gcd(a,b) Step 1: Express a = bq + r
Step 2: Find gcd(b,r). Step 3: Express b = sr + t. Step 4: Find gcd(r,t). … Keep going until remainder is zero.
6
Why it works uses Key Fact 2: If a = bq + r, then gcd(a,b) = (b,r)
the remainders are positive and keep getting smaller in each step eventually remainders go down to 0, then use Key Fact 1: gcd(r,0) = r.
7
Exercises
8
Linear Diophantine Equations
Miniconference on the Mathematics of Computation MTH 210 Linear Diophantine Equations Dr. Anthony Bonato Ryerson University
9
Equations with integer solutions
main question: If a, b, and c are integers, when does a solution exist and how can you find a solution to ax + by = c, where x and y are integers? these are linear Diophantine equations
10
and sometimes a solution does not even exist!
sometimes trial-and-error works, but this is not always very efficient. and sometimes a solution does not even exist! example: 2x + 4y = 5 has no solution (why?)
11
Key Fact: ax + by = c has a solution if and only if gcd(a, b) divides c.
12
x = x1 + tb/d, y = y1 – ta/d, where t is an integer.
How to solve ax + by = c? Calculate gcd(a,b) by using the Euclidean Algorithm. Does gcd(a,b) divide c? If NO, then there is no solution to the linear Diophantine equation. If YES then Solve ax + by = gcd(a,b) = d by working backwards through your steps in the Euclidean Algorithm. This gives a particular solution (x1,y1) The general solution is: x = x1 + tb/d, y = y1 – ta/d, where t is an integer.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.