Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Greatest common divisor as a product of primes Clive Newstead, 18th March 2014 The Fundamental Theorem of Arithmetic (FTA) is all about products of primes: it tells you that every natural number greater than 1 has a representation as a product of primes, and moreover that expression is unique up to reordering. We can use this to find an expression of the greatest common divisor of two natural numbers by looking at their prime factorisation. Let a, b ∈ N and let p1 , p2 , . . . , pn be a list of prime numbers exhausting all the primes that appear in the factorisations of a and b. (Note that if a = 1 or b = 1 then there are no primes in their prime factorisations, but that’s okay because raising a natural number to the power 0 gives 1.) We can then write a = pα1 1 pα2 2 · · · pαnn b = pβ1 1 pβ2 2 · · · pβnn where αi , βi > 0 for all 1 6 i 6 n. (We need to allow them to be zero in case one of the primes appears in the factorisation of a but not b, for example.) For 1 6 i 6 n write δi = min{αi , βi }. Theorem. Given natural numbers a, b as above, gcd(a, b) = pδ11 pδ22 · · · pδnn That is, the gcd can be calculated by raising all the prime factors that appear in the factorisations of a and b to the smallest power that appears. Proof. Let G = gcd(a, b) and P = p1δ1 pδ22 · · · pδnn . We’ll prove P 6 G and G 6 P separately; together these will imply that P = G, and then we’ll be done. First we prove P 6 G. Since δi 6 αi and δi 6 βi , we can write αi = δi + ki and βi = δi + `i for some ki , `i > 0. Hence a = pα1 1 pα2 2 · · · pαnn = = = = (prime factorisation) p1δ1 +k1 pδ22 +k2 · · · pδnn +kn (pδ11 pk11 ) · (pδ22 pk22 ) · · · (pδnn pknn ) (pδ11 pδ22 · · · pδnn ) · (pk11 pk22 · · · pknn ) P · (pk11 pk22 · · · pknn ) (since αi = δi + ki ) (properties of indices) (re-ordering the factors) (definition of P ) Since pk11 pk22 · · · pknn ∈ Z, we can deduce that P | a. Similarly we have b = P · p`11 p`22 · · · p`nn and so P | b. Thus P is a common divisor of a and b. By definition of the gcd, P 6 G. 1 It remains to show G 6 P . We’ll do this by first showing that G | P . Since G, P ∈ N, the fact that G 6 P will follow from Proposition 1(iv) in the lecture notes. We can write G = pλ1 1 pλ2 2 · · · pλnn k, where λi > 0 for all 1 6 i 6 n and k ∈ N, such that none of the pi divide k. (That is, we’ve just taken the prime factorisation of G, and clustered together all the primes not amongst the pi s and called this number k.) We’ll prove: (1) k = 1. Then we’ll just have G = pλ1 1 pλ2 2 · · · pλnn . (2) λi 6 δi for all 1 6 i 6 n. Then we’ll have G | P (for the same reason as P | a above). We prove (1) and (2) by contradiction. For (1), suppose k 6= 1. Then k > 1, so it has a prime factor by FTA, say q. By definition of k, q 6= pi for any i, because we specified that none of the pi s divide k. But q | G, and we know that G | a since G = gcd(a, b), so by Proposition 1(i), q | a. By FTA, q appears in the prime factorisation of a, so q = pi for some i. But this contradicts our assumption that q 6= pi for any i. We conclude that k = 1. For (2), suppose λi > δi for some i. Without loss of generality, i = 1 (otherwise just re-label the prime factors). Since δ1 = min{α1 , β1 }, we must have δ1 = α1 or δ1 = β1 . Without loss of generality, suppose δ1 = α1 . (The case δ1 = β1 is identical.) Then λ1 > α1 . Now G | a, so there exists s ∈ N such that sG = a. Looking at the prime factorisations, we have: s · pλ1 1 pλ2 2 · · · pλnn = pα1 1 pα2 2 · · · pαnn Dividing by pα1 1 gives, using laws of indices, that s · p1λ1 −α1 pλ2 2 · · · pλnn = pα1 1 −α1 pα2 2 · · · pαnn which, noticing that pα1 1 −α1 = p01 = 1, can be rewritten as s · p1λ1 −α1 pλ2 2 · · · pλnn = pα2 2 · · · pαnn Since λ1 > α1 , we have λ1 − α1 > 0, so p1 divides the left-hand side of this equation. Hence p1 divides the right-hand side. But by FTA, if p1 divides the right-hand side then it would appear in the factorisation. . . so we have a contradiction! We conclude that λi 6 δi for all 1 6 i 6 n. As mentioned above, this implies that G | P , and hence G 6 P by Proposition 1(iv). Since G 6 P and P 6 G, we have P = G by antisymmtery of 6, and we’re done. 2