 This lecture is part of Berkeley Math 115, an introductory undergraduate course on number theory, and will be about Pythagorean triangles. So there's one obvious example of a Pythagorean triangle that everybody knows, which is the famous equation 3 squared plus 4 squared equals 5 squared, where we have a triangle with sides 3, 4 and 5, and it has a right angle. So it's possibly the most famous non-trivial theorem in mathematics. And what we want to do is to find other Pythagorean triangles, so that there are plenty of other examples like 5 squared plus 12 squared equals 13 squared and so on, and we want to sort of classify them all and understand what's going on. So this is obviously a special case of the equation x squared plus y squared equals z squared, which we want to solve in integers. And the first thing we observe is we may as well take x, y and z to be pairwise co-prime, because if some number g divides x and g divides y, then g also divides z, and we can simply look at x over g squared plus y over g squared equals z over g squared as a smaller solution. And of course we take, we probably want to take z to be non-zero too, because solving x squared plus y squared equals zero is not actually a terribly interesting problem. So this is actually a special case of something called a ternary quadratic form. So ternary means that it has three variables. So we're really looking at the ternary quadratic form x squared plus y squared minus z squared, and we're looking at representations of zero by this form. And as you can imagine, there's an entire theory of ternary quadratic forms asking what numbers they represent and so on, which is like the theory of binary quadratic forms, only it's quite a bit more complicated. So what we're looking at is what is more or less the simplest possible case that isn't completely trivial. We're just looking at representations of zero by this very easy ternary form. And we're going to use the ideas we've covered in previous lectures in order to study this equation. And we actually have four different methods of looking at the solutions. First of all, we're going to use the theory we had for the binary quadratic form x squared plus y squared equals n. And now we recall that n has a primitive representation if and only if n has no factors, no prime factors p of the form p congruent to three, mod four, and we also want four does not divide n. Now let's apply this to x squared plus y squared equals z squared. Well, we noticed that if z is divisible by two, then in fact z squared is divisible by four. And if x squared plus y squared is divisible by four, it's easy to check that both x and y must be even. So this would not be primitive. So if we have a solution of this, which is primitive, then the only prime factors of z are one, mod four. And conversely, if all its prime factors are one, mod four, then there's a primitive solution. And if we look at the first few solutions of Pythagoras's theorem, so three squared plus four squared equals five squared, five squared plus 12 squared equals 13 squared. There's another one which is eight squared plus 15 squared equals 17 squared or seven squared plus 24 squared equals 25 squared and so on. Let's look at these numbers on the right. You will see that these are all products of primes that are the form one, modulo four. So our theory of the binary quadratic form x squared plus y squared shows that this is exactly the condition for z to appear as a solution of the equation, that z must have all prime factors of the form one, mod four. And conversely, we've seen that if all prime factors of zero are the form one, mod four, then there is in fact a solution of this. So that's the first approach to the Pythagorean equation. It tells you exactly which possible z can appear on the right as the hypotenuse of a triangle, assuming it's a primitive triangle, of course. So now let's have method two, which is going to be a geometric method. So the first method used number theory, now we're going to use geometric. And if we notice, if you've got x squared plus y squared equals z squared, then we may as well divide by z and we get x squared plus y squared equals one with x and y, now rational numbers. And you know, this is just the equation of a circle. Let's see if everybody knows. So what we're doing is trying to find points on the circle with rational coordinates. And there are some obvious points, one zero, for example. And that just corresponds to y equals zero. And we have x squared equals z squared, which is a rather uninteresting solution. So we want to find other points on the circle, apart from the four obvious points. And there's a very niche geometric way of doing this. What we do is we just draw a line through this point here, and our rational points on the circle. And we look at its intersection, and we look at its intersection with the y axis. So this is going to have a point t here. And now we notice that if this point x, y has rational coordinates and t will also be rational. And conversely, if t is rational, then its intersection with the circle will have rational coordinates. So let's just see why. So the slope t of this line is going to be, well, you know how to work out the slope, it's just this distance here divided by this distance here. So we get t equals y over x plus one. And so we know x squared plus y squared equals one. So if we substitute y equals t x plus one in here, we get x squared plus t squared times x plus one squared equals one. So we can find that x equals one minus t squared over one plus t squared. And we can also solve for y, we get y is equal to t times this, so y is equal to two t over one plus t squared. So the solutions of Pythagoras's equation correspond exactly to points t on the y axis together with this one extra point here, because if we try and draw the line through this point and this point, it becomes somewhat ambiguous. For instance, we can see some examples of this. Suppose we take t equals a half, where we get x is three quarters over five four, which is three fifths, and y is equal to two t over one plus t squared, which is four fifths. So we get the solution three fifths squared plus four fifths squared equals one, which of course just gives us three squared plus four squared equals five squared. And similarly, by taking other rational values of t, you can find other solutions to Pythagoras's triumph. For instance, if you want to experiment, you can try t equals a third or t equals a quarter. And you see it's very easy to produce solutions of Pythagoras's equation just by picking your favorite rational number and substituting it into this. So method two shows us that the solutions more or less have the structure of a straight line, because we can convert the points on a circle to the points on the y axis. More precisely, it's a straight line plus a point. Or I think if you were doing projective geometry, you would say it was a projective line. So now let's look at method three, which is actually a bit similar to method two. Here we're going to use the Gaussian integers, or rather we're going to use the Gaussian rational numbers. And here, suppose we've got a solution to x squared plus y squared equals z squared. Well, as before, we can convert it to a solution of x squared plus y squared equals one with x and y rational. But now we're going to take x plus i y to be a complex number. So again, we can think of the solutions as lying on a circle. But now instead of thinking the circle as being points in the plane, we want to think of these points as being complex numbers. So here's a point one and here's a point i. It's minus one and minus i and so on. And then we've got these other points like three fifths plus four fifths i and so on. So what we want to do is to find complex numbers of absolute value one with real part and imaginary part both rational. And now we can get some extra structure because if a and b are complex numbers of absolute value one, so a equals b equals one. So you remember the absolute value is just the distance from the origin, then a times b is also equal to one. So if we've got two solutions of Pythagoras's equation, we can get a third one just by multiplying them together. So for instance, if we take three fifths plus four fifths i as one solution, we could just multiply it by say itself. Why not? Three fifths plus four fifths i and we get a new solution which is going to be minus seven over 25i plus 24 over 25i. And this corresponds to the new solution minus seven squared plus 24 squared equals 25 squared. So whenever we've got two solutions of Pythagorean triangle, we can just convert them into complex numbers multiply them together and get another solution. So in fact, since multiplication of complex numbers is associative and has inverses, we see the solutions of this actually form a group. So in other words, the co-prime solutions of Pythagoras's equation more or less form a group, at least if you sort of insist that z is positive because if you let z be zero, this doesn't work out. So that's the third method. Method four is a sort of algebraic method. So we're trying to solve x squared plus y squared equals z squared. And we're going to take x, y and z to be co-prime in pairs. And we're going to do this algebraically. Notice first of all, we can assume that z is odd because if z was even, this would imply x and y would both have to be even, and then we could divide everything by two. And if z is odd, x and y can't both be odd because then this would be even and they can't both be even because then again the sum would be even. So we may as well assume that x is even and y is odd. And now we're going to, now we're going to factor it. You notice this says that x squared equals z squared minus y squared. We can factor that as z minus y times z plus y. And now because z is even and y and z are odd, we can take out a factor of four from everything. We get x over two squared is equal to z minus y over two times z plus y over two. And now we notice that these two things here are actually co-prime because the only z and y are co-prime. So the only factor that z minus y and z plus y can have in common is two, but we've taken out this factor of two. And we also notice that product is a square. Well, if we've got two co-prime numbers whose product is a square, this means they must both be, they must both be prime. So we get z plus y over two is equal to r squared and z minus y over two is equal to s squared. And we can take r and s co-prime. So this gives us a solution of Pythagoras's triangle. We take x equals two r s and y equals r squared minus s squared. And then z, you can easily check, is equal to r squared plus s squared. So any solution with x, y, z co-prime and satisfying these conditions about oddness and evenness can be written like this for integers r and s. You can see this is actually a special, this comes from the identity r squared plus s squared is equal to r squared minus s squared plus two r s all squared, a simple algebraic identity. So this gives some solutions of Pythagoras's triangle. What we've shown is that in fact, it gives all of them provided we've got these oddness conditions. So again, we can take small values of r and s. For instance, if we take r equals one, s equals two, we find that five squared, so I should have put squares in there, is equal to minus three squared plus four squared, which is the basic solution all over again. And of course, you can take your favorite random integers r and s and generate lots of other solutions. Now I'm going to give an application of the fourth method to Fermat's last theorem. So Fermat's last theorem says that x to the n plus y to the n equals z to the n has no non-trivial solutions provided n is greater than or equal to three. So we've been doing the case n equals two, and it's got gazillions of solutions. If n is greater than or equal to three, it's got no solutions provided x, y and z and non-zero because it's got some, obviously, we can just put x equals zero and then y equals z and so on. So you need to exclude these trivial cases. This was finally proved by Wiles about 20 or 30 years ago. But meanwhile, before Wiles, Fermat had already proved this for n equals four. I think he also did the case n equals three. So Fermat's proof for n equals four is the simplest example of a technique known as Fermat's method of descent. And the idea is you show that if you can find a solution of the equation, then you can find a smaller solution. And as you can't keep on finding smaller and smaller solutions indefinitely, this shows that there are no solutions. And when I say a solution, I mean a non-trivial solution. So what we want to do is to show there are no solutions of x to the four plus y to the four equals z to the four, except for the trivial solutions. In fact, Fermat's method doesn't need a four op here. It will also work for x to the four plus y to the four equals z squared. So I imagine what Fermat did is he first applied his method of x to the four plus y to the four equals z to the four, and then noticed his method didn't actually use the fact that the exponent here was four and worked just as well for z squared. z squared is, of course, z squared. z to the four is z squared squared. So if you can solve this equation, you can solve that one. Anyway, what you do is you notice that this can be written as x squared squared plus y squared squared equals z squared. So it's a special case of Pythagoras's theorem, except that two of the arguments are squares. So again, mumbling something about z and y being even or odd, we can assume we can insert the solution of Pythagoras's theorem in before. We can assume x squared is r squared minus s squared, and y squared is equal to rs. So that should be a capital Y and a capital X. And now we notice that y squared is two rs, and r and s are co-prime. So two rs is a square. We notice that r is odd because x squared plus s squared equals r squared. And if we've got two times two co-prime numbers being a square, then two times one of these numbers must be a square, and the other number must be a square. Well, if r is odd, we must have r is a square, and two s is a square. So suppose we have r equals a squared, and suppose we have s is equal to two b squared. Well, now we can substitute this into this equation here, and we find we get x squared is equal to a squared minus four, so it is equal to a to the four minus four b to the four. Well, this doesn't seem to have worked. We seem to have gone from one equation. So if you've got a solution to this equation, we can get a solution to an apparently totally different equation. Well, it's not all that different. It's again saying x squared is equal to something to the power of four, except now we've got minus four something to the four. Well, now what we can do is we can just repeat everything with this equation, because this again looks like Pythagoras. So we get x squared equals a squared squared, except we have to put a two b squared squared on this. And now we can just repeat. And I'll leave this as an exercise. And what we find is that from any solution of this, we get a smaller solution of a squared equals e to the four plus f to the four. And now we're back to our original equation. So what we've shown is that a solution of x to the four plus y to the four equals z squared leads to a solution of the different equation x to the four minus four y to the four equals z squared. And this leads to an even smaller solution of x to the four plus y to the four equals z squared. So if you've got one non-trivial solution, we can keep getting smaller and smaller non-trivial solutions. And of course, you can't keep on getting smaller and smaller integers. So there are no non-trivial solutions. The reason why Fermat's method works turns out to be that this is something called an elliptic curve. And you can apply similar methods whenever you've got an elliptic curve. And this is one of the reasons why elliptic curves are so much easier to deal with than other sorts of curves. Okay, next lecture we'll be moving on to a completely different topic of Dirichlet series.