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
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
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
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.