9 The Fundamental Theorem of Arithmetic Prime Factorization In Chapter 8 we looked for a general conjecture about the relation between τ(n) and n, and failed. Now we look for a pattern in the relation between prime numbers and composites. Finding such a pattern may illuminate our earlier problem. Composite numbers have divisors other than themselves and 1. Some of those divisors are primes, and some may be composite. The divisors of composite divisors also may be prime or composite. But it looks as if we've got to get to prime divisors sooner or later. This leads to the conjecture: CONJECTURE: Any composite number can be represented as a product in which all of the factors (multiplicands) are primes. Pick a composite number such as 300. One algorithm for finding the factorization is to begin with the smallest prime divisor (2) and use it as a factor. We get 300 = 2·150. We look at 150 and find its smallest prime divisor. This is 2 again, so we replace 150 with 2·75 and write 300 = 2·2·75. 75 is not prime. We find its smallest prime divisor (3), replace 75 with 3·25, giving 300 = 2·2·3·25. The smallest prime divisor of 25 is 5, so we get 300 = 2·2·3·5·5. Since 5 is prime, we are done. Another algorithm for finding the prime factorization of a number is called the "branching method."1 Select any two numbers whose product is the number to be factored. If the factors are not prime numbers, then continue factoring until all factors are prime. The branching that leads to the prime factorization of 300 (shown at right) gives 300 = 5·3·5·2·2. The convention is to write the primes in ascending order, so we should say 300 = 2·2·3·5·5. 300 15 5 20 3 5 Exercise. Write 57, 117, and 1728 as the products of primes. By either method, any composite number can be represented as the product of primes. This leads to the following proof. 1 Angel & Porter, A Survey of Mathematics with Applications, 4th Ed. (Reading, Mass.: Addison-Wesley, 1993), pp. 173-5 4 2 2 124 9 THE FUNDAMENTAL THEOREM OF ARITHMETIC Proof: Take any natural number n. If n is composite, it can be written as the product of two smaller natural numbers. If those two natural numbers are both prime, the conjecture is true. If either of the two is composite, it is in turn the product of smaller natural numbers. Continuing this process until we meet only primes, we eventually have n written as the product of primes. Many composite numbers can be factored in more than one way. For example, 12 = 2·6 = 3·4 = 1·12. But every number I've tried seemed to have only one prime factorization. Is that the case for all composite numbers? Suppose I decide to factor some huge number N. I opt to use the first algorithm, above, and, after much computer time, I get a list of n primes p1, p2, p3, … , and pn. I confirm that the pis really are all prime numbers. I multiply them all together and get the product p1p2p3…pn = N. Suppose someone else factors the same number N. She uses a different algorithm, running on a different kind of computer. She discovers a list of m prime divisors q1, q2, q3, … , and qm. Every one of her qis is prime, and their product q1q2q3…qm = N. Is it possible that n is not equal to m and/or that at least one of my ps is different from at least one of her qs? In how many ways can a composite number be written as the product of primes? Or is there a unique factorization of any composite number into primes? What happens if a number you're trying to factor is prime? How many divisors do you have to try before you can be sure that the number you're trying to factor is prime? There are some simple tests that permit quick recognition that a number is not prime. There is no need to test even numbers, because every even number is divisible by 2. Any number ending in a 5 or a 0 will be divisible by 5. We can see that a number like 5,106,843 is divisible by 3 by adding its digits (27) and then adding the digits in the result (9) until we get a single digit. If that digit is divisible by 3 (it is), the original number was divisible by 3. Other tests can be performed by converting the original number to a base other than 10. When the easy tests fail, we just have to try dividing the number by one prime after another. If we have tried all the primes smaller than some prime p, and if p2 > N (where N is the number we are trying to factor), then we can stop. N must be prime. (Don't just accept this claim. Satisfy yourself that it is true by figuring out why it must be so.) If N is a 100-digit number, p could be a 49- or 50-digit number. That means we'd have to try every prime less than some 49- or 50-digit number. How many primes would that N be? It has been proved that the number of primes less than N is approximately ln(N).2 We'd have to check about 1046 primes. If our computer could try a million primes a second, it would take about 3×1024 years (that's 3 followed by 24 zeroes, or 3 million 2 By ln(N) I mean the natural logarithm of N. THE FUNDAMENTAL THEOREM OF ARITHMETIC 125 billion billion years) to finish the test. Even if a 100-digit number is composite, it might take a very long time to find its prime factors. It is conceivable, until we can prove otherwise, that the prime factorization of some really big number using two different methods might yield two sets of prime factors that are not identical. The conjecture is that there is one and only one prime factorization of any composite number. The conjecture has been proved. It is a theorem. Specifically, it is the Fundamental Theorem of Arithmetic.3 THE FUNDAMENTAL THEOREM OF ARITHMETIC. If (1) p1, p2, p3, … , pn and q1, q2, q3, … , qm are primes (both groups written in order of increasing size) and if (2) p1p2p3…pn = q1q2q3…qm, then p1 = q1, p2 = q2, … , pn = qm and hence m = n. The Fundamental Theorem of Arithmetic Outline of the Proof It would be reasonable to prove first that p1 = q1. Now p1 is A mathematical demonstration [proof] is not a simple juxtaposition of syllogisms, a divisor of the product of all the ps (call it N) so it must be a it is syllogisms placed in a certain order, divisor of the product of all the qs (which is also N). If we knew and the order in which these elements are that this forces p1 to divide at least one of the qs, we could then placed is much more important than the reason like this: Since p1 divides one of the qs, and since the qs elements themselves. If I have the feeling, the intuition, so to speak, of this order, so are prime, so p1 must equal the q that it divides. q1 is the as to perceive at a glance the reasoning as smallest of the qs, so p1 ≥ q1. Identical reasoning about q1 shows a whole, I need no longer fear lest I forget that q1 ≥ p1. Thus p1 = q1. So, replacing q1 with p1 in one of the elements, for each of them will q1q2q3…qm, we get p1p2p3…pn = p1q2q3…qm. Dividing both take its allotted place in the array, and that without any effort of memory on my sides by p1 we get p2p3…pn = q2q3…qm. This new equation has part.4 one less prime on each side. The same kind of reasoning that proved p1 = q1 also shows that p2 = q2. Step by step we peel away the primes from each side, establishing that pk = qk for all values of k. Since every p pairs off with one q and vice versa, we see that m = n (the number of ps = the number of qs). The problem is that we don't know that whenever a prime divides the product of several natural numbers it must divide at least one of them. 3 4 The Fundamental Theorem of Arithmetic is also called the "unique factorization theorem." Henri Poincaré, in an address to the psychological society in Paris on the psychology of mathematicians, reprinted as an essay in Volume 4 of The World of Mathematics by J.R. Newman (New York: Simon and Schuster, 1956) pp. 2041-2050. 126 9 THE FUNDAMENTAL THEOREM OF ARITHMETIC Special Numbers Consider numbers (prime or composite) that do have the special property that, whenever they divide a product of two multiplicands, they divide at least one of the multiplicands. Stein calls them "special numbers."5 DEFINITION: A natural number greater than 1 is special if and only if, whenever it divides the product of two natural numbers, it divides at least one of them. Symbolically, x is special ≡ ((x|(a·b)) ⊃ (x|a ∨ x|b)). If all primes are special, the proof-strategy outlined above will work, because we would know "that this forces p1 to divide at least one of the qs." Before we try to prove that all primes are special, we should assure ourselves that at least some primes are special. CONJECTURE: 2 is special. PROOF: The conjecture is that whenever 2 divides a number a·b (i.e., when 2 | (a·b)), 2 must divide a or b or both. We use an indirect proof. Suppose that 2 divides a·b but that 2 does not divide either a or b. If 2 does not divide a or b then both a and b are odd. If they are odd, a can be written as 2d+1 for some whole number d, and b can be written as 2e+1 for some whole number e. Using these forms of a and b, the product a·b can be written: (2d+1)(2e+1) = 4de+2d+2e+1. Clearly, 4de+2d+2e is an even number. So 4de+2d+2e+1 (one more than an even number) must be odd. So a·b must be odd. But since 2 divides a·b, we have a contradiction (a·b is odd and a·b is not odd). Either a or b must be even. Either 2 must divide a or 2 must divide b. Therefore 2 is special. Try to prove that 3 and 5 are special. You might conjecture that any natural number is special. However, that conjecture is easily disproved by the fact that 6 divides 12 (= 3·4), but it divides neither 3 nor 4, so 6 is not special. That 6 (a composite number) is not special suggests the conjecture that no composite number is special. We can re-state this conjecture in the form of its contrapositive,6 as CONJECTURE: Every special number is prime. PROOF: We prove this conjecture by proving that no composite number is special. Let n be a composite number. Then n is the product of two smaller natural 5 6 Sherman K. Stein, Mathematics: the Man-Made Universe, 2nd Ed. (San Francisco: W.H. Freeman and Company, 1969). The contrapositive of ∀x(Cx ⊃ ~Sx) (no composite number is special) is ∀x(~~Sx ⊃ ~Cx). Getting rid of the double-negation and because ~Cx (x is not composite) is (for x > 1) equivalent to Px (x is prime), this is ∀x(Sx ⊃ Px) (every special number is prime). THE FUNDAMENTAL THEOREM OF ARITHMETIC 127 numbers, a and b, which are both greater than 1. Thus n divides the product of a and b, because every number divides itself. Because a and b are smaller than n, n cannot divide either a or b. Thus n is not special. Since the only thing we assumed about n was that it was composite, we have proved that no composite number can be special, from which it follows that every special number is prime. So, ∀x(Sx ⊃ Px) – every special number is prime. As you should remember, this does not establish the converse, that every prime is special. To prove the Fundamental Theorem of Arithmetic we need to prove that every prime is special. As we saw, if every prime is special, then factorization into primes is unique (in symbols, S ⊃ U, where S is the statement that all primes are special, and U is the statement that factorization into primes is unique). To prove S ⊃ U, we assumed something that we did not know. We said "If we knew that this forces p1 to divide at least one of the qs, …" and proved the Fundamental Theorem. That is a Conditional Proof step. We assume S and tried to prove U. If we succeed it follows that S ⊃ U. Look back to what led us to define "special numbers" and remind yourself that the issue then was the question "If a prime divides the product of several natural numbers, must it divide at least one of them?" We can prove the theorem: THEOREM 1: If a special number divides the product of several natural numbers, then it divides at least one of them. PROOF: We make the argument for the case in which a special number s divides the product of three natural numbers a, b, and c. We have to prove that s divides at least one of a, b, and c. Our assumed premise is that s is a special number which divides the product abc. Now bc (the product of two natural numbers) is a natural number. So abc is the product of two natural numbers – a and bc. Then s must divide either a or bc. If s divides a, we have shown that it divides at least one of a, b, and c. If s does not divide a, it must divide bc. If s divides bc, it must divide either b or c. So whenever (if) a special number divides a product of three natural numbers, it must divide at least one of them. Using mathematical induction, we could show that when a special number divides the product of any number of natural numbers, it divides at least one of them. Euclid's Algorithm A number that is a divisor of two integers a and b is called a common divisor of a and b. A pair of numbers may have several common divisors (every pair of integers not both equal to 0 has at least one common divisor, since 1 divides every integer). The greatest common divisor of two integers a and b – symbolized as (a, b) – is the largest integer that divides both a and b. 128 9 THE FUNDAMENTAL THEOREM OF ARITHMETIC (0, 0) does not exist, since there is no largest divisor of 0. By the definition of "divides" every number divides 0, as ∀x(x·0 = 0). LEMMA 1: For any natural number a, (a, 0) = a. PROOF: Every natural number d is a divisor of 0, since 0 = 0·d. Thus, the largest common divisor of a and 0 is simply the largest divisor of a, namely a itself. LEMMA 2: If p is prime and p does not divide a, then (p, a) = 1. PROOF: The only divisors of p are 1 and p. Since p does not divide a, it follows that the only common divisor of both p and a is 1. Thus 1 is the greatest common divisor of p and a. LEMMA 3: Let a and b be natural numbers (so a is not 0). When we divide a into b we obtain a quotient q and a remainder r, so b = qa+r.7 Then (b, a) = (a, r) (the greatest common divisor of b and a is the greatest common divisor of a and r). To see what this means, look at the example where a = 12 and b = 57. Since 12 "goes into" 57 four times with nine "left over," we have quotient q = 4 and remainder r = 9. That is, 57 = 4·12+9. Lemma 3 says that (57, 12) = (12, 9). Is that true? In general, since r is less than a, the computation of (a, r) will be easier than (b, a). We can prove more than just that the greatest common divisor of a and b is the same as the greatest common divisor of a and r. We'll prove that the list of all the common divisors of a and b is the same as the list of all common divisors of a and r. From this, Lemma 3 follows easily. PROOF: Let d be any natural number dividing both a and r. Since d divides a it must divide qa. Hence it must also divide the sum qa+r, which is b.8 Thus d divides b. So any common divisor of a and r is a common divisor of b and a. Now we have to prove the converse – that every common divisor of b and a is a common divisor of a and r. Let d be any natural number that divides both b and a. Then d divides qa, and hence also the difference b−qa,8 which is r. Thus d divides a and r. So any common divisor of b and a is a common divisor of a and r. We have shown that the list of common divisors of b and a is the same as the list of common divisors of a and r. In particular, the greatest common divisor of b and a must be the same as the greatest common divisor of a and r. So (b, a) = (a, r). One way to find the greatest common divisor of two large numbers is to list all the divisors of each number and find the largest number on both lists. Lemma 3 shows an 7 8 Either q or r (but not both) could be 0, and r < a. From the lemma before Theorem 1 in Chapter 8. THE FUNDAMENTAL THEOREM OF ARITHMETIC 129 easier way to calculate the greatest common divisor of two natural numbers. The method is called Euclid's algorithm. To find the greatest common divisor of the numbers 72 and 20 (i.e., (72, 20)), we first divide 72 by 20. We get 72 = 3·20+12. The remainder is 12. By Lemma 3, (72, 20) = (20, 12). Divide 12 into 20 and find the remainder. 20 = 1·12+8 (the remainder is 8), so by Lemma 3, (20, 12) = (12, 8). Divide 8 into 12. 12 = 1·8+4, so (12, 8) = (8, 4). Divide 4 into 8 and find the remainder. 8 = 2·4+0 (the remainder is 0). By Lemma 3, (8, 4) = (4, 0). But Lemma 1 asserts that (4, 0) = 4. Combining all the steps, we get (72, 20) = 4. We repeatedly divide and find remainders until we find a remainder of 0. At each step the remainder is smaller than the remainder from the previous step. Eventually we must obtain a remainder of 0. The remainder before 0 is the greatest common divisor. Exercise on Euclid's Algorithm 1. 2. Use Euclid's Algorithm to find the greatest common divisor of (a) 117 and 51. (b) of 252 and 147. (c) of 176 and 105. (d) of 600 and 398. (e) of 6447 and 5767. Find (433, 144), (164, 72), (91, 39), (6463, 5773), (1468823, 1456813). Last Steps in the Proof LEMMA 4: For any whole numbers a and b (not both 0) there are integers m and n such that (a, b) = ma+nb. PROOF: Lemma 4 is related to the potato-weighing questions discussed in Chapter 8. Lemma 4 says that a- and b-gram weights can weigh a number of grams as small as the greatest common divisor of a and b. We can use the Euclidean Algorithm to find the greatest common divisor of any pair of weights and answer questions we posed (but did not answer) in the discussion of weights and measures. In order to find m and n, we "unwind" the Euclidean Algorithm. An example should make this clearer. Say a = 945 and b = 219. We will find (a, b) by the Euclidean Algorithm and then find integers m and n such that (a, b) = ma+nb. The computations for finding (945, 219) appear on the left, below; the underline identifies the successive a and b in the relation b = qa+r at each stage. On the right are equations for the remainders at each stage; these equations will be used for finding m and n. Euclidean Algorithm 945 = 219 = 69 = 12 = 9= (4·219)+69 (3·69)+12 (5·12)+9 (1·9)+3 (3·3)+0 Equations for finding m and n 69 = 12 = 9= 3= (1·945)−(4·219) (1·219)−(3·69) (1·69)−(5·12) (1·12)−(1·9) 130 9 THE FUNDAMENTAL THEOREM OF ARITHMETIC Remember what we're trying to do. We want an equation like (a, b) = ma+nb, where a = 945, b = 219. The Euclidean Algorithm shows that (945, 219) is 3. We want to find m and n that satisfy the equation 3 = 945·m+219·n. We use the right column, starting at the bottom and working up (equivalent to finding a way to weigh a 3-gram potato with 945- and 219-gram weights). The bottom equation on the right (3 = (1·12)− (1·9)) expresses 3 in terms of 9's and 12's. We want to express it in terms of 945's and 219's. The next equation above it expresses 9 in terms of 69's and 12's (9 = (1·69)−(5·12)). Substituting that expression for 9 in 3 = (1·12)−(1·9), we get 3=(1·12)−(1·((1·69)−(5·12))) which can be re-written as 3 = (1·12)−(1·69)+(5·12), or 3 = (6·12)−(1·69), an equation for 3 in terms of 12's and 69's. To remove the 12, we use 12 = (1·219)−(3·69). We re-write 3 = (6·12)−(1·69) as 3 = 6·((1·219)−(3·69))−(1·69). Reduce it to 3 = (6·219)−(18·69)−(1·69), or 3 = (6·219)−(19·69). This expresses 3 in terms of 69's and 219's. To get rid of the 69's, we look at the top equation on the right column of our table, above, and find 69 = (1·945)−(4·219). Substituting for 69 in the equation 3 = (6·219)−(19·69), we get 3 = (6·219)−(19·((1·945)−(4·219)), simplified to 3 = (82·219)−(19·945). Thus, 3 = (82·219)+ ((−19)·945). We have found m = −19 and n = 82 that express (945, 219) in the form m·945+n·219. Since this technique can be applied to any (a, b), we have proved the lemma. THEOREM 2: Every prime is special. PROOF: Let a and b be natural numbers, and let p be a prime that divides their product ab. We wish to prove that p must divide at least one of a and b. To do this, we prove that if p does not divide a, it must divide b. If p does not divide a, we have, by Lemma 2, (p, a) = 1. Lemma 4 then promises that there are integers m and n such that 1 = mp+na. If we multiply both sides of this equation by b, we obtain b = mpb+nab. p divides mpb. Since p divides ab, it also divides nab. Hence, p divides the sum mpb+nab. That sum is just b. Therefore p divides b. So p is special. Since this proof made no assumptions about p except that it was prime, we have shown that every prime is special. THEOREM 3: If a prime p divides a product q1q2q3…qm it divides at least one of the qs. PROOF: Use mathematical induction. If there is only one q (so m = 1) then p divides it. Assume (as an AP) that the theorem is true for m = n, so whenever p divides a product N = q1q2q3…qn it divides at least one of the qs. Now look at the case when m = n+1 (the product contains one more multiplicand). q1q2q3…qnqn+1 is the product of two numbers, N and qn+1. By theorem 2, whenever a prime divides the product of two natural numbers, it divides one of them. So either p divides N or p divides qn+1. If p divides N, then (since N contains only n factors), the assumed THE FUNDAMENTAL THEOREM OF ARITHMETIC 131 premise states that p must divide at least one of them. If p does not divide N, then it must divide qn+1. So if the theorem is true for m = n, it must be true for m = n+1. Therefore the theorem is true for any m. THE FUNDAMENTAL THEOREM OF ARITHMETIC: Every composite natural number is the product of primes in exactly one way. PROOF: Suppose that two prime factorizations of some number N are p1, p2, … , pn and q1, q2, … , qm. Then N = p1p2…pn = q1q2…qm. Since p1 divides N, therefore p1 divides q1q2…qm. By theorem 3, p1 must divide at least one of the factors qk. But every qk is prime, so p1 = qk. Cancelling these factors from the equation p1p2…pn = q1q2…qm, it follows that p2 must divide at least one of the remaining factors qi, and hence must be equal to it. Cancelling these equal factors from the two sides of the equation, we continue the process with p3,…, pn. After all of the ps have been cancelled, the left side of the equation will be equal to 1. Since all the qs are prime, they are all greater than 1, so there can be no qs left on the right side of the equation. Hence every p will have been paired off with one q, so there must have been equal numbers of both (m = n). Euclid went on to show that if factorization into primes is unique, then every prime is special. You should recognize that we could symbolize this as U ⊃ S. Once we have proved U ⊃ S, we can put it together with the previously proved S ⊃ U to get S ≡ U. That is, the Fundamental Theorem of Arithmetic U is equivalent to the statement S ("every prime is special"). To prove U ⊃ S, we use Conditional Proof again. We assume (U) that factorization into primes is unique (i.e., that the Fundamental Theorem is true) and prove that every prime is special (S). Then we can say, "if the Fundamental Theorem is true then every prime is special" (U ⊃ S). CONJECTURE: If the Fundamental Theorem is true (factorization into primes is unique) then every prime is special. PROOF: Consider two natural numbers a and b and a prime p that divides the product a·b. We want to prove that p divides either a or b or both. Now, since p divides a·b, there must be a natural number q such that a·b = p·q (from the definition of "divides"). We can express q, a, and b as the products of primes, as: q = r1r2…rs, a = s1s2…sn, b = t1t2…tm It's possible that one or more of q, a, and b is/are prime. If that were so, then we'd have q = r1 or a = d1 or b = t1. Since a·b = p·q, so p·q = a·b, and we have p·r1r2…rs = s1s2…sn·t1t2…tm. On the assumption that factorization into primes is unique (this is the assumed premise for the Conditional Proof), the prime p must occur among the ss or among the ts. If p 132 9 THE FUNDAMENTAL THEOREM OF ARITHMETIC occurs among the ss, then p divides a. If p is among the ts, then p divides b. This shows that p is special. So the Fundamental Theorem of Arithmetic is equivalent to the statement "every prime is special." Exercise on the Fundamental Theorem of Arithmetic 1. 2. 3. 4. 5. Define in your own words "prime number" and "special number." Which is easier: showing that a number is prime or showing that it is special? Why? Is it easier to show that every special number is prime or that every prime number is special? Why? Is "prime" a synonym for "special" in ordinary arithmetic? List all the divisors of 23·54. How can one use the Fundamental Theorem in answering this question? Let a = 33·72 and b=3·5·73. Use the Fundamental Theorem to show that (a, b) = 3·72. Explain how you used the Fundamental Theorem of Arithmetic. Find (144, 96) in three ways. (a) List all the divisors of 96 and of 144 and find which is the greatest common divisor. (b) Use the Euclidean Algorithm. (c) Express 96 and 144 as the product of primes and use the Fundamental Theorem of Arithmetic. Find the largest number that divides both 25·7 and 26·5. The Fundamental Theorem and Irrational Numbers In Chapter 7 we proved that there is no rational number whose square is 2. The fundamental theorem allows us to prove that there are infinitely many irrational numbers. a Imagine a rational number b whose square is 2, where a and b are coprime. Two natural numbers whose greatest common divisor is 1 are said to be relatively prime or coprime. Let the number of primes in the prime factorization of a be m, and the a2 number of primes in the prime factorization of b be n.9 From b2 = 2, we get a2 = 2b2. Since a is the product of m primes, then a2 will be the product of 2·m primes.10 Similarly, b2 will be the product of 2·n primes. But then 2b2 will be the product of (2·n)+1 primes (Why?). So the number of primes in the prime factorization of a2 is even, and the number of primes in the prime factorization of 2b2 is odd. But a2 is equal to 2b2. If a2 = 2b2, then the same number has two different prime factorizations (one with an odd, one with an even number of primes). This is impossible, according 9 10 m and/or n could be 1 if one or both of a and b is/are prime. Figure it out. If a = p1·p2·p3·…·pm, then a·a = p1·p2·p3·…·pm·p1·p2·p3·…·pm, so every one of the m primes occurs twice in a2, so we have 2·m primes. N AND TAU OF N (AGAIN) 133 to the Fundamental Theorem of Arithmetic. So there is no rational number whose square is two. Any number whose square root is rational must contain an even number of every prime in its prime factorization. Thus, 8 = 2·2·2, so the square root of 8 is irrational. 16= 2·2·2·2, so the square root of 16 is rational. Cube roots of numbers whose prime factorizations don't contain a multiple of 3 of every prime factor are also irrational. And so on. Generalizing this further, we can prove n Theorem: If a is an integer, then the nth root of a ( a) is either an integer or an irrational number. Proof: Using fractional powers, n a is just another way to write a1/n. If rational then there are some integers u and v such that n n n a is u a = v, with u and v relatively un u prime. Then ( a)n = ( v)n, giving (a1/n)n = a = vn. Multiplying both sides by vn, we get vna = un. By the fundamental theorem of arithmetic, every prime factor of vna must be a prime factor of un. The prime factors of un are just the prime factors of u repeated n times, so the prime factors of vna must be prime factors of u. By definition, if a special number divides the product of two natural numbers, then it divides at least one of them. Every prime is special. So every prime factor of u must divide either vn or a. But u and v are relatively prime. None of the factors of u can divide v or any power of v. So every prime factor of u must be a factor of a. Every prime factor of un is a prime factor of u, so every prime factor of un is a prime factor of a. But un = vna. So every prime factor of vna is a prime factor of a. Since every prime factor of vna is a prime factor of a, so there are no prime u factors of vn. So vn = v = 1. So v = u, and a = un. Every prime factor of a must appear n times in the prime factorization of un. Thus, every prime factor of a must occur n times in the prime factorization of a. Then a is an nth power, and so integer. So, if irrational. n a is rational, then n a is an integer. Either n n a is an a is an integer or it is n and Tau of n (again) In Chapter 10 we tried to find a pattern in the relations between a number n and the number of its divisors τ(n). Knowing that each natural number has a unique prime 134 9 THE FUNDAMENTAL THEOREM OF ARITHMETIC factorization gives us additional data on each number. The new table (below) lists the divisors of each number, the prime factorization of each number, and the number of divisors of each number. I use the superscript notation to write powers of primes whenever a prime is repeated in the prime factorization. To be consistent, whenever a prime occurs only once in the prime factorization, I indicate it as raised to its first power, as p1. n 4 6 8 9 10 12 14 15 16 18 20 21 22 24 25 26 27 28 30 32 33 34 35 36 Divisors of n Prime factorization 1,2,4 1,2,3,6 1,2,4,8 1,3,9 1,2,5,10 1,2,3,4,6,12 1,2,7,14 1,3,5,15 1,2,4,8,16 1,2,3,6,9,18 1,2,4,5,10,20 1,3,7,21 1,2,11,22 1,2,3,4,6,8,12,24 1,5,25 1,2,13,26 1,3,9,27 1,2,4,7,14,28 1,2,3,5,6,10,15,30 1,2,4,8,16,32 1,3,11,33 1,2,17,34 1,5,7,35 1,2,3,4,6,9,12,18,36 22 21·31 23 32 21·51 22·31 21·71 31·51 24 21·32 22·51 31·71 21·111 23·31 52 21·131 33 22·71 21·31·51 25 31·111 21·171 51·71 22·32 τ(n) 3 4 4 3 4 6 4 4 5 6 6 4 4 8 3 4 4 6 8 6 4 4 4 9 Looking down the list, we notice something special about those numbers whose prime factorization includes powers of just one prime. For example, 4 = 22 and τ(4) = 3; 8 = 23 and τ(8) = 4; 16 = 24 and τ(16) = 5; 25 = 52 and τ(25) = 3; 32 = 25 and τ(32) = 6. We conjecture CONJECTURE: where the prime factorization of N = an (for some a and n), τ(N) = n+1. PROOF: Looking at the table, we see that all the divisors of 27 (= 33) (1, 3, 9, and 27) are powers of 3 (remember that 30 = 1, so 1 is a power of 3). All the divisors of 32 (= 25) are powers of 2. This has to be the case: the prime divisors of any number that divides 32 can only consist of powers of 2, because the prime factorization of 32 consists only of 2s. How many different divisors can we make using powers of 2 N AND TAU OF N (AGAIN) 135 between 0 and 5? We can make only 6, and they are 20, 21, 22, 23, 24, and 25. This fact must hold for any number whose prime factorization includes just one prime. Each prime has just itself as a prime factorization. For example, the complete prime factorization of 7 is just 71. And every prime has exactly two divisors (itself and 1). So our conjecture holds even for prime numbers. The prime factorization of most numbers involves more than one prime. To pick a simple example, look at 6. The prime factors of 6 are 21·31 and τ(6) = 4. But 4 = (1+1)(1+1). The prime factors of 12 are 22·31 and τ(12) = 6 = (2+1)(1+1). The prime factors of 36 are 22·32 and τ(36) = 9 = (2+1)(2+1). Going back to our original table, the prime factors of 48 are 24·31 and τ(48) = 10 = (4+1)(1+1). This suggests a conjecture which, when we prove it, becomes the theorem: THEOREM 4: If the prime factorization of N is p1a1·p2a2·p3a3·…·pnan, then τ(N) = (a1+1)(a2+1)(a3+1)…(an+1). Before trying to prove a statement, look for a counterexample. Even one counterexample disproves the statement – there is no point trying to prove it. If the conjecture/theorem is true, it can save a lot of bothersome calculations. Finding τ(1176) could be a major bore. But if the conjecture is true, then substituting 1176 for N, we find 1176 = 23·31·72 so n = 3, p1 = 2, p2 = 3, and p3 = 7; a1 = 3, a2 = 1, and a3 = 2. So τ(1176) = (3+1)(1+1)(2+1) = 4·2·3 = 24 if the conjecture/ theorem is true. Check to see if 1176 has 24 divisors. The divisors of 12 were 1, 2, 3, 4, 6 and 12, and the prime factors are 22·31. We notice that 1 = 20 = 30, 2 = 21, 3 = 31, 4 = 22, 6 = 21·31, and 12 = 22·31. Thus the factorization of each divisor of 12 contains only primes that are in the factorization of 12, and the exponent of each prime is some integer from 0 up to the corresponding exponent in the factorization of 12, inclusive. We can try to prove this as a lemma, which we can use to prove Theorem 4. LEMMA: If the prime factorization of N is p1a1·p2a2·p3a3·…·pnan, then any divisor d of N (where d 1) can be written as p1b1·p2b2·p3b3·…·pnbn, where 0 bi ai. PROOF: To prove the lemma, we will assume that there is a divisor d of N, at least one of whose prime factors q is not a p. Based on this assumption, we derive something false. This will show that all the prime divisors of d are ps. Let d be any divisor of N greater than 1 and assume d has a prime factor q which is not a p. We can write d = q·r, where r is the product of all of the other prime factors of d. (For example, if d = 60 = 22·31·51 and q = 2 then d = 2·30, so r = 30.) Since d divides N, there is a natural number t such that N = d·t. Substituting q·r in place of d, we get N = q·r·t. Now we can factor r·t into its prime factors and we 136 9 THE FUNDAMENTAL THEOREM OF ARITHMETIC have a prime factorization of N containing q. But we assumed that q was not in the prime factorization of N (it was not a p), and by the FTA the only prime factorization of N is N = p1a1·p2a2·p3a3·…·pnan. Try to prove that the exponent of each p in the prime factorization of d is some integer between 0 and the corresponding exponent a of p inclusive. One more thing will be useful on the way to proving Theorem 4. It will be needed later when we look at probability and statistics. It is called "the fundamental counting principle." The fundamental counting principle describes a means of calculating the number of ways in which a series of independent events can occur, or the number of ways in which a series of independent choices can be made. For example, suppose a student has two different baseball caps, three different shirts, and two different pairs of shoes. How many different ways can this student dress? He/she can wear either of the two caps with any of the three shirts, so there are 2·3 = 6 different combinations of caps and shirts. And with each of these combinations (s)he can wear either of the two different pairs of shoes, so there are 6·2 = 12 different possible combinations of cap, shirt, and shoes (ignoring the other possibility in each case – i.e., not wearing cap, shirt, and/or shoes). How many choices are there if we include no-shirt, no-cap, and no-shoes as options? The fundamental counting principle says that when there are a choices for doing one thing and b choices for doing a second and c choices for doing a third, and so on, and if none of the choices is affected by any other choice,11 then there are a·b·c·… ways of making all of the choices. P1 P2 S1 S2 P1 P2 S3 C1 C2 P1 P2 P1 P2 S1 S2 P1 P2 S3 P1 P2 11 A standard way of illustrating the fundamental counting principle (where the number of choices is not too large) is with a tree diagram. If we call the student's caps C1 and C2, the shirts S1, S2, and S3, and the pairs of shoes P1 and P2, the tree diagram of the student's dress combinations is as shown at left. If you count the arrowheads at the right, you see that there are 12 possible combinations. How can we use the prime factorization of 60 to construct all of the divisors of 60. The prime factorization of 60 is 22·31·51. To construct a divisor, we can use 20 = 1, 21 = 2, or 22 = 4, and either 30 = 1 or 31 = 3 and either 50 = 1 or 51 = 5. So we have three choices of a power of 2, two choices of a power of 3, and two choices of a power of 5. By the fundamental counting principle, the total number of possible combinations of choices is 3·2·2 = 12. That is, if the choices are independent of each other. N AND TAU OF N (AGAIN) 137 We now return to the theorem we want to prove. It is: THEOREM 4: If the prime factorization of N is p1a1·p2a2·p3a3·…·pnan, then τ(N) = (a1+1)(a2+1)(a3+1)…(an+1). PROOF: From the lemma we know that every divisor of N is of the form q1b1·q2b2·q3b3·…·qnbn where every q is a prime p in the prime factorization of N and every b is some integer between 0 and the corresponding a of the corresponding p. If any p in N does not appear in the prime factorization of the divisor, we can put it in with an exponent of 0. Any number with an exponent of 0 is 1, so this will not change the product of the prime factors. The divisor 1 can also be written this way using all zero exponents. Any number formed as just explained is in fact a divisor of N.12 Thus we can list all the divisors of N by using all possible combinations of the exponents. The exponent of p1 could be 0, 1, 2, …, up to a1, inclusive; the exponent of p2 could be 0, 1, 2, …, up to a2 inclusive; and so on until the exponent of pn could be 0, 1, 2, …, up to an inclusive. The total number of combinations of exponents is then (a1+1)· (a2+1)·…· (an+1), and this product equals τ(N). Having found a relationship between the prime factorization and the number of divisors of a number, look for other patterns. Look at τ(4), τ(9), and τ(36). τ(4) = 3, τ(9) = 3, and τ(36) = 9. Here τ(m·n) = τ(m)·τ(n). The same pattern holds for m = 3 and n = 5 and again for m = 3 and n = 25. We could come up with the: CONJECTURE: τ(m·n) = τ(m)·τ(n) for all natural numbers m and n. But one counterexample disproves a conjecture. Find cases where the conjecture does not hold. Compare cases where the conjecture holds with others where it does not hold. Look at the prime factorizations of m and n for both kinds of cases. The conjecture only holds where m and n are coprime –where the gcd of m and n is 1. Our new conjecture (to which we don't find any counterexamples) is THEOREM 5: If m and n are relatively prime, then τ(m·n) = τ(m)·τ(n). PROOF: Let n have prime factorization p1a1·p2a2·p3a3·…·pnan. Let m have prime factorization q1b1·q2b2·q3b3·…·qnbm. Since m and n have no common factors, a prime factorization of m·n is p1a1·p2a2·p3a3·…·pnan·q1b1·q2b2· q3b3·…·qnbm. So τ(m)·τ(n) = (a1+1)(a2+1)(a3+1)…(an+1)·(b1+1)(b2+1)(b3+1) …(bm+1), which is the value of τ(m·n). 12 Can you explain why? Try it. 138 9 THE FUNDAMENTAL THEOREM OF ARITHMETIC Diophantine Potatoes Potato-weighing problems are examples of Diophantine equations. Diophantine equations are algebraic equations in one or more unknowns, where the unknowns have integer coefficients, and for which integer solutions are sought. The simplest kind is the linear Diophantine equation in two unknowns, of the form ax+by = c, where a, b, and c are given integers, and we look for integer solutions of x and y. All of our potato problems can be expressed in terms of two questions. One is "If a and b are natural numbers, what natural numbers w can be expressed in the form w = xa+yb for integers x and y?" The other is "Given some particular w (weight of a spud) and given weights of a and b grams, what integer values of x and y satisfy (are solutions of) the equation?" The smallest potato we can weigh using a-gram and b-gram weights is equal to the greatest common divisor of a and b (by Lemma 1, above). Suppose (a, b) = d. When we find a solution for weighing a d-gram potato, we can weigh a potato that is a multiple of d grams just by piling on multiples of the a-gram and b-gram weights in the two pans of the scale. We can generalize from this to see that the linear Diophantine equation ax+by = c will have integer solutions for x and y only if c is some multiple of (a, b). We saw how to find solutions for x and y (if they exist) when c is the greatest common divisor of a and b. So we have Theorem 6: The linear Diophantine equation ax+by = c can be solved if and only if c is a multiple of (a, b). If c = k·(a, b), then a solution will be x = k·x , y = k·y . x and y are obtained from ax +by = (a, b) by starting with the last equation in the Euclidean algorithm used to find (a, b), and, working backward, replacing the remainder term in an equation of the Euclidean algorithm by the combination of the larger numbers it equals, as in Lemma 4 and the examples. Example: How would you weigh a 3-gram potato using 5-gram and 7-gram weights? First, check that 3 is a multiple of (5, 7). Using Euclid's algorithm, we get: Euclidean Algorithm Equations for finding m and n 7 = 1·5+2 5 = 2·2+1 2 = 2·1+0 2 = 7−1·5 1 = 5−2·2 Since the greatest common divisor of 5 and 7 is 1, we can weigh a 3-gram potato, because 3 is a multiple of 1. From the equations on the right, we see that 1 = 5−2·2 = 5−2·(7−1·5) = 5−2·7+2·5 = 3·5−2·7. So we can weigh a 1-gram potato by putting two 7-gram weights in one pan with the potato and three 5-gram weights in the other pan. But we want to weigh a 3-gram potato. So we take the equation 1 = 3·5−2·7 and multiply it by 3, giving 3 = 9·5−6·7. We can weigh a 3-gram potato by putting six 7-gram weights with the spud in one pan of the balance and nine 5-gram DIOPHANTINE POTATOES 139 weights in the other. In our equation ax+by = w where a = 7, b = 5, and w = 3, we found x = −6 and y = 9. But there is a much simpler way to do it: just put a 7-gram weight with the potato and two 5-gram weights in the other pan. Or we could put five 5-gram weights with the potato and balance it with four 7-gram weights. There are infinitely many ways to weigh a 3-gram potato with 5-gram and 7-gram weights. If we can get an equation that describes all of the solutions of a linear Diophantine equation, we can use it to find the simplest solution(s). It is provable (see question 4 in the exercise, below) that, where x and y satisfy a linear Diophantine equation ax+by = c, then x' = x+r(b/(a, b)) and y' = y−r(a/(a, b)) will satisfy ax'+by' = c, for all integer values of r. In our present case, (a, b) = 1, a = 7, and b = 5. Since we got x = −6 and y = 9 as one solution, then, for all integer values of r, we know that x = −6+5r and y = 9−7r will be solutions. If we set r = 1, we get x = −6+5 = −1 and y = 9−7 = 2. This gives 3 = 2·5−1·7, so one solution is to put a single 7-gram weight with the potato and two 5-gram weights in the other pan. Setting r = 2 gives the solution x = −6+10 = 4 and y = 9−14 = −5, giving 3 = 4·7−5·5. And so on. Exercise on Linear Diophantine Equations 1. Find a solution of each of these equations, or explain why no solution exists: (a) 192x+147y = 3; (b) 250x+162y = 6; (c) 825x+588y = 2. 2. 3. 4. On Spring Break, a bunch of students buy beer at $7 for a six-pack and $12 for a twelve. They spent a total of $195 on beer. How many six-packs and how many twelves did they buy? (Use the method of solving LDEs above, and remember that the numbers of cases must be positive). How many beers did they buy? Diophantus' boyhood lasted one-sixth of his life; his beard grew after one-twelfth more; he married after one-seventh more, and his son was born five years later; the son lived half as long as his father, and the father died four years after his son. How long did Diophantus live? (This is not really a Diophantine equation problem, but it's a cute puzzle.) Prove that, where x and y are a particular solution to a linear Diophantine equation ax+by = c, then x+r(b/(a, b)) and y−r(a/(a, b)) are solutions for all integer values of r.