4. GCD 1 The greatest common dvsor of two ntegers a and b (not both zero) s the largest nteger whch s a common factor of both a and b. We denote ths number by gcd(a, b), or smply (a, b) when there s no confuson about the ntent of the notaton. Example: (13320, 22140) =?
4. GCD 2 Soluton #1: The dvsors of 13320 are 1, 2, 3, 4, 5, 6, 8, 9, 10, 12, 15, 18, 20, 24, 30, 36, 37, 40, 45, 60, 72, 74, 90, 111, 120, 148, 180, 185, 222, 296, 333, 360, 370, 444, 555, 666, 740, 888, 1110, 1332, 1480, 1665, 2220, 2664, 3330, 4440, 6660, 13320; the dvsors of 22140 are 1, 2, 3, 4, 5, 6, 9, 10, 12, 15, 18, 20, 27, 30, 36, 41, 45, 54, 60, 82, 90, 108, 123, 135, 164, 180, 205, 246, 270, 369, 410, 492, 540, 615, 738, 820, 1107, 1230, 1476, 1845, 2214, 2460, 3690, 4428, 5535, 7380, 11070, 22140 The common dvsors are hghlghted; the largest number n both sets s 180.
4. GCD 3 Soluton #2: The prme factorzatons of these numbers are 13320 = 2 3 3 2 5 37 and 22140 = 2 2 3 3 5 41. The gcd can be nferred from these factorzatons to be 2 2 3 2 5 = 180. Proposton Suppose that the ntegers m and n have prme factorzatons d p and both numbers.) Then (m, n) = e p, respectvely, where the d s and e s are nonnegatve exponents (thereby allowng us to use the same set of prmes for mn(d p,e ). // Corollary Every common dvsor of m and n s a dvsor of (m, n). // Porsm Suppose that the ntegers m and n have prme factorzatons [m, n] = d p and max(d p,e ). // e p, respectvely, where the d s and e s are nonnegatve exponents. Then the least common multple of m and n s gven by the formula Corollary (m, n) [m, n] = mn. //
4. GCD 4 Soluton #3: Usng the dvson algorthm, we fnd that 22140 = 1 13320 + 8820. Ths relaton mples that any common dvsor of 13320 and 22140 and n partcular ther gcd must also be a dvsor of 8820. Sgnfcantly, t also mples that any common dvsor of 8820 and 13320 and n partcular ther gcd s a common dvsor of of 13320 and 22140. It follows that (8820, 13320) (13320, 22140) and (13320, 22140) (8820, 13320). So (13320, 22140) = (8820, 13320). Ths prncple can be codfed n the followng Proposton If m n are postve ntegers and ntegers q, r satsfy m = qn + r, 0 r < n, by the Dvson Algorthm, then (m,n) = (n,r). Proof Easy. // Applyng ths proposton allows us to say that (8820, 13320) = (4500, 8820), snce 4500 s the remander of the dvson of 13320 by
4. GCD 5 8820. We may therefore reduce the sze of the orgnal numbers we are dealng wthout havng yet computed the gcd. Contnung: (13320,22140) = (8820,13320) = (4500,8820) = (4320,4500) = (180,4320) =180 22140 = 1 13320 + 8820 13320 = 1 8820 + 4500 8820 = 1 4500 + 4320 4500 = 1 4320 +180 4320 = 24 180 Note that at each stage, the prevous dvsor becomes the new dvdend and the prevous remander becomes the new dvsor, the dvsons endng when the remander reaches 0. The fnal nonzero remander s the desred gcd. Ths process s called the Eucldean algorthm. (It appears n a slghtly dfferent form Eucld s Elements.) It can be much abbrevated by layng out the computatons n a smple array:
4. GCD 6 22140 13320 1 8820 1 4500 1 4320 1 180 24 The second column holds the nteger quotents ( q ) for the dvsons obtaned when we dvde a number n the frst column ( r ) nto the number above t ( r 1 ). The remander of the dvson ( r +1 ) becomes the subsequent number n the frst column, and so on: r 1 r r +1 Note how much less computaton s requred to fnd the gcd by the Eucldean algorthm than be the frst two methods we consdered! Indeed, the Eucldean algorthm has long been revered for ts remarable smplcty. 0 q
4. GCD 7 Theorem The gcd of the (postve) ntegers m and n s representable as an nteger lnear combnaton of m and n. That s, there exst ntegers x and y so that (m,n) = xm + yn. In fact, (m, n) s the smallest postve nteger lnear combnaton of m and n. Proof We need only prove the fnal statement snce the frst asserton follows from t drectly. Let S be the set of all postve ntegers of the form xm + yn. Clearly, S s non-empty (consder x = 1, y = 0, or x = 0, y = 1), so t has a least element. Call ths number g = x 0 m + y 0 n. Now g s dvsble by every common factor of m and n; n partcular, (m, n) g. So (m, n) g. On the other hand, dvdng m by g yelds a quotent and remander: m = qg + r, 0 r < g. Subttutng for g n ths equaton we obtan m = q(x 0 m+ y 0 n)+ r, or r = (1 qx 0 )m+( qy 0 )n. But ths means ether that r s n S and s smaller than g, whch s mpossble, or that r = 0. Therefore, g m. An entrely smlar argument shows that g n, too. So g s a common dvsor of m and n, whence g (m, n), mplyng that g (m, n). We can then conclude that g = (m, n). // It s possble to extend the Eucldean algorthm slghtly so as to compute the values of x and y for whch (m,n) = xm + yn: Fnd x and y so that (22140, 13320) = 22140x + 13320y.
4. GCD 8 Consder solutons to the equaton r = 22140x + 13320y r x y q 22140 1 0 13320 0 1 1 8820 1 1 1 4500 1 2 1 4320 2 3 1 180 3 5 24 0 We place the trval solutons x = 1, y = 0, and x = 0, y = 1 n the frst two rows of the array (recognzable as the 2 2 dentty matrx), then use the same arthmetc from the nteger dvson of each value of r by the subsequent value to determne the subsequent values of x and y as well (thn elementary row operatons): f the ( 1)st and th rows of the array are determned by equatons r 1 = 22140x 1 +13320y 1 r = 22140x +13320y and r +1 = r 1 q r, then the (+1)st row s
4. GCD 9 determned by subtractng q tmes the th equaton from the ( 1)st: x +1 = x 1 q x, y +1 = y 1 q y. When the array produces the gcd as the last nonzero remander, the row of the array contanng ths gcd also contans the approprate coeffcents that represent t as a lnear combnaton of 22140 and 13320: for nstance, from the above array, we see that 180 = 3 22140+ 5 13320. If the numbers a, b have gcd = 1, we see that they share no common factors besdes 1. Such are numbers are sad to be relatvely prme to each other. Eucld s Lemma If a bc but (a, b) = 1, then a c. Proof Snce (a, b) = 1, we can fnd ntegers x and y so that ax +by = 1. Multplyng through by c gves cax + cby = c, and snce both terms on the left are dvsble by a (the second term because a bc), t follows that a c. //