 This lecture is part of an online course on the theory of numbers, and will be about the fundamental theorem of arithmetic. So the fundamental theorem of arithmetic says that every integer greater than zero is a product of primes in a unique way. Unique way, well, that means up to order. Because, of course, if we write a number as a product of primes, we can just change the order, but we don't count these as being different factorizations into primes. By the way, I've said that every integer greater than zero, and you might think that one is a counter example, but we just note that one is a product of an empty set of primes. The convention is that if you multiply together an empty set of numbers, that's said to be one by convention, the same way that if you add an empty set of numbers, that's zero by convention. So this applies even to the integer one if you set your conventions up correctly. And this was sort of proved by Euclid. Except that he had a slight problem actually stating this theorem. I'll comment a bit more about that afterwards, but let's first prove the fundamental theorem of arithmetic. So first, we have to prove existence of a decomposition into prime and the existence is easy. Suppose n is greater than one. If n is equal to one, we're finished because it's a product of no primes. Well, if n is greater than one, we pick a prime p such that p divides n. And how can we find a prime p? Well, p is the smallest integer greater than one dividing n. And you can easily check that smallest integer dividing n must actually be a prime. And then n can be written as p times n over p. And since n over p is less than n, we can apply induction and write this as a product of prime. So this becomes p times p2, p3 and so on. The tricky part is to prove uniqueness of the decomposition. So now let's do uniqueness. And this is, well, it's not exactly difficult, but it's a little bit tricky than proving existence. So here's the key step, which is due to Euclid. It says that if p, which is a prime, divides some product AB, then p divides A or p divides B, or possibly both. And this is easy to prove using Euclid's algorithm. Suppose p does not divide A. So we've got to prove that p divides B. Then we observe that A and p are co-prime. That's because p is a prime, so if it doesn't divide something, then it must be co-prime to that. So xA plus yp is equal to 1 for some x and y. So you remember we were discussing linear diaphanetine equations and showed you could solve this, provided the greatest common divisor of A and p divides 1. Well, since the greatest common divisor is 1, you can solve this. So here this uses Euclid's algorithm. And now we multiply this by B and we find xAB plus ypB is equal to B. And now we notice that p divides, well, it divides AB by assumption and it also divides p because it's equal to p. So p divides B, which is what we had to prove. And now with this key step, it's now easy to prove uniqueness. So let's now do the proof of uniqueness. Suppose that p1, p2, up to p, s is equal to q1, q2, up to qt, where the p i's and the q i's are all primed. And then we look at p1. We notice that p1 divides q1, q2, up to qt, where these are all primes. And this is a prime. Well, we've said that if p1 divides a product of two numbers, it must divide one of them. And you can easily extend this to saying that if p1 divides several numbers, it must divide one of them. So p1 divides qi, say, and this is prime. So p1 is equal to qi for some i. And then once we've got p1 is equal to p i, we can just cross off p1 and we can cross off qi and continue. So we cancel p1, qi and just continue. Now we want to discuss a bit whether or not Euclid proved this. And he didn't really quite prove it. In fact, he didn't even state the fundamental theorem of arithmetic. The problem was he had great difficulty in talking about a product of several numbers. Well, there are a few places in Euclid where he does talk about a product of several numbers. First of all, he's quite happy working with powers of a single number. And secondly, he's quite happy taking a product of numbers that are co-prime. And the reason for this is he's working geometrically. So for powers of numbers, he's sort of looking at a sequence of lines such that a ratio between any two lines is the same. So these pairs of lines are all similar. So he's thinking of numbers very geometrically. And if these numbers are co-prime, he can talk about the smallest number such that all of these divide, which is the same as the product of these are co-prime. The other thing he's prepared to do is he's prepared to take a product of two numbers because that's an area and a product of three numbers because that's a volume. But in general, products among three numbers are Euclid's great difficulty handling them. So he never even quite stated the fundamental theorem arithmetic. If you look in Thomas Heath's translation of Euclid, just have a sort of historical remark, if you look here, he says, Heath claims that Euclid has proved uniqueness of prime factorization. He says, you know, this proposition says, in other words, a number can be resolved into prime factors in only one way. However, I think that's actually a slight mistake by Thomas Heath. If you look at what Euclid actually says, he says, if a number is the least that is divided by various prime numbers, then any other prime number dividing it must be one of these primes. And that sort of looks a bit like uniqueness of prime factorization, except it's not quite because he's not taking a product of prime numbers. He's taking the least number that's divisible by all of them. So if all these prime numbers are different, then that is indeed their product. But this doesn't quite cover the case where you've got a square or cube of a prime dividing another. However, I would say that you should really credit the fundamental theorem of arithmetic to Euclid, because he's sort of more or less proved it apart from the slight problem he had with terminology and notation. He sort of had the key idea of the proof. So I'm willing to credit it to him. So there are some variations of this. Let me go down again. Variations. First of all, we can do the fundamental theorem of arithmetic for integers, not necessarily positive. And there you might say that, you know, kind of minus six is equal to two times minus three and things like this. So the difference is this time we must count minus two, minus three, minus five and so on are also primes. There's another difference. It's unique up to order and units. Because we might get six is equal to two times three, or it's equal to minus two times minus three, or it's equal to three times two and so on. There's a third slightly annoying technical thing is you also have to allow a unit in the factorization, because otherwise you can't write minus one as a product of primes, because it's not a product of an empty set of primes, because that's one, and it's not a product of a non-empty set of primes, because that's not going to give you a unit. So you have to sort of allow the factorization to be a factorization to primes and units. So apart from worrying about units that the proof for integers is almost exactly the same as the proof for positive numbers. Every non-zero integer can be written as a product of primes and units. There's another variation. The same proof works for polynomials over a field. So every polynomial can be written as a product of irreducible polynomials. So irreducible just means the same as prime for historical reasons. We say polynomials are irreducible if you can't factorize them. Up to order and units. So I should have said this is uniquely up to order and units. Well what are the units? The units are just the non-zero elements of the field. And the proof for polynomials is almost exactly the same as the proof for integers, because there's a sort of division by remainder algorithm, so Euclid's algorithm also works fine for polynomials. Well I made a bit of a fuss about saying the difficult part of factorization into primes is uniqueness. So I'm going to give some examples where you don't get uniqueness. So suppose you just look at integers greater than zero of the form 4n plus 1. So these are the integers 1, 5, 9, 13, 17 and so on. And now notice that 9 counts as a sort of prime because you can't write it as a product of two integers of the form 4n plus 1. You can write this 3 times 3 but we're sort of not allowing the integer 3. So you get these primes 13, 21. Well 25 isn't prime because it's equal to 5 squared. And then you get 29, 33, 37. Again 33 now counts as prime because 3 and 11 don't exist. And then we get 41. 45 is now 5 times 9. So that doesn't count as a prime and 49 counts as prime and so on. So and it's very easy to see that with this funny notion of prime every number of the form 4n plus 1 can be written as a product of primes. However this isn't unique because you can write 21 times 21 is equal to 9 times 49. And these numbers 21, 9 and 49 all count as primes in this funny sense if we don't allow integers of the form 4n plus 3 and this is not unique. So we can get things a bit like factorization of integers into prime where the factorization isn't unique. And now you see it's pretty obvious that the reason the factorization isn't unique is that we rather stupidly omitted some integers and if we add some extra integers like the ones of the form 4n plus 1 then we restore unique factorization. So this illustrates the idea that if you don't have unique factorization then maybe you can add some extra numbers in order to restore unique factorization. And for the next example let's look at all numbers of the form m plus n times root minus 5. And you notice that these behave a bit like integers. You can think of them as being some sort of generalized integers. Technically speaking they're the integers of an algebraic number field. And for these integers it turns out that quite a lot of things behave like the ordinary integers. We can still define primes and units but we find that we don't get unique factorization because 2 times 3 is equal to 1 plus root minus 5 times 1 minus root minus 5. And all these numbers of primes and they're easy to check they're not units times each other. So we don't get unique factorization. However we can sort of restore it. So you remember that for numbers of the form 4n plus 1 we could restore it by adding some extra numbers. And Kummer found a way to get unique factorization by adding what he called ideal numbers to this ring. And he found a way to add ideal numbers so 2 times 3 was equal to certain ideal numbers a times b and 3 was c times d and this one was a times c and this one was b times d. Now the ideal numbers are a little bit tricky because it turns out you they're not quite like ordinary numbers because you can't really add them. Anyway his name for ideal numbers gave rise to the term ideal in ring theory so it turns out you can more or less identify his ideal numbers with certain ideals in ring theory that's that's where the word ideal comes from. Another example where you don't even get unique factorization into primes is let's look at let's try to write functions as a product of prime functions. Well this just doesn't work if we allow any old functions for instance we can take the function x and this is not a unit because it vanishes somewhere but we can write it as x to the third cubed and then we can write this as x to the ninth to the power of nine or x to the one over 27 to the power of 27 so we can keep on dividing a top into smaller and smaller functions and that we just can't find any prime functions to write as a product of because you can keep subdividing it more and more. So as the first application of the fundamental theorem of arithmetic let's do the famous formula of Euler for the Riemann Zeta function so you recall this is one over one to the s plus one over two to the s plus one over three to the s and so on and Euler found this amazing in an infinite product for it it's one over one minus two to the minus s one over one minus three to the minus s one over one minus five to the minus s one over one minus seven to the minus s and so on where these are all the primes appearing and as I mentioned in the first lecture one of the reasons you don't count one as a prime is you don't want one appearing as one of these denominators. Well the proof of this isn't very difficult what you do is you notice one over one minus two to the minus s is equal to one plus two to the minus s plus two to the minus s squared plus two to the minus s cubed and so on. So that's this factor and then we multiply out one minus three to the minus s so it's one plus three to minus s plus three to the minus s squared and so on and then we get one plus five to the minus s plus five to the minus s squared and so on. So you get this huge infinite product and it doesn't really matter if it's an infinite product because you pick the term when you're multiplying it out you pick the term one in all but a finite number of factors and now let's look at a typical term in this infinite product so I suppose we might multiply this term and this term and this term and then we would just get ones all the rest of the way and let's see what that would give us. Well that's giving us a term one over two to the minus s cubed times one over three to the minus s times one over five to the minus s squared which is one over 60 to the s because 60 is equal to two cubed sorry not 600 because 600 is equal to two cubed times three times five squared and now you see that every number of the form one over n to the s turns up exactly once when you multiply this out because n can be written as a product of prime powers in a unique way. So what we can do is we can say this identity here is actually equivalent to the fundamental theorem of arithmetic. Actually Euler I always get Euler and Euclid modelled up so Euler used this to give a proof of an infinite number of primes so this is Euler's proof that the primes are infinite what you do is you look at his formula one over one to the s plus one over two to the s plus one over three to the s and so on equals one over one minus two to minus s one minus three to minus s one one minus five to the minus s and so on and you put s equals one and now you notice that this side is infinite as one over one plus one over two plus one over three and so on is infinite as you remember from calculus. On the other hand this is finite if the number of primes is finite because this would be just a finite product of finite numbers so the number of primes is infinite actually we can do better than this we can actually prove Euler pointed out that one over two plus one over three plus one over five plus one over seven and so on is also infinite so if you take the sum of the reciprocals of the primes that's still infinite and the reason is we know one over one minus two to minus one times one over one minus three to minus one and so on is infinite and now if you take the logarithms of this well the logarithm of one over one minus two to the minus one is it's going to be about a half and the logarithm of this is about a third and the logarithm of this is about a fifth and you can see that the errors are so small that they converge to something finite and the logarithm of this is still infinite so this shows that the sum of the inverses of all primes is infinite in fact Euler went a bit further he showed that if you take a half plus a third plus a fifth and so on up to plus one over p this is approximately the logarithm of the logarithm of p so although it tends to infinity it does so very very very very slowly because this function is it tends to infinity but it's constant for all practical purposes because it's so slowly increasing I mean you can't actually detect that this is infinite by adding up sums of inverses of primes on a computer it just seems to converge to something slightly bigger than three okay that's all for the fundamental theorem arithmetic next lecture I'll be talking about some arithmetic functions and how the fundamental theorem of arithmetic allows you to calculate them