The portal has been deactivated. Please contact your portal admin.

# Pop Video: All Possible Pythagorean Triples, Visualized

Grant Sanderson • 3Blue1Brown • Boclips

All Possible Pythagorean Triples, Visualized

14:28

### Video Transcript

When you first learned about the Pythagorean theorem, that the sum of the squares of the two shorter sides on a right triangle always equals the square of its hypotenuse. Iβm guessing that you came to be pretty familiar with a few examples like the three-four-five triangle or the five-12-13 triangle. And I think itβs easy to take for granted that these even exist. Examples where the sum of two perfect squares happens to be a perfect square. But keep in mind for comparison, if you were to change that exponent to any whole number bigger than two, you go from having many integer solutions to no solutions whatsoever. This is Fermatβs famous last theorem.

Now thereβs a special name for any triplet of whole numbers π, π, π, where π squared plus π squared equals π squared. Itβs called a Pythagorean triple. And what weβre gonna do here is find every single possible example. And moreover, weβll do so in a way where you can visualize how all of these triples fit together. This is an old question, pretty much as old as they come in math. There are some Babylonian clay tablets from 1800 BC, more than a millennium before Pythagoras himself, that just list these triples.

And by the way, while weβre talking about the Pythagorean theorem, it would be a shame not to share my favorite proof, for anyone who hasnβt already seen this. You start off by drawing a square on each side of the triangle. And if you take that π square and add four copies of the original triangle around it, you can get a big square whose side lengths are π plus π. But you can also arrange the π square and the π square together with four copies of the original triangle to get a big square whose side lengths are π plus π. What this means is that the negative space in each of these diagrams, the area of that big square minus four times the area of the triangle, is, from one perspective, clearly π squared plus π squared. But from another perspective, itβs π squared.

Anyway, back to the question of finding whole number solutions, start by reframing the question slightly. Among all of the points on the plane with integer coordinates β that is, all of these lattice points where gridlines cross β which ones are a whole number distance away from the origin? For example, the point three, four is a distance five away from the origin. And the point 12, five is a distance 13 away from the origin. The question of finding Pythagorean triples is completely equivalent to finding lattice points which are a whole number distance away from the origin. Of course, for most points like two, one, the distance from the origin is not a whole number. But it is at least the square root of a whole number. In this case, two squared plus one squared is five. So that distance, that hypotenuse there, is the square root of five.

Now taking what might seem like a strange step, but one which will justify itself in just a moment, think of this as the complex plane. So that every one of these points β like two, one here β is actually an individual complex number, in this case two plus π. What this gives is a surprisingly simple way to modify it to get a new point whose distance away from the origin is guaranteed to be a whole number, just square it. Algebraically, when you square a complex number expanding out this product and matching up all of the like terms. Because everything here just involves multiplying and adding integers, each component of the result is guaranteed to be an integer. In this case, you get three plus four π.

But you can also think of complex multiplication more geometrically. You take this line drawn from the origin to the number and consider the angle it makes with the horizontal axis as well as its length, which in this case is the square root of five. The effect of multiplying anything by this complex number is to rotate it by that angle and to stretch out by a factor equal to that length. So when you multiply the number by itself, the effect is to double that angle and, importantly, to square its length. Since the length started off as the square root of some whole number, this resulting length is guaranteed to be a whole number. In this case, five. Here, letβs try it with another example.

Start off with some complex number that has integer coordinates like three plus two π. In this case, the distance between this number and the origin is the square root of three squared plus two squared, which is the square root of 13. Now multiply this complex number by itself. The real part comes out to three squared plus two π squared, which is nine minus four. And the imaginary part is three times two plus two times three. So the result is five plus 12π. And the magnitude of this new number is 13, the square of the magnitude of our starting number, three plus two π. So simply squaring our randomly chosen lattice point gives us the five-12-13 triangle.

Thereβs something kind of magical about actually watching this work. It almost feels like cheating. You can start with any randomly chosen lattice point, like four plus π. And just by taking its square, you generate a Pythagorean triple. In this case, four plus π squared is 15 plus eight π, which has a distance 17 away from the origin. If you play around with this, which I encourage you to do, youβll find that some of the results are kind of boring. If both the coordinates of your starting point are the same or if one of them is zero, then the triple at the end is gonna include a zero. For example, two plus two π squared gives eight π. And even though technically this is indeed a lattice point, a whole number distance away from the origin, the triple that it corresponds to is zero squared plus eight squared equals eight squared. Which isnβt exactly something to write home about.

But for the most part, this method of squaring complex numbers is a surprisingly simple way to generate nontrivial Pythagorean triples. And you can even generalize it to get a nice formula. If you write the coordinates of your initial point as π’ and π£, then when you work out π’ plus π£π squared, the real part is π’ squared minus π£ squared. And the imaginary part is two times π’π£. The resulting distance from the origin is gonna be π’ squared plus π£ squared. Itβs kind of fun to work out this expression algebraically and see that it does indeed check out. And itβs also fun to plug in some random integers for π’ and π£ and get out a Pythagorean triple. Essentially, weβve created a machine where you give it any pair of integers and it gives you back some Pythagorean triple.

