Divisibility Def: a divides b (denoted a b) if there exists an integer x such that b ax. If a divides b we say that a is a divisor of b. Thm: (Properties of Divisibility) 1 a b a bc 2 a b and b c a c 3 a b and a c x, y(a (bx + cy)) 4 a b and b a a ±c 5 a b, a > 0, b > 0 a b 6 m 0 (a b ma mb) 7 a b 1,..., a b n and u i Z a (u 1 b 1 + + u n b n ) Robert Campbell (UMBC) 1. Number Theory February 16, 2008 1 / 17
Division Algorithm Thm: If a and b are integer with b > 0, then there exist unique integers q and r such that a qb + r and 0 r < b. proof: Existence: Consider {..., a 2b, a b, a, a + b, a + 2b,...} Of these, only consider the positive elements. There is a smallest element, some a qb (define r a qb 0) r < b as otherwise r b 0 would be a smaller element of the set Uniqueness: Assume a qb + r q b + r so b(q q ) r r if q q then q q 1, so r r b but r r < b 0 b # So q q and r r Robert Campbell (UMBC) 1. Number Theory February 16, 2008 2 / 17
Greatest Common Divisor Def: The Greatest Common Divisor of two integers a and b, denoted gcd(a, b) is the largest positive integer g such that g a and g b. Thm: Two integers a and b have a gcd. proof: The set of common divisors of a and b is non-empty (1 is in the set) The set is bounded above by both a and b. Apply the well ordering principle for bounded subsets of Z. Robert Campbell (UMBC) 1. Number Theory February 16, 2008 3 / 17
Greatest Common Divisor - Generalized A more general definition - does not require an order relation and (potentially) applies in any ring. Def: The Greatest Common Divisor of two elements a and b, denoted gcd(a, b) is an element g such that: g a and g b if c a and c b then c g Thm: Any ring with a division algorithm has gcds. Def: An integral domain with a division algorithm is a EuclideanDomain. Def: An integral domain is a commutative ring without zero divisors. Robert Campbell (UMBC) 1. Number Theory February 16, 2008 4 / 17
Euclidean Algorithm Algorithm: Starting from r 0 a, r 1 b, if we define r k as the remainder when r k 2 is divided by r k 1, then the last non-zero value r i is equal to gcd(a, b). (aka Antenaresis, [Euclid, VII.1]). Lemma: a qb + r gcd(a, b) gcd(r, b) proof: Let g gcd(a, b) (g a) and (g b) a ng and b mg for some n and m So if a qb + r then r a qb, so r ng qmg g(n qm) So (g r) and hence (g gcd(r, b)), i.e. (gcd(a, b) gcd(r, b)) Similarly, we can show that (gcd(r, b) gcd(a, b)) Thus gcd(a, b) ± gcd(r, b) As both are positive, we have gcd(a, b) gcd(r, b) Lemma: gcd(a, 0) a Robert Campbell (UMBC) 1. Number Theory February 16, 2008 5 / 17
Euclidean Algorithm Algor: Starting from r 0 a, r 1 b, if we define r k as the remainder when r k 2 is divided by r k 1, then the last non-zero value r i is equal to gcd(a, b). (aka Antenaresis, Euclid s Elements, Book VII, Proposition 1). Example: a 1431, b 141 r 0 1431 r 1 141 1431/141 10 with remainder r 2 21 141/21 6 with remainder r 3 15 21/15 1 with remainder r 4 6 15/6 2 with remainder r 5 3 6/3 2 with remainder r 6 0 So gcd(1431, 141) 3 Robert Campbell (UMBC) 1. Number Theory February 16, 2008 7 / 17
Euclidean Algorithm: Matrix Formulation ( ) 1431 141 1 10 1431 0 1 141 1 0 21 6 1 141 1 1 21 0 1 15 1 0 6 2 1 15 1 2 6 0 1 3 ( ) 21 141 ( ) 21 15 ( ) 6 15 ( ) 6 3 ( ) 0 3 So gcd(1431, 141) 3 Robert Campbell (UMBC) 1. Number Theory February 16, 2008 8 / 17
Bézout s Identity Thm: There exist integers x and y such that gcd(a, b) ax + by proof: Consider the set {ax + by x, y Z} Choose x 0, y 0 so that ax 0 + by 0 is the least positive element Call this element l ax 0 + by 0 We now prove that l a and l b Assume the converse - wlog that l does not divide a So q, r, 0 < r < l such that r a lq a q(ax 0 + by 0 ) a(1 qx 0 ) + b( y 0 ) So r is a positive element of the set which is smaller than l (contradiction) Thus l a Similarly, we conclude that l b So l gcd(a, b) But gcd(a, b) (ax 0 + by 0 ) l, so l gcd(a, b) Robert Campbell (UMBC) 1. Number Theory February 16, 2008 9 / 17
Extended Euclidean Algorithm 1431 141 (1, 0) (0, 1) 21 1431 + ( 10)141 141 (1, 10) (1, 0) + ( 1)(0, 1) (0, 1) 21 15 141 + ( 6)21 (1, 10) ( 6, 61) (0, 1) + ( 6)(1, 10) 6 21 + ( 1)15 15 (7, 71) (1, 10) + ( 1)( 6, 61) ( 6, 61) 6 3 15 + ( 2)6 (7, 71) ( 20, 203) ( 6, 61) + ( 2)(7, 71) 0 6 + ( 2)3 3 (47, 477) (7, 71) + ( 2)( 20, 203) ( 20, 203) Robert Campbell (UMBC) 1. Number Theory February 16, 2008 10 / 17
Extended Euclidean Algorithm: Matrix Formulation 1 10 1431 1 0 0 1 141 0 1 1 0 21 1 10 6 1 141 0 1 1 1 21 1 10 0 1 15 6 61 1 0 6 7 71 2 1 15 6 61 1 2 6 7 71 0 1 3 20 203 So gcd(1431, 141) 3 ( 20)(1431) + (203)(141) ( ) 21 1 10 141 0 1 ( ) 21 1 10 15 6 61 ( ) 6 7 71 15 6 61 ( ) 6 7 71 3 20 203 ( ) 0 47 477 3 20 203 Robert Campbell (UMBC) 1. Number Theory February 16, 2008 11 / 17
Linear Diophantine Equations I Def: A Diophantine equation is a polynomial equation whose coefficients and solutions are integers. Examples: 6x + 15y 9 x 2 + 5y 3 3x 3 + 5y 2 + y 3 Def: A linear Diophantine equation is a linear polynomial equation whose coefficients and solutions are integers. Examples: 6x + 15y 9 12x + 21y + 7z 3 Robert Campbell (UMBC) 1. Number Theory February 16, 2008 12 / 17
Linear Diophantine Equations II 6x + 15y 5 Note that three divides both 6 and 15. Thus, for any integer values of x and y, three must divide 6x + 15y But three does not divide 5. Prop: ax + by c has no solutions if gcd(a, b) c Robert Campbell (UMBC) 1. Number Theory February 16, 2008 13 / 17
Linear Diophantine Equations III 6x + 15y 9 Has the same solutions as 2x + 5y 3 Prop: x, y satisfies ax + by c iff it satisfies gax + gby gc (where g 0) proof: ax + by c ax + by c 0 g(ax + by c) 0 (ga)x + (gb)y (gc) 0 (ga)x + (gb)y (gc) Robert Campbell (UMBC) 1. Number Theory February 16, 2008 14 / 17
Linear Diophantine Equations IV 2x + 5y 3 Note that gcd(2, 5) 1, which divides 3 Find coefficients {a, b} such that 2a + 5b 1: {a, b} { 2, 1} as 2( 2) + 5(1) 1 Multiply by 3 to get: 2( 6) + 5(3) 3 So {x, y} { 6, 3} is a solution We may freely add multiples of 2(5) + 5( 2) 0 to the solution. So {x, y} { 6, 3} + n{5, 2} is the set of all solutions. Robert Campbell (UMBC) 1. Number Theory February 16, 2008 15 / 17
Linear Diophantine Equations V Algorithm: Find all integer solutions for ax + by c 1 Replace ax + by c with a x + b y c, where g : gcd(a, b, c), a a/g, b b/g and c c/g 2 Let g : gcd(a, b ). Does g divide c? No: The equation has no solutions. Yes: The equation has solutions 1 Use the Extended Euclidean Algorithm to compute values x, y such that a x + b y g. 2 Compute x 0, y 0 : x(c /g), y(c /g). This is a solution of the equation. 3 All solutions of the equation have the form x 0 + n(b /g), y 0 n(a /g), where n Z. Robert Campbell (UMBC) 1. Number Theory February 16, 2008 16 / 17
Division, GCD & Other Rings Question: What other rings have division algorithms and Euclidean (like) algorithms? Z Q[x]: Yes Z[x]: No Q[x, y]: No Z[ 1] (Gaussian Integers): Yes Z[ 5]: No Robert Campbell (UMBC) 1. Number Theory February 16, 2008 17 / 17