A really nice way to visualize this, which will be familiar to any of you who watched the zeta function video, is to watch every point of π§ on the plane move over to the point π§ squared. So for example, the point three plus two π is gonna move over to five plus 12π. The point π is gonna rotate 90 degrees to its square, negative one. The point negative one is gonna move over to one, and so on. Now when you do this to every single point on the plane, including the gridlines which Iβll make more colorful so theyβre easier to follow, hereβs what it looks like.

So the grid lines all get turned into these parabolic arcs. And every point where these arcs intersect is a place where your lattice point landed. So it corresponds to some Pythagorean triple. That is, if you draw a triangle whose hypotenuse is the line between any one of these points and the origin and whose legs are parallel to the axes, all three side lengths of that triangle will be whole numbers. What I love about this is that usually when you view Pythagorean triples, just on their own, they seem completely random and unconnected. And youβd be tempted to say thereβs no pattern. But here, we have a lot of them sitting together really organized, just sitting on the intersections of these nicely spaced curves.

Now you might ask if this accounts for every possible Pythagorean triple. Sadly, it does not. For example, you will never get the point six plus eight π using this method even though six, eight, 10 is a perfectly valid Pythagorean triple. There are simply no integers π’ and π£ where π’ plus π£π squared is six plus eight π. Likewise, you will never hit nine plus 12π. But these donβt really feel like anything new, do they? Since you can get each one of them by scaling up the familiar triple three, four, five, which is accounted for in our method. In fact, for reasons that Iβll explain shortly, every possible Pythagorean triple that we miss is just some multiple of a different triple that we hit. To give another example, we missed the point four plus three π. There are no integers π’ and π£ so that π’ plus π£π squared is four plus three π. In fact, youβll never hit any points whose imaginary component is odd.

However, we do hit eight plus six π. Thatβs three plus π squared. So even though we miss four plus three π, itβs just one-half times a point that we do hit. And by the way, youβll never have to scale down by anything smaller than one-half. A nice way to think about these multiples that we miss is to take each point that we get using this squaring method and draw a line from the origin through that point out to infinity. Marking all of the lattice points that this line hits will account for any multiples of these points that we might have missed. Doing this for all possible points, youβll account for every possible Pythagorean triple. Every right triangle that you ever have seen or ever will see that has whole number side lengths is accounted for somewhere in this diagram. To see why, weβll now shift to a different view of the Pythagorean triple problem, one that involves finding points on a unit circle that have rational coordinates.

If you take the expression π squared plus π squared equals π squared and divide out by that π squared, what you get is π over π squared plus π over π squared equals one. This gives us some point on the unit circle, π₯ squared plus π¦ squared equals one, whose coordinates are each rational numbers. This is what we call a rational point of the unit circle. And going the other way around, if you find some rational point on the unit circle. When you multiply out by a common denominator for each of those coordinates, what youβll land on is a point that has integer coordinates. And whose distance from the origin is also an integer.

With that in mind, consider our diagram where we squared every possible lattice point and then drew these radial lines through each one to account for any multiples that we might have missed. If you project all of these points onto the unit circle, each one moving along its corresponding radial line, what youβll end up with is a whole bunch of rational points on that circle. And keep in mind by the way, Iβm drawing only finitely many of these dots and lines. But if I drew all infinitely many lines corresponding to every possible squared lattice point, it would actually fill every single pixel of the screen.

Now if our method was incomplete, if we were missing a Pythagorean triple out there somewhere. It would mean that thereβs some rational point on this circle that we never hit once we project everything onto the circle. And let me show you why that cannot happen. Take any one of those rational points and draw a line between it and the point at negative one. When you compute the rise over run slope of this line, the rise between the two points is rational and the run is also rational. So the slope itself is just gonna be some rational number. So if we can show that our method of squaring complex numbers accounts for every possible rational slope here, itβs gonna guarantee that we hit every possible rational point of the unit circle, right?

Well, letβs think through our method. We start off with some point π’ plus π£π that has integer coordinates. And this number makes some angle off of the horizontal which Iβm gonna call π. Squaring this number, the resulting angle off the horizontal is two times π. And of course, when you project that onto the unit circle, itβs along the same radial line. So the corresponding rational point of the unit circle also has that same angle, two times π. And here, Iβll bring in a nice little bit of circle geometry. Which is that anytime you have an angle between two points on the circumference of a circle and its center. That turns out to be exactly two times the angle made by those same points and any other point on the circle circumference. Provided that that other point isnβt between the original two points.

What this means for our situation is that the line between negative one and the rational point on the circle must make an angle π with the horizontal. In other words, that line has the same slope as the line between the origin and our initial complex number, π’ plus π£π. But look at the rise over run slope of the line defined by our choice of integers, π’ and π£. The slope is π£ divided by π’. And of course, we can choose π£ and π’ to be whatever integers we want. And therefore, we do indeed account for every possible rational slope. So there you go, the radial lines from our method determined by all possible choices of π’ and π£ must pass through every rational point on this circle. And that means our method must hit every possible Pythagorean triple.

Nagwa uses cookies to ensure you get the best experience on our website. Learn more about our Privacy Policy.